/// <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"; }
internal TestCollection(ITestAssembly testAssembly, ITypeInfo collectionDefinition, string displayName, Guid uniqueId) { CollectionDefinition = collectionDefinition; DisplayName = displayName; TestAssembly = testAssembly ?? throw new ArgumentNullException(nameof(testAssembly)); UniqueID = uniqueId; }
/// <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; }
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(); } }
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="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); }
private void OnAssemblyAdded(object sender, AssemblyEventArgs args) { ITestAssembly ta = RecipeFactory.Current[args.AssemblyFullName]; HookupAssembly(ta); UpdateFormTitle(); }
public PerformanceTestAssemblyRunner(ITestAssembly testAssembly, IEnumerable <IXunitTestCase> testCases, IMessageSink diagnosticMessageSink, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions, TestResourceSnapshotWriter testResourceSnapshotWriter, in bool resourceSnapshotEnabled) : base(testAssembly,
/// <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); }
private void OnAssemblyRemoving(object sender, AssemblyEventArgs args) { ITestAssembly ta = RecipeFactory.Current[args.AssemblyFullName]; UnhookAssembly(ta); UpdateFormTitle(); }
TestableXunitTestAssemblyRunner(ITestAssembly testAssembly, IEnumerable <IXunitTestCase> testCases, IMessageSink messageSink, ITestFrameworkOptions executionOptions) : base(testAssembly, testCases, messageSink, executionOptions) { }
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(); } }
private void HookupAssembly(ITestAssembly addedTestAssembly) { addedTestAssembly.AssemblyFinished += _onAssemblyFinished; addedTestAssembly.TestsAborted += _onTestsAborted; addedTestAssembly.AssemblyChanged += AddedTestAssemblyAssemblyChanged; InvalidateTestCount(); }
public XunitTestAssemblyRunnerWithAssemblyFixture(ITestAssembly testAssembly, IEnumerable<IXunitTestCase> testCases, IMessageSink diagnosticMessageSink, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) : base(testAssembly, testCases, diagnosticMessageSink, executionMessageSink, executionOptions) { }
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); }
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 DependencyInjectionTestAssemblyRunner(IServiceProvider provider, ITestAssembly testAssembly, IEnumerable <IXunitTestCase> testCases, IMessageSink diagnosticMessageSink, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) : base(testAssembly, testCases, diagnosticMessageSink, executionMessageSink, executionOptions) =>
/// <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; }
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) { }
/// <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; }
/// <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; }
private void OnAssemblyAdded(object sender, AssemblyEventArgs args) { ITestAssembly ta = RecipeFactory.Current[args.AssemblyFullName]; HookupAssembly(ta); Reset(); ResetCounters(); }
private void HookupAssembly(ITestAssembly ta) { ta.AssemblyChanged += _onAssemblyChanged; ta.TestPassed += _testPassed; ta.TestFailed += _testFailed; ta.TestError += _testError; ta.TestSkipped += _testSkipped; }
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); }
/// <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(); }
TestableXunitTestAssemblyRunner(ITestAssembly testAssembly, IEnumerable <IXunitTestCase> testCases, List <IMessageSinkMessage> diagnosticMessages, IMessageSink executionMessageSink, ITestFrameworkExecutionOptions executionOptions) : base(testAssembly, testCases, SpyMessageSink.Create(messages: diagnosticMessages), executionMessageSink, executionOptions) { DiagnosticMessages = diagnosticMessages; }
/// <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; }
internal TestCollection(ITestAssembly testAssembly, ITypeInfo collectionDefinition, string displayName, Guid uniqueId) { Guard.ArgumentNotNull("testAssembly", testAssembly); CollectionDefinition = collectionDefinition; DisplayName = displayName; TestAssembly = testAssembly; UniqueID = uniqueId; }
/// <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(); }
private void OnAssemblyRemoving(object sender, AssemblyEventArgs args) { ITestAssembly ta = RecipeFactory.Current[args.AssemblyFullName]; UnhookAssembly(ta); ClearAssemblySelections(ta); Reset(); ResetCounters(); }
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; } } }
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); } } } }
public MyTestCollectionFactory(ITestAssembly assembly) { Assembly = assembly; }
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); }
/// <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); }
private void UnhookTestAssembly(ITestAssembly ta) { ta.TestError -= _onTestEvent; ta.TestFailed -= _onTestEvent; ta.TestPassed -= _onTestEvent; }
private void UnhookAssembly(ITestAssembly testAssembly) { testAssembly.AssemblyFinished -= _onAssemblyFinished; testAssembly.TestsAborted -= _onTestsAborted; InvalidateTestCount(); }
private void HookupAssembly(ITestAssembly assembly) { assembly.TestError += _onTestErrorOrFail; assembly.TestFailed += _onTestErrorOrFail; }
private void UnhookAssembly(ITestAssembly ta) { ta.TestStarted -= _testStarted; ta.TestFailed -= _testFailed; ta.TestError -= _testError; ta.TestSkipped -= _testSkipped; ta.TestPassed -= _testPassed; ta.AssemblyChanged -= _assemblyChanged; }
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) { }
private void HookupTestAssembly(ITestAssembly ta) { ta.TestError += _onTestEvent; ta.TestFailed += _onTestEvent; ta.TestPassed += _onTestEvent; }
/// <summary> /// Initializes a new instance of the <see cref="TestAssemblyMessage"/> class. /// </summary> internal TestAssemblyMessage(ITestCase testCase, ITestAssembly testAssembly) { TestAssembly = testAssembly; TestCases = new ITestCase[] { testCase }; }