Automated testing can be broken into two parts from a process perspective. First, there is the creation of the test in which you record all of your actions and verifications for a particular scenario. Second, you execute your test on a frequent basis in order to find regressions in your application. In this blog I will demonstrate a simple option for scheduling your tests for execution using a built in feature of Windows.
For WebUI Test Studio users that do not want to use Team Foundation Server to schedule test list executions there is a great alternative already built into Windows. Windows Task Scheduler is part of windows and is used by a lot of applications to manage and schedule various activities that run as part of Windows.
To get started, let’s first create a new Test List within WebUI Test Studio QA Edition.
The Test List is used to organize tests into a logical groups based on common attributes of the individual tests. For example, I could create a Test List that is for all tests in the project that test the functionality of my buttons controls. WebUI Test Studio has two types of Test Lists:
- Static Test List: A static test list is a list of tests to execute that is predefined and created with tests that already exist in the project at the time the test list is created. For example, the image above is a static test list where we have added all the “Buttons Tests” that already existed in the project.
- Dynamic Test List: A dynamic test list is generated at the time the test list is scheduled to execute. You define a set of rules and each time the test list gets executed the rules are applied to all tests within the project; any tests that meet the rules of the test list are executed as part of the dynamically generated list.
For more information on Test List Management in WebUI Test Studio check out this post.
Next, we need to start Windows Task Scheduler. Windows Task Scheduler can be found under “Administrative Tools” in all versions of Windows.
Task Scheduler organizes all scheduled tasks into folders under the main “Task Scheduler Library” node for the local computer. I recommend creating an additional node for your test list executions. In the image below you can see that I have named mine “WebUI Tests Execution”.
Next, select “Create Basic Task” from the actions menu items on the right hand side of the Task Scheduler window. Give the new task a descriptive name that will help you map it back to the test list you are going to execute. I will name mine “ButtonsTestList” so that it is in line with the test list I created in WebUI Test Studio.
Select “Next” to pull up the “Trigger” screen. This option will allow you to determine what event will start the task, whether this is time based or event based. For this example, I want my test list to be executed “Daily”.
Click “Next” and set the time you want your execution to run and the frequency. (In this example, we have chosen to execute this test list every night at 2 am)
Click “Next” and choose the “Start a program” option.
Click “Next” and select browse to go and find the Execution Runner named “ArtOfTest.Runner.exe” If you have chosen the default installation location for WebUI Test Studio, this can be found under C:\Program Files\Telerik\WebUI Test Studio 2010.1\Bin\ArtOfTest.Runner.exe)
Now that we have selected the execution engine .exe location we need to pass in the proper arguments so that the execution engine will know what test list to execute and where to find it. In the add arguments text box you want to enter: “list=[path to test list]” where [path to test list] is the location of the test list in your project directory. In this sample, the project is located at:
So we will use list=”C:\Users\eyhorn\Documents\WebUI Test Studio Projects\TestProject\TestLists\ButtonsTestList.aiilist” This is what we put into the “Add arguments” text box under the “Start a Program” menu. Leave the “Start in” text box blank.
As a side note, all test list in your project can be found under the “TestList” folder in your root project directly and they all have a file extension of “.aiilist”.
Click “Next” and review all of the options we have selected for this scheduled task.
Click “Finish” if everything is set up according to your desired execution schedule. You can test to make sure your test list executes properly by right mouse clicking the task and selecting “Run”, if your test list does not execute properly, make sure your path to your test list and the ArtOfTest.Runner.exe are correct.
Next, right mouse click your task and select “Properties”, make sure that you have “Run with highest privileges” option checked. This option is necessary because WebUI Tests interact with the mouse and keyboard during execution and need the elevated permissions to do so.
Voila, we have now scheduled our test list to run every night at 2:00 am on our local computer without having to use a build server or Team Foundation Server. This is a great option for small or large teams that do not want the overhead of setting up TFS or any CI server to do the execution.
There are a couple of things to note for Task Scheduler usage.
- The computer that is running the scheduled tests cannot be locked or have an active screen saver because the test needs to use the mouse and keyboard for some action steps during execution. This would include turning off any automatic desktop locking mechanism or a screen saver that is on a timer.
- The user account that the scheduled test is set to run under must be logged into the computer.
The important thing to remember for both of these items is that the purpose of a functional test is to simulate a real user interacting with the web application and to be able to replicate this we need to make sure that execution environment is configured properly.
Stay tuned for more WebUI Test Studio news and features.
And as always, let us know if you have questions or comments about any of our Automated Testing Tools.