/// <summary> /// Create and intialize new TestSuiteRunner. /// </summary> /// <returns></returns> protected virtual TestSuiteRunner SetupTestRunner() { TestSuiteRunner runner = new TestSuiteRunner(); runner.Mode = DetermineRunnerMode(Args); return(runner); }
/// <summary> /// Run a specific TestCase /// </summary> /// /// <remarks> /// Running may be done asynchronously and in such cases this method /// will return before running is complete. Use the IsFinished and /// Finished event to monitor a running TestSuite. /// </remarks> /// <param name="caseNumber">Name of test to run.</param> /// <param name="args">Full command line args.</param> public void Run(string caseNumber, string[] args) { EnsureStart(); InitializeArgs(args); // Ensure case number. _caseNumber = caseNumber; if (string.IsNullOrEmpty(CaseNumber)) { PrintUsage(); throw new InvalidOperationException("Incorrect usage, must specify a test case number to run."); } TestCase test = CreateTestCase(CaseNumber); // If test doesn't exist in current Suite, check other suites. if (test.TestMethod == null && Suites.Count > 0) { TestSuite suite = FindTestSuiteWithTestId(CaseNumber); if (suite == null) { throw new ArgumentException("Couldn't find TestSuite with definition for TestId '" + CaseNumber + "'."); } suite.Finished += OnRunFinished; suite.Run(CaseNumber, Args); } else { TestSuiteRunner runner = SetupTestRunner(); runner.Finished += OnRunFinished; runner.RunVariations(test.Variations); } }
/// <summary> /// Run all TestSuites, TestCases, and TestVariations encapsulated /// by this TestSuite. /// </summary> /// <remarks> /// Running may be done asynchronously and in such cases this method /// will return before running is complete. Use the IsFinished and /// Finished event to monitor a running TestSuite. /// </remarks> /// <param name="args">Command line args</param> public virtual void Run(string[] args) { EnsureStart(); InitializeArgs(args); TestSuiteRunner runner = SetupTestRunner(); runner.Finished += OnRunFinished; runner.RunTests(TestCases); // }