NUnit test in database row?

Edit: I'm a super newbie to NUnit.

I do not know if this is possible, but I will go further and explain what I am trying to do.

I want to create a test device that runs a test with 5 different types of inputs that come from the database.

TestFixture
    Test using input1
    Test using input2
    Test using input3
    Test using input4
    Test using input5

Thus, from the NUnit GUI, I see which input is causing the error, but I do not know how to do this. I currently have something like:

[TestFixture]
public class Tester{
    [Test]
    public void RunTest(){
        var inputs = db.inputs.where(a=>a.id < 6).ToList();
        bool testSuccess=true;
        foreach(var input in inputs){
            bool success = RunTheTest(input);
            if(success==false){
                testSuccess=false;
            }
        }
        //Tell NUnit that the entire test failed because one input failed
    }
}

In this case, in NUnit, I see:

Tester
    RunTest

And even though RunTest tries 5 different inputs, I only know if there was one or more inputs that failed, but I do not know which input was unsuccessful. Basically I ask if it is possible to dynamically create tests that display in the NUnit GUI based on what I want to extract from the database.

+3
2

foreach Assert.True( success, string.Format("Input: {0}", input ));

ValueSourceAttribute, sourceType , , IEnumerable sourceName. .

0
+3

All Articles