/// <summary> /// Initializes dispatcher-stack attaching method container work item. /// </summary> /// <param name="testHarness">Test harness.</param> /// <param name="instance">Test instance.</param> /// <param name="method">Method reflection object.</param> /// <param name="testMethod">Test method metadata.</param> /// <param name="granularity">Granularity of test.</param> public UnitTestMethodContainer(ITestHarness testHarness, object instance, MethodInfo method, ITestMethod testMethod, TestGranularity granularity) : base(instance, method, testMethod) { _granularity = granularity; _harness = testHarness as UnitTestHarness; _testMethod = testMethod; }
public AssemblyDispatcher(UnitTestHarness testHarness, IUnitTestProvider provider, IAssembly testAssembly) : base(testHarness, provider) { _assembly = testAssembly; _testClasses = new TestWorkItemDispatcher(); _classInstances = new TestClassInstanceCollection(); }
/// <summary> /// A container type that handles an entire test class throughout the /// test run. /// </summary> /// <param name="filter">Test run filter object.</param> /// <param name="testHarness">The unit test harness.</param> /// <param name="testClass">The test class metadata interface.</param> /// <param name="instance">The object instance.</param> /// <param name="provider">The unit test provider.</param> public TestClassManager(TestRunFilter filter, UnitTestHarness testHarness, ITestClass testClass, object instance, IUnitTestProvider provider) : base(testHarness, provider) { _filter = filter; _testClass = testClass; _testExecutionQueue = new CompositeWorkItem(); _instance = instance; }
/// <summary> /// Create a new assembly manager, takes in the harness, provider /// reference and actual IAssembly object. /// </summary> /// <param name="runFilter">The test run filter object.</param> /// <param name="testHarness">Harness object.</param> /// <param name="provider">The unit test metadata provider.</param> /// <param name="testAssembly">The test assembly metadata object.</param> public AssemblyManager(TestRunFilter runFilter, UnitTestHarness testHarness, IUnitTestProvider provider, IAssembly testAssembly) : base(testHarness, provider) { _filter = runFilter; _assembly = testAssembly; _testClasses = new CompositeWorkItem(); ClassInstances = new TestClassInstanceDictionary(); }
public TestClassDispatcher( UnitTestHarness testHarness, ITestClass testClass, object instance, IUnitTestProvider provider) : base(testHarness, provider) { _testClass = testClass; _testExecutionQueue = new TestWorkItemDispatcher(); _instance = instance; }
/// <summary> /// Initializes a new unit test work item container. /// </summary> /// <param name="testHarness">The unit test harness.</param> /// <param name="unitTestProvider">The unit test metadata provider.</param> protected UnitTestCompositeWorkItem(UnitTestHarness testHarness, IUnitTestProvider unitTestProvider) : base() { _provider = unitTestProvider; TestHarness = testHarness; if (TestHarness == null) { throw new InvalidOperationException(Properties.UnitTestMessage.UnitTestCompositeWorkItem_ctor_NoTestHarness); } }
public TestMethodDispatcher( UnitTestHarness testHarness, ITestClass testClass, ITestMethod testMethod, object instance, IUnitTestProvider provider ) : base(testHarness, provider) { _testClass = testClass; _testMethod = testMethod; _instance = instance; }
/// <summary> /// Records a harness state for the unit test harness. /// </summary> /// <param name="harness">The unit test harness.</param> /// <param name="name">The harness name.</param> /// <param name="stage">The test stage.</param> public void UnitTestHarnessStage(UnitTestHarness harness, string name, TestStage stage) { LogMessage m = Create(LogMessageType.TestExecution, name); MarkUnitTestMessage(m); DecorateNameProperty(m, name); DecorateTestGranularity(m, TestGranularity.Harness); m[UnitTestLogDecorator.UnitTestHarness] = harness; DecorateTestStage(m, stage); Enqueue(m); }
/// <summary> /// Initializes a new test run filter with the tag expression. /// </summary> /// <param name="settings">Unit test settings.</param> /// <param name="harness">Unit test harness.</param> /// <param name="tagExpression">The tag expression to use.</param> public TagTestRunFilter(UnitTestSettings settings, UnitTestHarness harness, string tagExpression) : base(settings, harness) { SetTagExpression(tagExpression); }
/// <summary> /// Initializes a new test run filter using an existing settings file. /// </summary> /// <param name="settings">A unit test settings instance.</param> /// <param name="harness">The unit test harness.</param> public TestRunFilter(UnitTestSettings settings, UnitTestHarness harness) { TestRunName = DefaultTestRunName; _settings = settings; UnitTestHarness = harness; }
public RuntimeVersionTestRunFilter(UnitTestSettings settings, UnitTestHarness harness, TestRunFilter subfilter) : base(settings, harness) { this.subfilter = subfilter; this.runtime_version = settings.RuntimeVersion; }
/// <summary> /// Initializes the test harness. /// </summary> /// <param name="settings">The test harness settings.</param> public void Initialize(TestHarnessSettings settings) { UnitTestHarness uth = settings.TestHarness as UnitTestHarness; if (uth != null) { // Attach to store the log file uth.Publishing += (o, e) => WriteLogFile(uth); // Look for a unique test run ID if (uth.TestService != null) { string runId = uth.TestService.UniqueTestRunIdentifier; if (!string.IsNullOrEmpty(runId)) { TestRunId = runId; } } } string filename; if (settings.Parameters.TryGetValue("log", out filename)) { TestResultsFileName = filename; } // Read pre-defined optional settings and environment variables List <string> prefix = new List <string>(); string initialPrefix; if (settings.Parameters.TryGetValue("testRunNamePrefix", out initialPrefix)) { prefix.Add(initialPrefix); } string userName; if (settings.Parameters.TryGetValue("userName", out userName)) { prefix.Add(userName); UserName = userName; } string computerName; if (settings.Parameters.TryGetValue("computerName", out computerName)) { prefix.Add(computerName); ComputerName = computerName; } for (int i = 0; i < prefix.Count; ++i) { if (TestRunNamePrefix.Length > 0) { TestRunNamePrefix += "_"; } TestRunNamePrefix += prefix[i]; } }
public void WriteLogFile(UnitTestHarness harness) { _writer.Finished = DateTime.Now; harness.WriteLogFile(TestResultsFileName, _writer.GetXmlAsString()); }
/// <summary> /// Initializes a new unit test logic factory. /// </summary> /// <param name="harness">The unit test harness reference.</param> public UnitTestLogicFactory(UnitTestHarness harness) { _harness = harness; }