mardi 22 septembre 2015

Is it possible to parameterize TestFixtureSetUp (NUnit)

In my test the next flow takes place:

  1. I do some actions (for example buy a product) before all tests are run
  2. Then in each test I check one assertion

I use NUnit framework to run test so I use [TestFixtureSetUp] to mark a set of actions that are done once before all tests. Then I use [Test] or [TestCase()] to run tests.

Often it happens that I need to check the same things but perform different flow. So I have to parameterize [TestFixtureSetUp]. Can I somehow do it?

So I want to make my set of actions that is performed once before all tests depended on parameters.

If it's possible to do with different frameworks or different flow structure please tell me)

Example of my code:

 [TestFixtureSetUp] //This will be done once before all tests
 public void Buy_Regular_One_Draw_Ticket(WayToPay merchant)
 {
          //here I want to do some actions and use different merchants to pay. 

          //So how can I send different parameters to this method?

 }

Aucun commentaire:

Enregistrer un commentaire