0

Is there a way in MBUnit to have the same test called multiple times with different parameters in a sequence, as such:

Method1() Method2(param A) Method3() Method2(ParamB) Method4() Method2(ParamC)

etc? I've tried using the Order parameter but sadly I was too hopeful in that the Ordering would be considered class-wide rather than test-wide (1,2,3,4,5,6 as opposed to 1,2a,2b,2c,3,4).

MHTri
  • 910
  • 2
  • 10
  • 30

1 Answers1

0

Can you explain the reasons for needing this? This sounds like you have dependencies between your test methods, which in general isn't a good way to go about writing test code.

If you need something to be called in a particular sequence then why not simply expose it as a single test method which calls certain submethods in the order of your choosing?

Igor Brejc
  • 18,714
  • 13
  • 76
  • 95
  • I'm building a test suite using WatiN to test common site usage habits on a website. I thought it would've been useful to have made a 'utility' method which fires a stopwatch, get the browser to move to a specific URL, and time the page load. Then I'd simply call this method instead of c&p'ing several lines every time I needed to go to a different page. Anyway I think I've solved this using a StaticTestFactory. Have put some thought into removing dependancy but I'm not too big on C&P'ing code which would be used in several test classes, but it seems like I'll have to do it. – MHTri May 25 '10 at 20:27
  • My general suggestion for writing web test code (using WatiN, Selenium or similar) is to use the PageObjects pattern (http://code.google.com/p/selenium/wiki/PageObjects), this will help you minimize any c&p and make the code more manageable. – Igor Brejc May 26 '10 at 08:24
  • Thank you very much, that pattern is a brilliant idea. – MHTri May 27 '10 at 16:23