Пример #1
0
 public override List <ITestClass> GetTestClasses(IAssembly assembly, TestClassInstanceDictionary instances)
 {
     return(new List <ITestClass>
     {
         _test
     });
 }
Пример #2
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();
 }
Пример #3
0
        public virtual List <ITestClass> GetTestClasses(IAssembly assembly, TestClassInstanceDictionary instances)
        {
            List <ITestClass> classes = new List <ITestClass>(assembly.GetTestClasses());

            FilterTestClasses(classes, instances);
            SortTestClasses(classes);
            return(classes);
        }
Пример #4
0
 /// <summary>
 /// If specific string-contains filters are present.
 /// </summary>
 /// <param name="classes">List of test classes.</param>
 /// <param name="instances">Test class instance dictionary.</param>
 protected virtual void FilterLegacyTestClasses(IList <ITestClass> classes, TestClassInstanceDictionary instances)
 {
     if (_settings != null && _settings.TestClassesToRun != null)
     {
         TestClassHelper.FilterTestsToRun(classes, _settings.TestClassesToRun);
     }
     if (_settings != null && _settings.Parameters != null)
     {
         TestClassHelper.FilterByFilterClassParameter(_settings.Parameters, classes);
     }
 }
        /// <summary>
        /// Apply tag filtering.
        /// </summary>
        /// <param name="classes">List of test classes.</param>
        /// <param name="instances">Test class instance dictionary.</param>
        protected override void FilterCustomTestClasses(IList <ITestClass> classes, TestClassInstanceDictionary instances)
        {
            if (string.IsNullOrEmpty(TagExpression))
            {
                return;
            }

            // Temporarily apply to the methods as well. If the class has no
            // methods that were matched in the expression, then cut the
            // class from the run.
            List <ITestClass> emptyTests = new List <ITestClass>();

            foreach (ITestClass test in classes)
            {
                object instance = instances.GetInstance(test.Type);
                ICollection <ITestMethod> methods = GetTestMethods(test, instance);
                TagManager tm = new TagManager(test.Type, methods);
                ApplyExpression(tm, methods);
                if (methods.Count == 0)
                {
                    emptyTests.Add(test);
                }
            }
            if (emptyTests.Count > 0)
            {
                foreach (ITestClass test in emptyTests)
                {
                    classes.Remove(test);
                }
            }

            if (!_hasLoggedWarning)
            {
                UnitTestHarness.LogWriter.Information(string.Format(CultureInfo.InvariantCulture, Properties.UnitTestMessage.TagTestRunFilter_TaggingInUse, TagExpression));
                _hasLoggedWarning = true;
            }
        }
 /// <summary>
 /// Exclusive attributes are not supported when also using tagging.
 /// </summary>
 /// <param name="classes">List of test classes.</param>
 /// <param name="instances">Test class instance dictionary.</param>
 protected override void FilterExclusiveTestClasses(IList <ITestClass> classes, TestClassInstanceDictionary instances)
 {
 }
Пример #7
0
 /// <summary>
 /// Filter out tests based on the standard-supported methods.
 /// </summary>
 /// <param name="classes">List of test classes.</param>
 /// <param name="instances">Test class instance dictionary.</param>
 protected void FilterTestClasses(IList <ITestClass> classes, TestClassInstanceDictionary instances)
 {
     FilterExclusiveTestClasses(classes, instances);
     FilterLegacyTestClasses(classes, instances);
     FilterCustomTestClasses(classes, instances);
 }
Пример #8
0
 /// <summary>
 /// If any exclusive classes are found, filter them.
 /// </summary>
 /// <param name="classes">List of test classes.</param>
 /// <param name="instances">Test class instance dictionary.</param>
 protected virtual void FilterExclusiveTestClasses(IList <ITestClass> classes, TestClassInstanceDictionary instances)
 {
     TestClassHelper.FilterExclusiveClasses(classes, UnitTestHarness.LogWriter);
 }
Пример #9
0
 /// <summary>
 /// Perform any custom filtering that the TestRunFilter needs.
 /// </summary>
 /// <param name="classes">List of test classes.</param>
 /// <param name="instances">Test class instance dictionary.</param>
 protected virtual void FilterCustomTestClasses(IList <ITestClass> classes, TestClassInstanceDictionary instances)
 {
 }