Nunit-C#: run specific Tests through coding

后端 未结 2 1971
刺人心
刺人心 2021-01-03 02:16

I am using Selenium with C# for Automation, and I want to invoke NUnit through code as follows:

CoreExtensions.Host.InitializeService();
TestPackage testPack         


        
2条回答
  •  再見小時候
    2021-01-03 02:38

    Here is my working code....

        SimpleNameFilter filter = new SimpleNameFilter()
    
        foreach (DataRow DR in DT.Rows)
        {
        string Test = "FullNameOftheTest";
        filter.Add(Test); 
        }
    
      CoreExtensions.Host.InitializeService();
      TestPackage testPackage = new TestPackage(@"D:\Test\Test.dll");
      RemoteTestRunner remoteTestRunner = new RemoteTestRunner();
      remoteTestRunner.Load(testPackage);
      TestResult result = remoteTestRunner.Run(new NullListener(), filter, true,          LoggingThreshold.All);
      ResultSummarizer summaryResults = new ResultSummarizer(result);
    

    Thanks to all for your support, kishore.

提交回复
热议问题