3

I'm trying to setup TFS 2010 Lab Management based Automated Testing system and I have a "Test suite" (Created in TFS Test Manager) with following tests: 1) Start and Login 2) Create group 3) Create user and add to the group

These have order specified properly in Testing Center->Plan->(Test suite)->Order column

However, when they are executed (on TFS Lab Management Build) by Test Agent they run out of order: 2nd then 1st and then 3rd.

Is there a way to make Test Agent run these tests in order?

Thanks.

Ivan Zivkovic
  • 427
  • 3
  • 18
  • 4
    You should note that tests that depend on other tests is considered bad practice for testing. Instead, you should have a "setup" phase for each test that gets the code to the point where you can "execute" the actual test, then - once you've done the "verify" step - you do a "cleanup" phase to return to your normal state. I can't go into the advantages of making your tests independent of each other in a comment, but you should look around for more information on this. – Ethel Evans Feb 14 '11 at 22:13
  • 1
    For these tests, you would call a "start and login" method for one test in "execute" and "logout" in cleanup; then call "start and login" in setup and "create group" in execute and "delete group" and "logout" in cleanup; then "start and login" and "create group" in startup, "create user and add to group" in execute, then "delete group" and "logout" for cleanup in the last test. Yes, the runtime is longer, but the savings in maintainability are well worth it. – Ethel Evans Feb 14 '11 at 22:15

4 Answers4

1

Unfortunately, There's a blog regarding ordering test cases which says:

Please note this only applies to the manual tests but not automated tests. For automated tests, the order you set here will not be respected during test execution.

http://blogs.msdn.com/b/vstsqualitytools/archive/2009/11/21/run-your-tests-in-the-order-you-want.aspx

Maziar Taheri
  • 2,288
  • 22
  • 27
1

Create an Ordered Test, it's a simple list of which test methods should run and in what order.

Attila Szasz
  • 3,033
  • 3
  • 25
  • 39
  • In order to execute a single automated test in TFS you have to attach a one test from Visual Studio. This can be Ordered Test and best it can do is execute several other CodedUITests in context of a single Automated Test. What I need is to order these Automated Tests so that they can be executed in order: Login, Create Group, Create User, Assign User to Group need to be separate Automated Tests. – Ivan Zivkovic Feb 06 '11 at 06:24
1

I also had the same issue. I solved it by installing VS2010 Service Pack and TFS 2010 Service Pack in both the Test controller machine and Test agent machines. Please go through the following link for more details

http://social.msdn.microsoft.com/Forums/en-US/vsmantest/thread/29ac3c7b-b0cd-40f3-9992-f5f3c2285331

0

I don't know if it's a new feature but you can create Ordered tests. Just right click on your project in Solution Explorer and choose Add -> Ordered Test. Select you tests in order.

In Test Explorer, run you ordered test.

Details are in the link below but all I had to do is what I'd said above. I am using VS 2015 Enterprise.

https://msdn.microsoft.com/en-us/library/ms182631.aspx

Ewan
  • 541
  • 8
  • 23