jeudi 9 juillet 2015

MBunit - Different setups/fixtureinits with different argument on same tests

What I have is a test class containing lots of tests, and I want to run these tests multiple times with different setups/fixtureinits. To be more precise, I want to run these tests multiple times with a different argument on each run.

The problem is that the argument is generated by a config file, so I can't hardcode the FixtureInits with a given argument, since this is dependent on the config file.

What I'm looking for is a way to kind of create a factory of these arguments, and then for each argument run these tests with the Setup/FixtureInit with the given argument. Is this possible?

Here's a visual representation of what I'm thinking about

              /                                                                                                \
FixtureInit > |        #1(arg1)        ,        #2(arg2)        ,         ...         ,        #N(argN)        |
 / Setup      |   /````````^```````\   '   /````````^```````\   '                     '   /````````^```````\   |
              |  /                  \  '  /                  \  '                     '  /                  \  |
      Tests > | ( #1 , #2 , ... , #N ) ' ( #1 , #2 , ... , #N ) '                     ' ( #1 , #2 , ... , #N ) |
              \                                                                                                /

The tests are the same, but the Setup/FixtureInit is different.

Aucun commentaire:

Enregistrer un commentaire