Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>That doesn't sound like a test to me. Tests are typically parameterless (unless you're using <code>[TestCase]</code>s) and running it within a context of a single fixture would typically be enough -- it either passes once and that's good or it doesn't and it's a broken test.</p> <p>If you just have a method that does some validation on a string, you could set it up as a static method on some class (e.g. <code>TestHelpers</code>) and call it from whatever tests (in multiple test fixtures) need it.</p> <hr> <p>Here's another idea: inheritance. You can have a base fixture that has all your tests, and then fixtures that inherit from it that set up whatever variables you need. The tests will run for each fixture. I'm not familiar with Selenium RC, but you should be able to adapt the code below to set up whatever variables you need in various fixtures.</p> <pre><code>[TestFixture] public class BaseFixtureTests { protected IMyClass _myClass; [TestFixtureSetUp] public void FixtureSetup() { _myClass = ConfigureMyClass(); } protected virtual IMyClass ConfigureMyClass() { // fixtures that inherit from this will set up _myClass here as they see fit. } [Test] public void MyClassTest1() { // test something about _myClass; } } [TestFixture] public class MySpecificFixture1 : BaseFixtureTests { protected override IMyClass ConfigureMyClass() { return new MySpecificMyClassImplementation(); } } public class MySpecificMyClassImplementation : IMyClass { //some implementation } </code></pre> <p>You can also add extra tests in each fixture as well that don't test common functionality and don't need to be reused across fixtures.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload