lundi 22 mars 2021

Dynamic creation of test cases

I have a JSON file containing multiple test cases like so:

{
    "cases":[
        {
            "case": "TestCas1",
            "input": "x=y",
            "result": {
                "type": "Eq",
                "lhs": "x",
                "rhs": "y"
            }
        },
        { 
        //etc
        }
    ]
}

And I want to generate rougly something like:


   [Test]
   [TestCase("x=y", "x", "y", "Eq")]
   /// Other test cases from file go here.
   public void Test(string input, string lhs, string rhs, string op)

Now, I know how to parse and process the file, and how to write the test, but how do I generate TestCases based on the processed data?

Aucun commentaire:

Enregistrer un commentaire