1

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?

Zoltan Hernyak
  • 989
  • 1
  • 14
  • 35

1 Answers1

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:

  1. Add an Order Test file in your test project and use it to define the testing order.
  2. In your build definition, add a Run Functional Tests task. Change the Test Assembly like the picture below.
  3. In the Test Drop location I have the complete Project, and in the Executions folder I have the ordered test. hope it helps

    enter image description here


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

PatrickLu-MSFT
  • 49,478
  • 5
  • 35
  • 62
  • It is based on "test assembly", I want to execute a test suite, which contains an "unordered" set of test cases, linked to testmethods. I need to order the executions, but what to execute - it is determined by the test suite. More interesting - when B depends on A, but A is not selected in the test suite - it must be executed as well (selected or not) before B to execute B properly. – Zoltan Hernyak Jan 17 '18 at 13:43
  • @ZoltanHernyak Sorry for this, for ordering of manual tests case is available, however it's not able with automated tests for now. You could take a look at the use voice here and vote for it. https://visualstudio.uservoice.com/forums/330519-team-services/suggestions/13489221-enable-changing-the-order-of-test-cases-on-the-web – PatrickLu-MSFT Jan 19 '18 at 10:35