Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TestAssemblyStarting"/> class.
 /// </summary>
 public TestAssemblyStarting(IEnumerable <ITestCase> testCases, ITestAssembly testAssembly, DateTime startTime, string testEnvironment, string testFrameworkDisplayName)
     : base(testCases, testAssembly)
 {
     StartTime                = startTime;
     TestEnvironment          = testEnvironment;
     TestFrameworkDisplayName = testFrameworkDisplayName;
 }
        public TestAssemblyRunner(ITestAssembly testAssembly,
                                  IEnumerable <IXunitTestCase> testCases,
                                  IMessageSink diagnosticMessageSink,
                                  IMessageSink executionMessageSink,
                                  ITestFrameworkExecutionOptions executionOptions)
            : base(testAssembly, testCases, diagnosticMessageSink, executionMessageSink, executionOptions)
        {
            var tests = OrderTestCollections();

            this.RunIntegrationTests = executionOptions.GetValue <bool>(nameof(ElasticXunitRunOptions.RunIntegrationTests));
            this.RunUnitTests        = executionOptions.GetValue <bool>(nameof(ElasticXunitRunOptions.RunUnitTests));
            this.TestFilter          = executionOptions.GetValue <string>(nameof(ElasticXunitRunOptions.TestFilter));
            this.ClusterFilter       = executionOptions.GetValue <string>(nameof(ElasticXunitRunOptions.ClusterFilter));

            //bit side effecty, sets up _assemblyFixtureMappings before possibly letting xunit do its regular concurrency thing
            this._grouped = (from c in tests
                             let cluster = ClusterFixture(c.Item2.First().TestMethod.TestClass)
                                           let testcase = new GroupedByCluster {
                Collection = c.Item1, TestCases = c.Item2, Cluster = cluster
            }
                             group testcase by testcase.Cluster
                             into g
                             orderby g.Count() descending
                             select g).ToList();
        }
 /// <summary>
 /// Initializes a new <see cref="XunitTestAutomation"/>.
 /// </summary>
 /// <param name="testCase">An xUnit test case</param>
 /// <param name="testAssembly">The assembly containing the test case</param>
 public XunitTestAutomation(ITestCase testCase, ITestAssembly testAssembly)
 {
     Name       = testCase.DisplayName;
     Identifier = IdentifierFactory.CreateIdentifier(Name);
     Storage    = Path.GetFileName(testAssembly.Assembly.AssemblyPath);
     TestType   = "Unit Test";
 }
