Example #1
0
 /// <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;
 }
Example #2
0
 public AssemblyDispatcher(UnitTestHarness testHarness, IUnitTestProvider provider,
                           IAssembly testAssembly) : base(testHarness, provider)
 {
     _assembly       = testAssembly;
     _testClasses    = new TestWorkItemDispatcher();
     _classInstances = new TestClassInstanceCollection();
 }
Example #3
0
 /// <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;
 }
Example #4
0
 public AssemblyDispatcher(UnitTestHarness testHarness, IUnitTestProvider provider, 
     IAssembly testAssembly) : base(testHarness, provider)
 {
     _assembly = testAssembly;
     _testClasses = new TestWorkItemDispatcher();
     _classInstances = new TestClassInstanceCollection();
 }
Example #5
0
 /// <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();
 }
Example #6
0
 public TestClassDispatcher(
     UnitTestHarness testHarness, ITestClass testClass, 
     object instance, IUnitTestProvider provider) 
     : base(testHarness, provider)
 {
     _testClass = testClass;
     _testExecutionQueue = new TestWorkItemDispatcher();
     _instance = instance;
 }
Example #7
0
 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);
     }
 }
Example #9
0
 /// <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);
     }
 }
Example #10
0
 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);
        }
Example #12
0
 public TestMethodDispatcher(
     UnitTestHarness testHarness,
     ITestClass testClass, 
     ITestMethod testMethod, object instance, 
     IUnitTestProvider provider
     ) : base(testHarness, provider)
 {
     _testClass = testClass;
     _testMethod = testMethod;
     _instance = instance;
 }
Example #13
0
 /// <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);
 }
Example #14
0
 /// <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;
 }
Example #15
0
 /// <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);
 }
Example #16
0
 public RuntimeVersionTestRunFilter(UnitTestSettings settings, UnitTestHarness harness, TestRunFilter subfilter) : base(settings, harness)
 {
     this.subfilter       = subfilter;
     this.runtime_version = settings.RuntimeVersion;
 }
Example #17
0
        /// <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];
            }
        }
Example #18
0
 public void WriteLogFile(UnitTestHarness harness)
 {
     _writer.Finished = DateTime.Now;
     harness.WriteLogFile(TestResultsFileName, _writer.GetXmlAsString());
 }
Example #19
0
 /// <summary>
 /// Initializes a new unit test logic factory.
 /// </summary>
 /// <param name="harness">The unit test harness reference.</param>
 public UnitTestLogicFactory(UnitTestHarness harness)
 {
     _harness = harness;
 }
Example #20
0
 /// <summary>
 /// Initializes a new unit test logic factory.
 /// </summary>
 /// <param name="harness">The unit test harness reference.</param>
 public UnitTestLogicFactory(UnitTestHarness harness)
 {
     _harness = harness;
 }
Example #21
0
 /// <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;
 }