2

What is the order of test cases execution in Coded UI? I have my test cases created in Coded UI and they all follow a naming convention e.g. _, so my test cases name looks like:

  1. _001_UC_TT01_ShowResults
  2. _002_UC_TT01_DontShowResults
  3. _003_UC_TT01_XYZ
  4. _001_UC_TT02_ShowResults
  5. _002_UC_TT02_ABC and so on...

But when I execute these test cases from "Test Explorer" toolbar they don't run in the provided order. I know I can creat "Ordered Test" in Coded UI, if I want to execute my test cases in a particular order.

Currently, I am not facing any issue with execution of test cases but just for sake of my knowledge want to understand how Coded UI picks test cases in Test Explorer for execution.

2

As far as I know unless you create Ordered Tests the tests are always executed randomly as this is the preferred way of executing them to ensure there are no dependencies between them.

Otherwise you could end up with a test that passes just because you executed another test previously.

  • I really liked the concept behind this random selection. So is it right to say that the random order or selection is picked up at run time i.e. When I press run button in test explorer? Because I noticed that test cases are picked randomly but somehow that random procedure is fixed. – Dhiman Apr 11 '16 at 13:50
  • 1
    I think that the execution order is determined based on the namespace and the name of the test so the order does not change on every execution but every time you add tests to the suite. – Ignacio Soler Garcia Apr 11 '16 at 13:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.