Nunit4 is not working with Json Testcase parameter

17 views Asked by At

I am able to discover the test cases, but when I execute them, it doesn't enter to my test method, It does work when I use Nunit3 but when I upgraded to Nunit4 stopped working when I use a json

[ { "ScenarioName": "test case 1", "firstName": "testdataname" }, { "ScenarioName": "test case 2", "firstName": "testdataname1" } ]

public class UnitTest1 { private const string Regression = @"TestData\regression.json";

 [SetUp]
 public void Setup()
 {

 }

 static IEnumerable<object> InputData()
 {
     dynamic stuff = JValue.Parse(FileHelper.LoadFile(Regression));
     foreach (var testcase in stuff)
     {
         yield return testcase;
     }

 }
 [TestCaseSource(nameof(InputData))]
 public void JsonParameterTest(JValue value)
 {
    var x = value.Value<string>("ScenarioName");
     Assert.Pass();
 }

}

I expect my json test case parameters should be able to execute the test case and pass the parameter to my test

0

There are 0 answers