Ejemplo n.º 4
0
 internal TestCollection(ITestAssembly testAssembly, ITypeInfo collectionDefinition, string displayName, Guid uniqueId)
 {
     CollectionDefinition = collectionDefinition;
     DisplayName          = displayName;
     TestAssembly         = testAssembly ?? throw new ArgumentNullException(nameof(testAssembly));
     UniqueID             = uniqueId;
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XunitTestCollection"/> class.
 /// </summary>
 public XunitTestCollection(ITestAssembly testAssembly, ITypeInfo collectionDefinition, string displayName)
 {
     CollectionDefinition = collectionDefinition;
     DisplayName          = displayName;
     TestAssembly         = testAssembly;
     UniqueID             = Guid.NewGuid();
 }
		public VsixTestCollection (ITestAssembly testAssembly, ITypeInfo collectionDefinition, 
			string visualStudioVersion, string rootSuffix)
			: base (testAssembly, collectionDefinition, visualStudioVersion + " (" + rootSuffix + ")")
		{
			VisualStudioVersion = visualStudioVersion;
			RootSuffix = rootSuffix;
		}
Ejemplo n.º 7
0
        private void CreateNodesFor(ITestAssembly ta, int assemblyNodePosition)
        {
            var tests = ta.TestFixtureInfos;
            var root  = CreateOrFindAssemblyNode(ta, assemblyNodePosition);

            foreach (TestFixtureInfo tf in tests)
            {
                var classNode = CreateOrFindClassNode(ta, root.Nodes,
                                                      tf.FullName.Split(new[] { '.', '+' }),
                                                      0);
                classNode.Tag        = new UiElementInfo(ta, tf, null);
                classNode.ImageIndex = 2;
                foreach (TestMethodInfo tm in tf.TestMethods)
                {
                    var methodNode = CreateOrFindMethodNode(classNode.Nodes, tm);
                    methodNode.Tag = new UiElementInfo(ta, tf, tm);
                }
            }
            var temp = AfterSelect;

            AfterSelect = null;
            try {
                RestoreCheckState(root);
            }
            finally {
                AfterSelect = temp;
            }
            if (ConfigCurrentUser.AutoExpandTestHierarchy)
            {
                root.ExpandAll();
            }
        }
Ejemplo n.º 8
0
 public UiElementInfo(ITestAssembly ta, TestSuite ts)
 {
     _assemblyName     = ta.Name.FullName.Split(",".ToCharArray())[0];
     _assemblyPathName = ta.Name.CodeBase;
     _fixtureFullName  = ts.FullName;
     _methodName       = string.Empty;
 }
Ejemplo n.º 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TestAssemblyStarting"/> class.
 /// </summary>
 public TestAssemblyStarting(IEnumerable<ITestCase> testCases, ITestAssembly testAssembly, DateTime startTime, string testEnvironment, string testFrameworkDisplayName)
     : base(testCases, testAssembly)
 {
     StartTime = startTime;
     TestEnvironment = testEnvironment;
     TestFrameworkDisplayName = testFrameworkDisplayName;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="CollectionPerAssemblyTestCollectionFactory" /> class.
        /// </summary>
        /// <param name="testAssembly">The assembly.</param>
        /// <param name="messageAggregator">The message aggregator used to report <see cref="EnvironmentalWarning"/> messages.</param>
        public CollectionPerAssemblyTestCollectionFactory(ITestAssembly testAssembly, IMessageAggregator messageAggregator)
        {
            this.testAssembly = testAssembly;

            defaultCollection = new XunitTestCollection(testAssembly, null, "Test collection for " + Path.GetFileName(testAssembly.Assembly.AssemblyPath));
            collectionDefinitions = TestCollectionFactoryHelper.GetTestCollectionDefinitions(testAssembly.Assembly, messageAggregator);
        }
Ejemplo n.º 11
0
 /// <summary>
 /// Initializes a new instance of the <see cref="XunitTestCollection"/> class.
 /// </summary>
 public XunitTestCollection(ITestAssembly testAssembly, ITypeInfo collectionDefinition, string displayName)
 {
     CollectionDefinition = collectionDefinition;
     DisplayName = displayName;
     TestAssembly = testAssembly;
     UniqueID = Guid.NewGuid();
 }
Ejemplo n.º 12
0
        private void OnAssemblyAdded(object sender, AssemblyEventArgs args)
        {
            ITestAssembly ta = RecipeFactory.Current[args.AssemblyFullName];

            HookupAssembly(ta);
            UpdateFormTitle();
        }
Ejemplo n.º 13
0
 public PerformanceTestAssemblyRunner(ITestAssembly testAssembly,
                                      IEnumerable <IXunitTestCase> testCases,
                                      IMessageSink diagnosticMessageSink,
                                      IMessageSink executionMessageSink,
                                      ITestFrameworkExecutionOptions executionOptions,
                                      TestResourceSnapshotWriter testResourceSnapshotWriter,
                                      in bool resourceSnapshotEnabled) : base(testAssembly,
Ejemplo n.º 14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CollectionPerAssemblyTestCollectionFactory" /> class.
        /// </summary>
        /// <param name="testAssembly">The assembly.</param>
        /// <param name="messageAggregator">The message aggregator used to report <see cref="EnvironmentalWarning"/> messages.</param>
        public CollectionPerAssemblyTestCollectionFactory(ITestAssembly testAssembly, IMessageAggregator messageAggregator)
        {
            this.testAssembly = testAssembly;

            defaultCollection     = new XunitTestCollection(testAssembly, null, "Test collection for " + Path.GetFileName(testAssembly.Assembly.AssemblyPath));
            collectionDefinitions = TestCollectionFactoryHelper.GetTestCollectionDefinitions(testAssembly.Assembly, messageAggregator);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CollectionPerAssemblyTestCollectionFactory" /> class.
        /// </summary>
        /// <param name="testAssembly">The assembly.</param>
        /// <param name="diagnosticMessageSink">The message sink used to send diagnostic messages</param>
        public CollectionPerAssemblyTestCollectionFactory(ITestAssembly testAssembly, IMessageSink diagnosticMessageSink)
        {
            this.testAssembly = testAssembly;

            defaultCollection = new TestCollection(testAssembly, null, "Test collection for " + Path.GetFileName(testAssembly.Assembly.AssemblyPath));
            collectionDefinitions = TestCollectionFactoryHelper.GetTestCollectionDefinitions(testAssembly.Assembly, diagnosticMessageSink);
        }
Ejemplo n.º 16
0
        private void OnAssemblyRemoving(object sender, AssemblyEventArgs args)
        {
            ITestAssembly ta = RecipeFactory.Current[args.AssemblyFullName];

            UnhookAssembly(ta);
            UpdateFormTitle();
        }
Ejemplo n.º 17
0
 TestableXunitTestAssemblyRunner(ITestAssembly testAssembly,
                                 IEnumerable <IXunitTestCase> testCases,
                                 IMessageSink messageSink,
                                 ITestFrameworkOptions executionOptions)
     : base(testAssembly, testCases, messageSink, executionOptions)
 {
 }
Ejemplo n.º 18
0
        private void CreateNodesFor(ITestAssembly ta, int assemblyNodePosition)
        {
            TestFixtureInfoCollection tests = ta.TestFixtureInfos;
            SmartTreeNode             root  = CreateOrFindAssemblyNode(ta, assemblyNodePosition);

            foreach (TestFixtureInfo tf in tests)
            {
                SmartTreeNode classNode = CreateOrFindClassNode(ta, root.Nodes,
                                                                tf.FullName.Split(new char[] { '.', '+' }), 0);
                classNode.Tag        = new UiElementInfo(ta, tf, null);
                classNode.ImageIndex = 2;
                foreach (TestMethodInfo tm in tf.TestMethods)
                {
                    SmartTreeNode methodNode = CreateOrFindMethodNode(classNode.Nodes, tm);
                    methodNode.Tag = new UiElementInfo(ta, tf, tm);
                }
            }
            TreeViewEventHandler temp = AfterSelect;

            AfterSelect = null;
            try {
                RestoreCheckState(root);
                SetCheckedStatus(_treeTestHierarchy.Nodes);
            }
            finally {
                AfterSelect = temp;
            }
            if (_config.AutoExpandTestHierarchy)
            {
                root.ExpandAll();
            }
        }
Ejemplo n.º 19
0
 private void HookupAssembly(ITestAssembly addedTestAssembly)
 {
     addedTestAssembly.AssemblyFinished += _onAssemblyFinished;
     addedTestAssembly.TestsAborted     += _onTestsAborted;
     addedTestAssembly.AssemblyChanged  += AddedTestAssemblyAssemblyChanged;
     InvalidateTestCount();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="CollectionPerAssemblyTestCollectionFactory" /> class.
        /// </summary>
        /// <param name="testAssembly">The assembly.</param>
        /// <param name="diagnosticMessageSink">The message sink used to send diagnostic messages</param>
        public CollectionPerAssemblyTestCollectionFactory(ITestAssembly testAssembly, IMessageSink diagnosticMessageSink)
        {
            this.testAssembly = testAssembly;

            defaultCollection     = new TestCollection(testAssembly, null, "Test collection for " + Path.GetFileName(testAssembly.Assembly.AssemblyPath));
            collectionDefinitions = TestCollectionFactoryHelper.GetTestCollectionDefinitions(testAssembly.Assembly, diagnosticMessageSink);
        }
 public XunitTestAssemblyRunnerWithAssemblyFixture(ITestAssembly testAssembly,
                                                   IEnumerable<IXunitTestCase> testCases,
                                                   IMessageSink diagnosticMessageSink,
                                                   IMessageSink executionMessageSink,
                                                   ITestFrameworkExecutionOptions executionOptions)
     : base(testAssembly, testCases, diagnosticMessageSink, executionMessageSink, executionOptions)
 { }
Ejemplo n.º 22
0
        private static SmartTreeNode CreateOrFindClassNode(ITestAssembly ta, SmartTreeNodeCollection nodes,
                                                           string[] classFullNameParts, int index)
        {
            foreach (SmartTreeNode node in nodes)
            {
                if (node.Text == classFullNameParts[index])
                {
                    index++;
                    if (index < classFullNameParts.Length)
                    {
                        return(CreateOrFindClassNode(ta, node.Nodes, classFullNameParts, index));
                    }
                    else
                    {
                        return(node);
                    }
                }
            }
            SmartTreeNode newNode = new SmartTreeNode(classFullNameParts[index]);

            newNode.ImageIndex = 1;
            newNode.Tag        = new UiElementInfo(ta, new TestSuite(classFullNameParts, index));
            nodes.Add(newNode);
            while (++index < classFullNameParts.Length)
            {
                SmartTreeNode child = new SmartTreeNode(classFullNameParts[index]);
                child.ImageIndex = 1;
                child.Tag        = new UiElementInfo(ta, new TestSuite(classFullNameParts, index));
                newNode.Nodes.Add(child);
                newNode = child;
            }
            newNode.ImageIndex = 2;
            newNode.Tag        = null;
            return(newNode);
        }
Ejemplo n.º 23
0
 public TestAssemblyRunner(ITestAssembly testAssembly, IEnumerable <IXunitTestCase> testCases, IMessageSink diagnosticMessageSink, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions, TestCaseDeserializerArgs testCaseDeserializerArgs)
     : base(testAssembly, testCases, diagnosticMessageSink, executionMessageSink, executionOptions)
 {
     _testCaseDeserializerArgs = testCaseDeserializerArgs;
     _messageSyncWithEvents    = new MessageSinkWithEvents(executionMessageSink, diagnosticMessageSink);
     ExecutionMessageSink      = _messageSyncWithEvents; // the ExecutionMessageSink is used to create the base message bus
 }
 public XunitTestAssemblyRunnerWithAssemblyFixture(ITestAssembly testAssembly,
                                                   IEnumerable<IXunitTestCase> testCases,
                                                   IMessageSink diagnosticMessageSink,
                                                   IMessageSink executionMessageSink,
                                                   ITestFrameworkExecutionOptions executionOptions)
     : base(testAssembly, testCases, diagnosticMessageSink, executionMessageSink, executionOptions)
 { }
 public DependencyInjectionTestAssemblyRunner(IServiceProvider provider,
                                              ITestAssembly testAssembly,
                                              IEnumerable <IXunitTestCase> testCases,
                                              IMessageSink diagnosticMessageSink,
                                              IMessageSink executionMessageSink,
                                              ITestFrameworkExecutionOptions executionOptions)
     : base(testAssembly, testCases, diagnosticMessageSink,
            executionMessageSink, executionOptions) =>
Ejemplo n.º 26
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TestAssemblyCleanupFailure"/> class.
 /// </summary>
 public TestAssemblyCleanupFailure(IEnumerable <ITestCase> testCases, ITestAssembly testAssembly, string[] exceptionTypes, string[] messages, string[] stackTraces, int[] exceptionParentIndices)
     : base(testCases, testAssembly)
 {
     StackTraces            = stackTraces;
     Messages               = messages;
     ExceptionTypes         = exceptionTypes;
     ExceptionParentIndices = exceptionParentIndices;
 }
Ejemplo n.º 27
0
 private void UnhookAssembly(ITestAssembly ta)
 {
     ta.AssemblyChanged -= _onAssemblyChanged;
     ta.TestPassed      -= _testPassed;
     ta.TestFailed      -= _testFailed;
     ta.TestError       -= _testError;
     ta.TestSkipped     -= _testSkipped;
 }
 public ScenarioReportingXunitTestAssemblyRunner(ITestAssembly testAssembly,
                                                 IEnumerable <IXunitTestCase> testCases,
                                                 IMessageSink diagnosticMessageSink,
                                                 IMessageSink executionMessageSink,
                                                 ITestFrameworkExecutionOptions executionOptions)
     : base(testAssembly, testCases, diagnosticMessageSink, executionMessageSink, executionOptions)
 {
 }
Ejemplo n.º 29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TestAssemblyCleanupFailure"/> class.
 /// </summary>
 public TestAssemblyCleanupFailure(IEnumerable<ITestCase> testCases, ITestAssembly testAssembly, string[] exceptionTypes, string[] messages, string[] stackTraces, int[] exceptionParentIndices)
     : base(testCases, testAssembly)
 {
     StackTraces = stackTraces;
     Messages = messages;
     ExceptionTypes = exceptionTypes;
     ExceptionParentIndices = exceptionParentIndices;
 }
Ejemplo n.º 30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TestAssemblyFinished"/> class.
 /// </summary>
 public TestAssemblyFinished(IEnumerable<ITestCase> testCases, ITestAssembly testAssembly, decimal executionTime, int testsRun, int testsFailed, int testsSkipped)
     : base(testCases, testAssembly)
 {
     TestsSkipped = testsSkipped;
     TestsFailed = testsFailed;
     TestsRun = testsRun;
     ExecutionTime = executionTime;
 }
Ejemplo n.º 31
0
        private void OnAssemblyAdded(object sender, AssemblyEventArgs args)
        {
            ITestAssembly ta = RecipeFactory.Current[args.AssemblyFullName];

            HookupAssembly(ta);
            Reset();
            ResetCounters();
        }
Ejemplo n.º 32
0
 private void HookupAssembly(ITestAssembly ta)
 {
     ta.AssemblyChanged += _onAssemblyChanged;
     ta.TestPassed      += _testPassed;
     ta.TestFailed      += _testFailed;
     ta.TestError       += _testError;
     ta.TestSkipped     += _testSkipped;
 }
Ejemplo n.º 33
0
        private void OnAssemblyChangedAsync(object sender, AssemblyEventArgs args)
        {
            ITestAssembly ta           = RecipeFactory.Current[args.PathFileName];
            int           nodePosition = _treeTestHierarchy.Nodes.IndexOf(FindAssemblyNode(ta));

            RemoveNodesFor(ta);
            CreateNodesFor(ta, nodePosition);
        }
Ejemplo n.º 34
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TestAssemblyFinished"/> class.
 /// </summary>
 public TestAssemblyFinished(IEnumerable <ITestCase> testCases, ITestAssembly testAssembly, decimal executionTime, int testsRun, int testsFailed, int testsSkipped)
     : base(testCases, testAssembly)
 {
     TestsSkipped  = testsSkipped;
     TestsFailed   = testsFailed;
     TestsRun      = testsRun;
     ExecutionTime = executionTime;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="T:Xunit.Sdk.XunitTestAssemblyRunner"/> class.
 /// </summary>
 /// <param name="testAssembly">The assembly that contains the tests to be run.</param><param name="testCases">The test cases to be run.</param><param name="diagnosticMessageSink">The message sink to report diagnostic messages to.</param><param name="executionMessageSink">The message sink to report run status to.</param><param name="executionOptions">The user's requested execution options.</param>
 public BrowserTestAssemblyRunner(ITestAssembly testAssembly, IEnumerable<IXunitTestCase> testCases, IMessageSink diagnosticMessageSink, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions)
     : base(testAssembly, testCases.Cast<BrowserTestCase>().ToList(), diagnosticMessageSink, executionMessageSink, executionOptions)
 {
     BeforeAfterHandlers =
         testAssembly.Assembly.GetCustomAttributes(typeof(BeforeAfterAssemblyTestsAttribute))
             .Select(attributeInfo => attributeInfo.GetNamedArgument<Type>("HandlerType"))
             .Select(handlerType => ExtensibilityPointFactory.Get<IBeforeAfterAssemblyTests>(diagnosticMessageSink, handlerType))
             .ToList();
 }
Ejemplo n.º 36
0
 TestableXunitTestAssemblyRunner(ITestAssembly testAssembly,
                                 IEnumerable <IXunitTestCase> testCases,
                                 List <IMessageSinkMessage> diagnosticMessages,
                                 IMessageSink executionMessageSink,
                                 ITestFrameworkExecutionOptions executionOptions)
     : base(testAssembly, testCases, SpyMessageSink.Create(messages: diagnosticMessages), executionMessageSink, executionOptions)
 {
     DiagnosticMessages = diagnosticMessages;
 }
Ejemplo n.º 37
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TestAssemblyCleanupFailure"/> class.
 /// </summary>
 public TestAssemblyCleanupFailure(IEnumerable<ITestCase> testCases, ITestAssembly testAssembly, Exception ex)
     : base(testCases, testAssembly)
 {
     var failureInfo = ExceptionUtility.ConvertExceptionToFailureInformation(ex);
     ExceptionTypes = failureInfo.ExceptionTypes;
     Messages = failureInfo.Messages;
     StackTraces = failureInfo.StackTraces;
     ExceptionParentIndices = failureInfo.ExceptionParentIndices;
 }
Ejemplo n.º 38
0
        internal TestCollection(ITestAssembly testAssembly, ITypeInfo collectionDefinition, string displayName, Guid uniqueId)
        {
            Guard.ArgumentNotNull("testAssembly", testAssembly);

            CollectionDefinition = collectionDefinition;
            DisplayName          = displayName;
            TestAssembly         = testAssembly;
            UniqueID             = uniqueId;
        }
Ejemplo n.º 39
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestCollection"/> class.
        /// </summary>
        /// <param name="testAssembly">The test assembly the collection belongs to</param>
        /// <param name="collectionDefinition">The optional type which contains the collection definition</param>
        /// <param name="displayName">The display name for the test collection</param>
        public TestCollection(ITestAssembly testAssembly, ITypeInfo collectionDefinition, string displayName)
        {
            Guard.ArgumentNotNull("testAssembly", testAssembly);

            CollectionDefinition = collectionDefinition;
            DisplayName = displayName;
            TestAssembly = testAssembly;
            UniqueID = Guid.NewGuid();
        }
 public ObservationAssemblyRunner(ITestAssembly testAssembly,
                                  IEnumerable<IXunitTestCase> testCases,
                                  IMessageSink diagnosticMessageSink,
                                  IMessageSink executionMessageSink,
                                  ITestFrameworkExecutionOptions executionOptions)
     : base(testAssembly, testCases, diagnosticMessageSink, executionMessageSink, executionOptions)
 {
     TestCaseOrderer = new ObservationTestCaseOrderer();
 }
Ejemplo n.º 41
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TestCollection"/> class.
        /// </summary>
        /// <param name="testAssembly">The test assembly the collection belongs to</param>
        /// <param name="collectionDefinition">The optional type which contains the collection definition</param>
        /// <param name="displayName">The display name for the test collection</param>
        public TestCollection(ITestAssembly testAssembly, ITypeInfo collectionDefinition, string displayName)
        {
            Guard.ArgumentNotNull("testAssembly", testAssembly);

            CollectionDefinition = collectionDefinition;
            DisplayName          = displayName;
            TestAssembly         = testAssembly;
            UniqueID             = Guid.NewGuid();
        }
Ejemplo n.º 42
0
        private void OnAssemblyRemoving(object sender, AssemblyEventArgs args)
        {
            ITestAssembly ta = RecipeFactory.Current[args.AssemblyFullName];

            UnhookAssembly(ta);
            ClearAssemblySelections(ta);
            Reset();
            ResetCounters();
        }
Ejemplo n.º 43
0
 public UiElementInfo(ITestAssembly ta, ITestFixtureInfo tf, ITestMethodInfo tm) {
    if (ta != null) {
       _assemblyName = ta.Name.FullName.Split(",".ToCharArray())[0];
       _assemblyPathName = ta.Name.CodeBase;
    }
    _fixtureFullName = string.Empty;
    _methodName = string.Empty;
    if( tf != null ) {
       _fixtureFullName = tf.FullName;
       if( tm != null ) {
          _methodName = tm.Name;
          _methodFullName = tm.FullName;
       }
    }
 }
Ejemplo n.º 44
0
 private void RunTests(ITestAssembly testAssembly, ITestRun testRun) {
    if( testAssembly != null ) {
       try {
          //testAssembly.Refresh();
          testAssembly.RunTests(testRun);
       }
       catch( Exception ex ) {
          // Invoke the abort event b/c an exception that goes unhandled 
          // here is the equivalent of an aborted recipe.
          var recipeEventArgs = new RecipeEventArgs(ex.Message);
          TestsRunning = false;
          if( Aborted != null ) {
             Aborted(this, recipeEventArgs);
          }
       }
    }
 }
Ejemplo n.º 45
0
 public MyTestCollectionFactory(ITestAssembly assembly)
 {
     Assembly = assembly;
 }
Ejemplo n.º 46
0
 private void HookupAssembly(ITestAssembly ta) {
    ta.TestStarted += _testStarted;
    ta.TestFailed  += _testFailed;
    ta.TestError   += _testError;
    ta.TestSkipped += _testSkipped;
    ta.TestPassed  += _testPassed;
    ta.AssemblyChanged     += _assemblyChanged;
 }
        public static TestableXunitTestAssemblyRunner Create(ITestAssembly assembly = null,
                                                             IXunitTestCase[] testCases = null,
                                                             ITestFrameworkOptions options = null)
        {
            if (testCases == null)
                testCases = new[] { Mocks.XunitTestCase<ClassUnderTest>("Passing") };

            return new TestableXunitTestAssemblyRunner(
                assembly ?? testCases.First().TestMethod.TestClass.TestCollection.TestAssembly,
                testCases ?? new IXunitTestCase[0],
                SpyMessageSink.Create(),
                options ?? new TestFrameworkOptions()
            );
        }
 TestableXunitTestAssemblyRunner(ITestAssembly testAssembly,
                                 IEnumerable<IXunitTestCase> testCases,
                                 IMessageSink messageSink,
                                 ITestFrameworkOptions executionOptions)
     : base(testAssembly, testCases, messageSink, executionOptions) { }
        /// <summary>
        /// Initializes a new instance of the <see cref="CollectionPerClassTestCollectionFactory" /> class.
        /// </summary>
        /// <param name="testAssembly">The assembly info.</param>
        /// <param name="diagnosticMessageSink">The message sink used to send diagnostic messages</param>
        public CollectionPerClassTestCollectionFactory(ITestAssembly testAssembly, IMessageSink diagnosticMessageSink)
        {
            this.testAssembly = testAssembly;

            collectionDefinitions = TestCollectionFactoryHelper.GetTestCollectionDefinitions(testAssembly.Assembly, diagnosticMessageSink);
        }
Ejemplo n.º 50
0
 public UiElementInfo(ITestAssembly ta, TestSuite ts) {
    _assemblyName = ta.Name.FullName.Split(",".ToCharArray())[0];
    _assemblyPathName = ta.Name.CodeBase;
    _fixtureFullName = ts.FullName;
    _methodName = string.Empty;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="CollectionPerClassTestCollectionFactory" /> class.
        /// </summary>
        /// <param name="testAssembly">The assembly info.</param>
        /// <param name="messageAggregator">The message aggregator used to report <see cref="EnvironmentalWarning"/> messages.</param>
        public CollectionPerClassTestCollectionFactory(ITestAssembly testAssembly, IMessageAggregator messageAggregator)
        {
            this.testAssembly = testAssembly;

            collectionDefinitions = TestCollectionFactoryHelper.GetTestCollectionDefinitions(testAssembly.Assembly, messageAggregator);
        }
Ejemplo n.º 52
0
 private void HookupAssembly(ITestAssembly addedTestAssembly) {
    addedTestAssembly.AssemblyFinished += _onAssemblyFinished;
    addedTestAssembly.TestsAborted += _onTestsAborted;
    addedTestAssembly.AssemblyChanged += AddedTestAssemblyAssemblyChanged;
    InvalidateTestCount();
 }
Ejemplo n.º 53
0
 private void UnhookTestAssembly(ITestAssembly ta) {
    ta.TestError -= _onTestEvent;
    ta.TestFailed -= _onTestEvent;
    ta.TestPassed -= _onTestEvent;
 }
Ejemplo n.º 54
0
 private void UnhookAssembly(ITestAssembly testAssembly) {
    testAssembly.AssemblyFinished -= _onAssemblyFinished;
    testAssembly.TestsAborted -= _onTestsAborted;
    InvalidateTestCount();
 }
Ejemplo n.º 55
0
 private void HookupAssembly(ITestAssembly assembly) {
    assembly.TestError += _onTestErrorOrFail;
    assembly.TestFailed += _onTestErrorOrFail;
 }
Ejemplo n.º 56
0
 private void UnhookAssembly(ITestAssembly ta) {
    ta.TestStarted -= _testStarted;
    ta.TestFailed  -= _testFailed;
    ta.TestError   -= _testError;
    ta.TestSkipped -= _testSkipped;
    ta.TestPassed  -= _testPassed;
    ta.AssemblyChanged     -= _assemblyChanged;
 }
Ejemplo n.º 57
0
      internal void AddAssembly(ITestAssembly addedTestAssembly) {
         addedTestAssembly.SetConsoleOutputTo(_twConsole);

         HookupAssembly(addedTestAssembly);

         _testAssemblies.Add(addedTestAssembly);
         IsModified = true;

         if(addedTestAssembly.Name.FullName != string.Empty) {
            if(AssemblyAdded != null) {
               AssemblyAdded(this,
                  new AssemblyEventArgs(addedTestAssembly.Name.FullName,
                     addedTestAssembly.Name.CodeBase));
            }
         }
      }
 /// <summary>
 /// Initializes a new instance of the <see cref="CollectionPerAssemblyTestCollectionFactory" /> class.
 /// </summary>
 /// <param name="testAssembly">The assembly.</param>
 public CollectionPerAssemblyTestCollectionFactory(ITestAssembly testAssembly)
     : this(testAssembly, MessageAggregator.Instance) { }
Ejemplo n.º 59
0
 private void HookupTestAssembly(ITestAssembly ta) {
    ta.TestError += _onTestEvent;
    ta.TestFailed += _onTestEvent;
    ta.TestPassed += _onTestEvent;
 }
Ejemplo n.º 60
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TestAssemblyMessage"/> class.
 /// </summary>
 internal TestAssemblyMessage(ITestCase testCase, ITestAssembly testAssembly)
 {
     TestAssembly = testAssembly;
     TestCases = new ITestCase[] { testCase };
 }