Question

First of all: I don't want to do unit tests, instead I am going to implement API tests. These tests should be executed in a defined order:

  • Login
  • Get something
  • Create something
  • Logout

I'd like to get this work in Visual Studio as well as by SonarQube (Gallio is the test automation platform I am using).

My problem is just to find a framework that supports my requirements.

I've already tested:

  • MSTest -> Does not support ordered tests at all, except implementing the Ordered Test template that is not supported by any Gallio test runner plugin.
  • XUnit -> It is possible to implement an ordering for test methods within test classes, but it is not possible to order test classes.

Is there any testing framework that supports this requirement and provides runner for Visual Studio as well as an appropriate plugin for Gallio?

Was it helpful?

Solution

MSTest has a TestInitialize attribute that you can use to initialize each test. In it you could put your Login. There is also a TestCleanup attribute. There you could put your LogOut. The Get and Create would have to be within one method in order to ensure that the Get always happens before the Create.

I am not familiar with SonarQube, so don't know whether it would handle this.

OTHER TIPS

The ones you specified don't support this because they are all unit test frameworks. Unit tests are supposed to be testing "units" of code, and therefore are independent of other tests. What you are looking for is integration tests or acceptance tests.

I haven't really done integration / acceptance testing so I can't suggest what you should use, but you can google around for some. The only one I know of off the top of my head is StoryTeller

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top