Search code examples
c#asp.netranorex

How to Count my pass fail test case and print at the end of execution


I have multiple test cases and I want to write a common method which can count all fail or pass test case and print the total pass and fail test case at the end of execution.


Solution

  • Instead of using a Class to count the total pass and fail cases, you can implement a method like this:

    int pass=0;
    int fail=0;
    for(int i=0;i<testCasescount;i++)
    {
      //read the input using Console.ReadLine();
      //check whether the test case is a pass or fail and appropriately increment the counter
    }
    //executed after the for loop i.e. all the test cases 
    Console.WriteLine(pass);
    Console.WriteLine(fail);