Greetings, fellow testers. Today I'd like to point out another feature of Test Studio that's designed to increase the flexibility of your tests and reduce the amount of work you'll need to do. This is one of those "little things" that may not seem like much when you're getting started, but as your test suite grows and your application develops, you'll look back and be glad you used it. I'm speaking of an optional, yet very valuable, property: BaseURL.
When using web applications, something we don't really think much about — although it's right in front of us — is the URL. This is, of course, the combination of protocol, server, directory and perhaps specific file that the browser uses to reach the application. We click on a link, or type it into the browser, and it works. No big deal.
As testers, though, the URL is very important because it can change. Users don't expect the URL to change — and once our application's deployed for them that is exactly what we want. During development and testing, though, various versions of our application will exist on different servers. Development servers, perhaps. The Test server(s). A Regression Test server. A Staging server. The Production server(s). We don't do all of our work tied to one server. Shouldn't our tests could take that into account, without us having to make extensive changes? Of course they should should. It's time to unshackle our tests, time to set them free to run amongst the servers.
Here's a basic test that we've looked at before. This attempts a login with credentials that we know to be invalid, and verifies that the correct message is returned to the user. But before it does that, it launches a browser and navigates to a specific URL:
If we just have that one test, that's ok. But I'm sure you didn't purchase Test Studio to execute just one test. What's going to happen if that 'Navigate to' step is in dozens or hundreds of tests... then the app is deployed to each of the other servers in our development life cycle? Enter BaseURL, a way to define a URL for all our tests to use, so that we can change it once per deployment and run all the tests.
Go back to the Project ribbon and open the Settings dialog box. Let's enter the URL there instead:
Now if we were to re-record this same test again, using the same URL, the portion specifed in the BaseURL property would be stripped out, leaving us with just this:
When the test is executed, the BaseURL is prepended to whatever is in the 'Navigate to' step and the whole thing is used. If we had been using http://testServer/login.aspx, for example, our BaseURL would be http://testServer and we'd see Navigate to:'/login.aspx' in the test step.
If you're using Test Lists — and I sure hope you are — note that Test Lists have their own BaseURL property. This property is inherited by the project settings by default, but you can change it. In this way you can create different Test Lists to run the same tests against different servers.
You can also see the documentation for more information on Recording Options and Running a Test Against Multiple Environments.
As always, feedback is welcome in the comments below or over on over on Twitter. let me know if you found this helpful, how you're using Test Lists, or what topics you'd like us to cover in the future.
is an Evangelist for Telerik's Test Studio.
He has worked in software support and testing for the better part of two decades, and enjoys exploring ways to make software easier to use.
He is a fan of movies and music, and can often be found on Twitter as @StevenJV.
Copyright © 2017, Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
Progress, Telerik, and certain product names used herein are trademarks or registered trademarks of Progress Software Corporation and/or one of its subsidiaries or affiliates in the U.S. and/or other countries. See Trademarks or appropriate markings.