Allen Chen的专栏

态度决定高度

在visual studio中自定义顺序执行测试用例

1. Select the test project from Solution Explorer, right-click and select Add Ordered Test.


2. Select the cases and put them in the order that you want. Also check “Continue afterfailure”, then Save the ordered test by choosing the File | Save option.


3. Select the orderedtest in Test List Editor and schedule to run.

4. Check the results inVS or website.



Note:

The Select test list to view dropdown has the option to choose the display of tests in the available Test Lists. Thisdropdown has the default All Loaded Tests, which displays all available tests under the project. The other options in the dropdown are Lists of Tests and Tests Not in a List. The List of Tests will display the test lists created using the Test List Editor. It is easier to include the number of tests grouped together and order them. The next option, Tests Not in a List, displays the available tests, which are not part of any Test Lists.

The preceding screenshot shows that most of theproperties are the same as the properties of the other test types. We canassociate this test with the TFS work items, iterations, and area.

Executing an ordered test

An ordered test can be run like any other test. Open the TestView window or the Test List Editor and select the ordered test fromthe list, then right-click and choose the Run Selection option from TestView or Run Checked Tests from the Test List Editor. Once theoption is selected, we can see the tests running one after the other in thesame order in which they are placed in the ordered test. After the execution ofthe ordered tests, the Test Results window will show the status of theordered test. If any of the tests in the list fails, then the ordered teststatus will be Failed. The summary of statuses of all the tests in theordered test is shown in the following screenshot in the toolbar. The sampleordered test application had four tests in the ordered tests, but two of themfailed and one had an error.

The Available tests list displays all the tests from the test project based on the option chosen in the dropdown.

Selected tests contains the tests that are selected from the available tests list to be placed in order.

The two right and left arrows are used for selecting and unselecting the tests from the Available tests list to the Selected Tests list. We can also select multiple tests by pressing the Ctrl keyand selecting the tests.

The up-down arrows on the right of the selected tests list are used for moving up or down the tests and setting the order for the testing in the Selected tests list.

The last option, the Continue after failure checkbox at the bottom of the window, is to override the default behavior of the ordered tests, aborting the execution after the failure of any test. If the option Continue after failure is unchecked, and if any test in the order fails, then all remaining tests will get aborted. In case the tests are not dependent, we can check this option and override the default behavior to allow the application to continue running the remaining tests in order.

Properties of an ordered test

Ordered tests have properties similar to the other test types, in addition to some specific properties. To view the properties, select the ordered test in the Test View or Test List Editor window,right-click and select the Properties option. The Properties dialog box displays the available properties for the ordered test.

An ordered test can be run like any other test. Open the TestView window or the Test List Editor and select the ordered test fromthe list, then right-click and choose the Run Selection option from TestView or Run Checked Tests from the Test List Editor. Once theoption is selected, we can see the tests running one after the other in thesame order in which they are placed in the ordered test. After the execution ofthe ordered tests, the Test Results window will show the status of theordered test. If any of the tests in the list fails, then the ordered teststatus will be Failed. The summary of statuses of all the tests in theordered test is shown in the following screenshot in the toolbar. The sampleordered test application had four tests in the ordered tests, but two of themfailed and one had an error.


<p class="MsoNormal" style=""margin-top:4.8pt;margin-right:0in;margin-bottom:9.6pt;">Clicking the Test run failed hyperlink in thestatus bar shows a detailed view of the test run summary:

<p class="MsoNormal" style=""margin-top:4.8pt;margin-right:0in;margin-bottom:9.6pt;">The Test Results window also provides detailedinformation about the tests run so far. To get these details, choose the testfrom the Test Results window and then right-click and choose the option,View Test Results Details, which opens the details window and displaysthe common results information such as Test Name, Result, Durationof the test run, Start Time, End Time, and so on.

The details window also displays the status of each andevery test run within the ordered test. In addition it displays the durationfor each test run, name, owner, and type of test in the list. Even though thesecond test in the list fails, the other tests continue to execute as if the Continueafter failure option was checked.

阅读更多
个人分类: 测试开发
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