/// <summary> /// Starts the process of running all the tests in the assembly. /// </summary> /// <param name="executor">The executor.</param> /// <param name="executionMessageSink">The message sink to report results back to.</param> /// <param name="discoveryOptions">The options to be used during test discovery.</param> /// <param name="executionOptions">The options to be used during test execution.</param> public static void RunAll(this ITestFrameworkExecutor executor, IMessageSinkWithTypes executionMessageSink, ITestFrameworkDiscoveryOptions discoveryOptions, ITestFrameworkExecutionOptions executionOptions) { executor.RunAll(MessageSinkAdapter.Wrap(executionMessageSink), discoveryOptions, executionOptions); }
private KeyValuePair <string, ITestCase> Deserialize(XunitTestFrameworkDiscoverer discoverer, ITestFrameworkExecutor executor, string serialization) { var testCase = default(ITestCase); try { if (serialization.Length > 3 && serialization.StartsWith(":F:")) { // Format from TestCaseDescriptorFactory: ":F:{typeName}:{methodName}:{defaultMethodDisplay}" var parts = serialization.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries); if (parts.Length > 3) { var typeInfo = discoverer.AssemblyInfo.GetType(parts[1]); var testClass = discoverer.CreateTestClass(typeInfo); var methodInfo = testClass.Class.GetMethod(parts[2], true); var testMethod = new TestMethod(testClass, methodInfo); var defaultMethodDisplay = (TestMethodDisplay)int.Parse(parts[3]); testCase = new XunitTestCase(DiagnosticMessageSink, defaultMethodDisplay, testMethod); } } if (testCase == null) { testCase = executor.Deserialize(serialization); } return(new KeyValuePair <string, ITestCase>(testCase.UniqueID, testCase)); } catch (Exception ex) { return(new KeyValuePair <string, ITestCase>(ex.ToString(), null)); } }
/// <summary> /// Starts the process of running selected tests in the assembly. /// </summary> /// <param name="executor">The executor.</param> /// <param name="testCases">The test cases to run.</param> /// <param name="executionMessageSink">The message sink to report results back to.</param> /// <param name="executionOptions">The options to be used during test execution.</param> public static void RunTests(this ITestFrameworkExecutor executor, IEnumerable <ITestCase> testCases, IMessageSinkWithTypes executionMessageSink, ITestFrameworkExecutionOptions executionOptions) { executor.RunTests(testCases, MessageSinkAdapter.Wrap(executionMessageSink), executionOptions); }
public WasmRunner(XunitProject project) { this.project = project; var assemblyFileName = "/" + project.Assemblies.First().AssemblyFilename; testCases = new List <ITestCase> (); var assembly = Assembly.LoadFrom(assemblyFileName); var assemblyInfo = new Xunit.Sdk.ReflectionAssemblyInfo(assembly); var collectionBehaviorAttribute = assemblyInfo.GetCustomAttributes(typeof(CollectionBehaviorAttribute)).SingleOrDefault(); var testAssembly = new TestAssembly(assemblyInfo, null); var collectionFactory = ExtensibilityPointFactory.GetXunitTestCollectionFactory(this, collectionBehaviorAttribute, testAssembly); /* * object res = null; * res = Activator.CreateInstance (typeof (Xunit.Sdk.MemberDataDiscoverer), true, true); * Console.WriteLine ("DISC2: " + res); */ DiscoveryOptions = TestFrameworkOptions.ForDiscovery(null); executionOptions = TestFrameworkOptions.ForExecution(null); discoverer = new Discoverer(assemblyInfo, new NullSourceInformationProvider(), this, DiscoveryOptions, collectionFactory); executor = new XunitTestFrameworkExecutor(assembly.GetName(), new NullSourceInformationProvider(), this); }
/// <summary> /// Initializes a new instance of the <see cref="Xunit2"/> class. /// </summary> /// <param name="useAppDomain">Determines whether tests should be run in a separate app domain.</param> /// <param name="sourceInformationProvider">The source code information provider.</param> /// <param name="assemblyFileName">The test assembly.</param> /// <param name="configFileName">The test assembly configuration file.</param> /// <param name="shadowCopy">If set to <c>true</c>, runs tests in a shadow copied app domain, which allows /// tests to be discovered and run without locking assembly files on disk.</param> /// <param name="shadowCopyFolder">The path on disk to use for shadow copying; if <c>null</c>, a folder /// will be automatically (randomly) generated</param> /// <param name="diagnosticMessageSink">The message sink which received <see cref="IDiagnosticMessage"/> messages.</param> /// <param name="verifyTestAssemblyExists">Determines whether or not the existence of the test assembly is verified.</param> public Xunit2(bool useAppDomain, ISourceInformationProvider sourceInformationProvider, string assemblyFileName, string configFileName = null, bool shadowCopy = true, string shadowCopyFolder = null, IMessageSink diagnosticMessageSink = null, bool verifyTestAssemblyExists = true) : base(useAppDomain, sourceInformationProvider, assemblyFileName, configFileName, shadowCopy, shadowCopyFolder, diagnosticMessageSink, verifyTestAssemblyExists) { #if ANDROID var assemblyName = Assembly.Load(assemblyFileName).GetName(); #elif WINDOWS_PHONE_APP || WINDOWS_PHONE || DOTNETCORE // Make sure we only use the short form for WPA81 var an = Assembly.Load(new AssemblyName { Name = Path.GetFileNameWithoutExtension(assemblyFileName) }).GetName(); var assemblyName = new AssemblyName { Name = an.Name, Version = an.Version }; #else var assemblyName = AssemblyName.GetAssemblyName(assemblyFileName); #endif executor = Framework.GetExecutor(assemblyName); }
/// <summary> /// Initializes a new instance of the <see cref="Xunit2"/> class. /// </summary> /// <param name="sourceInformationProvider">The source code information provider.</param> /// <param name="assemblyFileName">The test assembly.</param> /// <param name="configFileName">The test assembly configuration file.</param> /// <param name="shadowCopy">If set to <c>true</c>, runs tests in a shadow copied app domain, which allows /// tests to be discovered and run without locking assembly files on disk.</param> public Xunit2(ISourceInformationProvider sourceInformationProvider, string assemblyFileName, string configFileName = null, bool shadowCopy = true) : base(sourceInformationProvider, assemblyFileName, configFileName, shadowCopy) { AssemblyName assemblyName = AssemblyName.GetAssemblyName(assemblyFileName); executor = Framework.GetExecutor(assemblyName); }
/// <summary> /// Initializes a new instance of the <see cref="Xunit2"/> class. /// </summary> /// <param name="sourceInformationProvider">The source code information provider.</param> /// <param name="assemblyFileName">The test assembly.</param> /// <param name="configFileName">The test assembly configuration file.</param> /// <param name="shadowCopy">If set to <c>true</c>, runs tests in a shadow copied app domain, which allows /// tests to be discovered and run without locking assembly files on disk.</param> /// <param name="shadowCopyFolder">The path on disk to use for shadow copying; if <c>null</c>, a folder /// will be automatically (randomly) generated</param> public Xunit2(ISourceInformationProvider sourceInformationProvider, string assemblyFileName, string configFileName = null, bool shadowCopy = true, string shadowCopyFolder = null) : base(sourceInformationProvider, assemblyFileName, configFileName, shadowCopy, shadowCopyFolder) { #if !ANDROID AssemblyName assemblyName = AssemblyName.GetAssemblyName(assemblyFileName); #else var assm = Assembly.Load(assemblyFileName); AssemblyName assemblyName = assm.GetName(); #endif executor = Framework.GetExecutor(assemblyName); }
/// <summary> /// Initializes a new instance of the <see cref="Xunit2"/> class. /// </summary> /// <param name="sourceInformationProvider">The source code information provider.</param> /// <param name="assemblyFileName">The test assembly.</param> /// <param name="configFileName">The test assembly configuration file.</param> /// <param name="shadowCopy">If set to <c>true</c>, runs tests in a shadow copied app domain, which allows /// tests to be discovered and run without locking assembly files on disk.</param> /// <param name="shadowCopyFolder">The path on disk to use for shadow copying; if <c>null</c>, a folder /// will be automatically (randomly) generated</param> public Xunit2(ISourceInformationProvider sourceInformationProvider, string assemblyFileName, string configFileName = null, bool shadowCopy = true, string shadowCopyFolder = null) : base(sourceInformationProvider, assemblyFileName, configFileName, shadowCopy, shadowCopyFolder) { #if !ANDROID AssemblyName assemblyName = AssemblyName.GetAssemblyName(assemblyFileName); #else var assm = Assembly.Load(assemblyFileName); AssemblyName assemblyName = assm.GetName(); #endif executor = Framework.GetExecutor(assemblyName); }
static ITestCase Deserialize(LoggerHelper logger, ITestFrameworkExecutor executor, TestCase testCase) { try { return(executor.Deserialize(testCase.GetPropertyValue <string>(SerializedTestCaseProperty, null))); } catch (Exception ex) { logger.LogError("Unable to de-serialize test case {0}: {1}", testCase.DisplayName, ex); return(null); } }
private static KeyValuePair <string, ITestCase> Deserialize(ITestFrameworkDiscoverer discoverer, ITestFrameworkExecutor executor, string serialization) { try { var testCase = executor.Deserialize(serialization); return(new KeyValuePair <string, ITestCase>(testCase.UniqueID, testCase)); } catch (Exception ex) { return(new KeyValuePair <string, ITestCase>($"Test case deserialization failure: {ex}", null)); } }
/// <summary> /// Initializes a new instance of the <see cref="Xunit2"/> class. /// </summary> /// <param name="sourceInformationProvider">The source code information provider.</param> /// <param name="assemblyFileName">The test assembly.</param> /// <param name="configFileName">The test assembly configuration file.</param> /// <param name="shadowCopy">If set to <c>true</c>, runs tests in a shadow copied app domain, which allows /// tests to be discovered and run without locking assembly files on disk.</param> /// <param name="shadowCopyFolder">The path on disk to use for shadow copying; if <c>null</c>, a folder /// will be automatically (randomly) generated</param> public Xunit2(ISourceInformationProvider sourceInformationProvider, string assemblyFileName, string configFileName = null, bool shadowCopy = true, string shadowCopyFolder = null) : base(sourceInformationProvider, assemblyFileName, configFileName, shadowCopy, shadowCopyFolder) { #if ANDROID var assm = Assembly.Load(assemblyFileName); var assemblyName = assm.GetName(); #elif WINDOWS_PHONE_APP || WINDOWS_PHONE || ASPNET50 || ASPNETCORE50 var assm = Assembly.Load(new AssemblyName { Name = Path.GetFileNameWithoutExtension(assemblyFileName) }); var assemblyName = new AssemblyName { Name = assm.GetName().Name }; #else var assemblyName = AssemblyName.GetAssemblyName(assemblyFileName); #endif executor = Framework.GetExecutor(assemblyName); }
/// <summary> /// Initializes a new instance of the <see cref="Xunit2"/> class. /// </summary> /// <param name="appDomainSupport">Determines whether tests should be run in a separate app domain.</param> /// <param name="sourceInformationProvider">The source code information provider.</param> /// <param name="assemblyFileName">The test assembly.</param> /// <param name="configFileName">The test assembly configuration file.</param> /// <param name="shadowCopy">If set to <c>true</c>, runs tests in a shadow copied app domain, which allows /// tests to be discovered and run without locking assembly files on disk.</param> /// <param name="shadowCopyFolder">The path on disk to use for shadow copying; if <c>null</c>, a folder /// will be automatically (randomly) generated</param> /// <param name="diagnosticMessageSink">The message sink which received <see cref="IDiagnosticMessage"/> messages.</param> /// <param name="verifyTestAssemblyExists">Determines whether or not the existence of the test assembly is verified.</param> public Xunit2(AppDomainSupport appDomainSupport, ISourceInformationProvider sourceInformationProvider, string assemblyFileName, string configFileName = null, bool shadowCopy = true, string shadowCopyFolder = null, IMessageSink diagnosticMessageSink = null, bool verifyTestAssemblyExists = true) : base(appDomainSupport, sourceInformationProvider, assemblyFileName, configFileName, shadowCopy, shadowCopyFolder, diagnosticMessageSink, verifyTestAssemblyExists) { #if PLATFORM_DOTNET var an = Assembly.Load(new AssemblyName { Name = Path.GetFileNameWithoutExtension(assemblyFileName) }).GetName(); var assemblyName = new AssemblyName { Name = an.Name, Version = an.Version }; #else var assemblyName = AssemblyName.GetAssemblyName(assemblyFileName); #endif executor = Framework.GetExecutor(assemblyName); }
/// <summary> /// Initializes a new instance of the <see cref="Xunit2"/> class. /// </summary> /// <param name="sourceInformationProvider">The source code information provider.</param> /// <param name="assemblyFileName">The test assembly.</param> /// <param name="configFileName">The test assembly configuration file.</param> /// <param name="shadowCopy">If set to <c>true</c>, runs tests in a shadow copied app domain, which allows /// tests to be discovered and run without locking assembly files on disk.</param> /// <param name="shadowCopyFolder">The path on disk to use for shadow copying; if <c>null</c>, a folder /// will be automatically (randomly) generated</param> public Xunit2(ISourceInformationProvider sourceInformationProvider, string assemblyFileName, string configFileName = null, bool shadowCopy = true, string shadowCopyFolder = null) : base(sourceInformationProvider, assemblyFileName, configFileName, shadowCopy, shadowCopyFolder) { #if ANDROID var assm = Assembly.Load(assemblyFileName); var assemblyName = assm.GetName(); #elif WINDOWS_PHONE_APP || WINDOWS_PHONE || ASPNET50 || ASPNETCORE50 var assm = Assembly.Load(new AssemblyName { Name = Path.GetFileNameWithoutExtension(assemblyFileName) }); var assemblyName = new AssemblyName { Name = assm.GetName().Name }; #else var assemblyName = AssemblyName.GetAssemblyName(assemblyFileName); #endif executor = Framework.GetExecutor(assemblyName); }
/// <summary> /// Initializes a new instance of the <see cref="Xunit2"/> class. /// </summary> /// <param name="sourceInformationProvider">The source code information provider.</param> /// <param name="assemblyFileName">The test assembly.</param> /// <param name="configFileName">The test assembly configuration file.</param> /// <param name="shadowCopy">If set to <c>true</c>, runs tests in a shadow copied app domain, which allows /// tests to be discovered and run without locking assembly files on disk.</param> /// <param name="shadowCopyFolder">The path on disk to use for shadow copying; if <c>null</c>, a folder /// will be automatically (randomly) generated</param> /// <param name="diagnosticMessageSink">The message sink which received <see cref="IDiagnosticMessage"/> messages.</param> public Xunit2(ISourceInformationProvider sourceInformationProvider, string assemblyFileName, string configFileName = null, bool shadowCopy = true, string shadowCopyFolder = null, IMessageSink diagnosticMessageSink = null) : base(sourceInformationProvider, assemblyFileName, configFileName, shadowCopy, shadowCopyFolder, diagnosticMessageSink) { #if ANDROID var assm = Assembly.Load(assemblyFileName); var assemblyName = assm.GetName(); #elif WINDOWS_PHONE_APP || WINDOWS_PHONE || DNX451 || DNXCORE50 var assm = Assembly.Load(new AssemblyName { Name = Path.GetFileNameWithoutExtension(assemblyFileName) }); var assemblyName = new AssemblyName { Name = assm.GetName().Name, Version = new Version(0, 0, 0, 0) }; #else var assemblyName = AssemblyName.GetAssemblyName(assemblyFileName); #endif executor = Framework.GetExecutor(assemblyName); }
/// <summary> /// Initializes a new instance of the <see cref="Xunit2"/> class. /// </summary> /// <param name="useAppDomain">Determines whether tests should be run in a separate app domain.</param> /// <param name="sourceInformationProvider">The source code information provider.</param> /// <param name="assemblyFileName">The test assembly.</param> /// <param name="configFileName">The test assembly configuration file.</param> /// <param name="shadowCopy">If set to <c>true</c>, runs tests in a shadow copied app domain, which allows /// tests to be discovered and run without locking assembly files on disk.</param> /// <param name="shadowCopyFolder">The path on disk to use for shadow copying; if <c>null</c>, a folder /// will be automatically (randomly) generated</param> /// <param name="diagnosticMessageSink">The message sink which received <see cref="IDiagnosticMessage"/> messages.</param> /// <param name="verifyTestAssemblyExists">Determines whether or not the existence of the test assembly is verified.</param> public Xunit2(bool useAppDomain, ISourceInformationProvider sourceInformationProvider, string assemblyFileName, string configFileName = null, bool shadowCopy = true, string shadowCopyFolder = null, IMessageSink diagnosticMessageSink = null, bool verifyTestAssemblyExists = true) : base(useAppDomain, sourceInformationProvider, assemblyFileName, configFileName, shadowCopy, shadowCopyFolder, diagnosticMessageSink, verifyTestAssemblyExists) { #if ANDROID var assemblyName = Assembly.Load(assemblyFileName).GetName(); #elif WINDOWS_PHONE_APP || WINDOWS_PHONE || DOTNETCORE // Make sure we only use the short form for WPA81 var an = Assembly.Load(new AssemblyName { Name = Path.GetFileNameWithoutExtension(assemblyFileName) }).GetName(); var assemblyName = new AssemblyName { Name = an.Name, Version = an.Version }; #else var assemblyName = AssemblyName.GetAssemblyName(assemblyFileName); #endif executor = Framework.GetExecutor(assemblyName); }
/// <summary> /// Initializes a new instance of the <see cref="Xunit2"/> class. /// </summary> /// <param name="appDomainSupport">Determines whether tests should be run in a separate app domain.</param> /// <param name="sourceInformationProvider">The source code information provider.</param> /// <param name="assemblyFileName">The test assembly.</param> /// <param name="configFileName">The test assembly configuration file.</param> /// <param name="shadowCopy">If set to <c>true</c>, runs tests in a shadow copied app domain, which allows /// tests to be discovered and run without locking assembly files on disk.</param> /// <param name="shadowCopyFolder">The path on disk to use for shadow copying; if <c>null</c>, a folder /// will be automatically (randomly) generated</param> /// <param name="diagnosticMessageSink">The message sink which received <see cref="IDiagnosticMessage"/> messages.</param> /// <param name="verifyTestAssemblyExists">Determines whether or not the existence of the test assembly is verified.</param> public Xunit2(AppDomainSupport appDomainSupport, ISourceInformationProvider sourceInformationProvider, string assemblyFileName, string configFileName = null, bool shadowCopy = true, string shadowCopyFolder = null, IMessageSink diagnosticMessageSink = null, bool verifyTestAssemblyExists = true) : base(appDomainSupport, sourceInformationProvider, assemblyFileName, configFileName, shadowCopy, shadowCopyFolder, diagnosticMessageSink, verifyTestAssemblyExists) { #if PLATFORM_DOTNET var an = Assembly.Load(new AssemblyName { Name = Path.GetFileNameWithoutExtension(assemblyFileName) }).GetName(); var assemblyName = new AssemblyName { Name = an.Name, Version = an.Version }; #else var assemblyName = AssemblyName.GetAssemblyName(assemblyFileName); #endif executor = Framework.GetExecutor(assemblyName); }
/// <summary> /// Initializes a new instance of the <see cref="Xunit2"/> class. /// </summary> /// <param name="sourceInformationProvider">The source code information provider.</param> /// <param name="assemblyFileName">The test assembly.</param> /// <param name="configFileName">The test assembly configuration file.</param> /// <param name="shadowCopy">If set to <c>true</c>, runs tests in a shadow copied app domain, which allows /// tests to be discovered and run without locking assembly files on disk.</param> /// <param name="shadowCopyFolder">The path on disk to use for shadow copying; if <c>null</c>, a folder /// will be automatically (randomly) generated</param> /// <param name="diagnosticMessageSink">The message sink which received <see cref="IDiagnosticMessage"/> messages.</param> public Xunit2(ISourceInformationProvider sourceInformationProvider, string assemblyFileName, string configFileName = null, bool shadowCopy = true, string shadowCopyFolder = null, IMessageSink diagnosticMessageSink = null) : base(sourceInformationProvider, assemblyFileName, configFileName, shadowCopy, shadowCopyFolder, diagnosticMessageSink) { #if ANDROID var assm = Assembly.Load(assemblyFileName); var assemblyName = assm.GetName(); #elif WINDOWS_PHONE_APP || WINDOWS_PHONE || DNX451 || DNXCORE50 var assm = Assembly.Load(new AssemblyName { Name = Path.GetFileNameWithoutExtension(assemblyFileName) }); var assemblyName = new AssemblyName { Name = assm.GetName().Name, Version = new Version(0, 0, 0, 0) }; #else var assemblyName = AssemblyName.GetAssemblyName(assemblyFileName); #endif executor = Framework.GetExecutor(assemblyName); }
public Executor(ITestFrameworkExecutor executor, RunContext runContext, TestEnvironment environment) { this.executor = executor; this.runContext = runContext; this.environment = environment; }
/// <summary> /// Initializes a new instance of the <see cref="Xunit2"/> class. /// </summary> /// <param name="sourceInformationProvider">The source code information provider.</param> /// <param name="assemblyFileName">The test assembly.</param> /// <param name="configFileName">The test assembly configuration file.</param> /// <param name="shadowCopy">If set to <c>true</c>, runs tests in a shadow copied app domain, which allows /// tests to be discovered and run without locking assembly files on disk.</param> public Xunit2(ISourceInformationProvider sourceInformationProvider, string assemblyFileName, string configFileName = null, bool shadowCopy = true) : base(sourceInformationProvider, assemblyFileName, configFileName, shadowCopy) { executor = Framework.GetExecutor(assemblyFileName); }
/// <summary> /// Initializes a new instance of the <see cref="Xunit2"/> class. /// </summary> /// <param name="assemblyFileName">The test assembly.</param> /// <param name="configFileName">The test assembly configuration file.</param> /// <param name="shadowCopy">If set to <c>true</c>, runs tests in a shadow copied app domain, which allows /// tests to be discovered and run without locking assembly files on disk.</param> public Xunit2(string assemblyFileName, string configFileName = null, bool shadowCopy = true) : base(assemblyFileName, configFileName, shadowCopy) { executor = Framework.GetExecutor(assemblyFileName); }
/// <summary/> public DefaultTestCaseBulkDeserializer(ITestFrameworkExecutor executor) { Guard.ArgumentNotNull(executor); this.executor = executor; }
public Executor(ITestFrameworkExecutor executor, RunContext runContext, TestEnvironment environment) { this.executor = executor; this.runContext = runContext; this.environment = environment; }
public SideriteTestExecutor(ITestFrameworkExecutor executor) { this._executor = executor; }
/// <summary/> public DefaultTestCaseBulkDeserializer(ITestFrameworkExecutor executor) { this.executor = executor; }