Build/Test Issues

NUnit [Random] supported?

Started by wernight on 6,938 views

All tests using RandomAttribute seem to fail.


    using NUnit.Framework;

    [TestFixture]
    class Program
    {
        [Test]
        public void MyTest([Random(-3.0, 3.0, 100)] double doubleValue)
        {
        }
    }



"This test was not executed during a planned execution run. Ensure your test project is stable and does not contain issues in initialisation/teardown fixtures."

Also, it's a little weird to count that test as 100 unit tests (in the Risk/Progress).

Edited

Hi,

NCrunch doesn't support the NUnit Random attribute when using Dynamic Analysis. Try changing your 'Framework utilisation type for NUnit' to 'StaticAnalysis' under your NCrunch solution configuration. Note that if you are using other advanced/edge NUnit features, the support for these is quite limited under static analysis. It may be easier to implement the random behaviour manually in your test.


Cheers,

Remco

Post a reply

Log in to reply.