问题
Supposing I have system tests: A and B, where A includes a record to a database, B tries to modify it. When A fails, B will fail as well. A and B are written as "unit tests" (test methods), A and B are tests cases in TFS as well, automated, linked to these "unit tests". I put them on a test plan, test suite, both of them. I want to execute them with the "Run Functional Tests" step.
How can I tell TFS to execute them in the right order?
What is the best practice to develop tests like these?
回答1:
You could created an ordered test, which is a container that holds other tests and guarantees that tests run in a specific order.
How to create an ordered test, you could refer this tutorial.
In TFS, you could follow below steps to run ordered test:
- Add an Order Test file in your test project and use it to define the testing order.
- In your build definition, add a Run Functional Tests task. Change the Test Assembly like the picture below.
In the Test Drop location I have the complete Project, and in the Executions folder I have the ordered test. hope it helps
Update
It's able to order for manual tests, however not able for automated test. If you need the ordering support for automated tests, please vote on this user voice item:
enable changing the order of test cases on the web gui and let them be tested in this order for automated tests
https://visualstudio.uservoice.com/forums/330519-team-services/suggestions/13489221-enable-changing-the-order-of-test-cases-on-the-web
来源:https://stackoverflow.com/questions/48275722/tfs-order-of-automata-tests-to-execute