Test Lists are a great way to organize tests and get execution results summarized. Telerik Test Studio includes the standard “Static” Test List that allows you to add existing tests from your project, but there is a small maintenance penalty for using the static list because each time you add a new test to your project it must be added to one of the existing test lists.
One of the underlying principals of Test Studio is to decrease the overall maintenance cost traditionally associated with automated testing. Within the world of test lists we have done this by creating the Dynamic Test List. The dynamic test list does exactly as its name implies; dynamically generating the list of tests at execution time.
Let’s take a walk through the process of creating a dynamic test list in our project. The first thing you do is navigate to the “Test Lists” tab within Telerik Test Studio and click the “Dynamic List” button under the add section in the ribbon bar.
After opening the “Add Dynamic Test List” dialog, you will notice several fields. Start with giving your dynamic test list a name. For this example, I am going to use “Steven's Priority 1 Tests”.
The next two sections in the dialog are “Rules” and “Results”. You will notice that by default under Results that all tests from our project are being shown in the grid. This is because we have yet to define any Rules for the dynamic test list.
For this test list I want it to execute all tests that have “Steven” as the owner and have a priority of “1”. Under rules we are going to select “Owner” and type in “Steven” and select the plus button to add. Each test's owner and priority, along with several other elements, can be set in the test properties window. We'll talk a little more about test properties in a minute.
One thing to notice here is that we can actually use a variety of conditional statements to make our rule even more flexible. For example, we could specify that our “Owner” “Starts With” “Steve” so that if anyone on the team created a test and put in only “Steve” this list would include all “Steve” and “Steven” as part of the test list during execution.
Now that we have defined our Dynamic Test List, each time this test list is executed, it will dynamically query all the tests in our project, based on the rules setup, and execute them rolling the execution results up to the test list level.
Using Custom Properties
Another powerful feature of the dynamic test list is the ability to use your own custom test property as part of the rules of the test list. This can be used to group tests by business requirement, technology group, or whatever categorization is appropriate for your organization.
Click back over to the “Project” tab. Select a test, right-click on it and choose Properties from the context menu. The Test Properties screen is where you'd set the Owner and Priority properties that we used in the above example. There are also three custom property fields you can use as well. In this example our team has been having difficulties handling the timing of controls populated by Ajax calls, so we have several tests in this area. For each of these tests, we have assigned the value “AjaxCascadingDropdowns” in their CustomProperty1 property.
Back in our dynamic Test List, we can now use this value as a rule.
Dynamic Test Lists add tremendous amount power and flexibility in defining what gets executed on your build server or locally. For large teams that have multiple members building automation, the Dynamic Test List really decreases test list maintenance cost by allowing each team member to only have to modify properties of their tests instead of all the static tests lists in the project.
And as always, let us know if you have questions or comments about any of our Automated Testing Tools.
Subscribe to be the first to get our expert-written articles and tutorials for developers!