Example #1
0
 public static TestableXunitTestFrameworkDiscoverer Create(IAssemblyInfo assembly = null,
                                                           ISourceInformationProvider sourceProvider     = null,
                                                           IMessageSink diagnosticMessageSink            = null,
                                                           IXunitTestCollectionFactory collectionFactory = null)
 {
     return(new TestableXunitTestFrameworkDiscoverer(assembly ?? Mocks.AssemblyInfo(), sourceProvider, diagnosticMessageSink, collectionFactory));
 }
 public KuduXunitTestFrameworkDiscoverer(IAssemblyInfo assemblyInfo,
                                         ISourceInformationProvider sourceProvider,
                                         IMessageSink diagnosticMessageSink,
                                         IXunitTestCollectionFactory collectionFactory = null)
     : base(assemblyInfo, sourceProvider, diagnosticMessageSink, collectionFactory)
 {
 }
 public CustomDiscoverer(IAssemblyInfo assemblyInfo,
                         ISourceInformationProvider sourceProvider,
                         IMessageSink diagnosticMessageSink,
                         IXunitTestCollectionFactory collectionFactory = null) : base(assemblyInfo, sourceProvider, diagnosticMessageSink, collectionFactory)
 {
     tests = new HashSet <string>();
 }
 public KuduXunitTestFrameworkDiscoverer(IAssemblyInfo assemblyInfo,
                                         ISourceInformationProvider sourceProvider,
                                         IMessageSink diagnosticMessageSink,
                                         IXunitTestCollectionFactory collectionFactory = null)
     : base(assemblyInfo, sourceProvider, diagnosticMessageSink, collectionFactory)
 {
 }
 public KuduXunitTestFrameworkDiscoverer(IAssemblyInfo assemblyInfo,
                                         ISourceInformationProvider sourceProvider,
                                         IMessageSink diagnosticMessageSink,
                                         IXunitTestCollectionFactory collectionFactory = null)
     : base(assemblyInfo, sourceProvider, diagnosticMessageSink, collectionFactory)
 {
     _privateEnv = typeof(KuduXunitTestFrameworkDiscoverer).Assembly.GetType("Kudu.TestHarness.Antares.AntaresEnvironment") != null;
 }
 public KuduXunitTestFrameworkDiscoverer(IAssemblyInfo assemblyInfo,
                                         ISourceInformationProvider sourceProvider,
                                         IMessageSink diagnosticMessageSink,
                                         IXunitTestCollectionFactory collectionFactory = null)
     : base(assemblyInfo, sourceProvider, diagnosticMessageSink, collectionFactory)
 {
     _privateEnv = typeof(KuduXunitTestFrameworkDiscoverer).Assembly.GetType("Kudu.TestHarness.Antares.AntaresEnvironment") != null;
 }
 public ScenarioReportingXunitTestFrameworkDiscoverer(IAssemblyInfo assemblyInfo,
                                                      ISourceInformationProvider sourceProvider,
                                                      IMessageSink diagnosticMessageSink,
                                                      IXunitTestCollectionFactory collectionFactory = null)
     : base(assemblyInfo, sourceProvider, diagnosticMessageSink)
 {
     DiscovererTypeCache[typeof(FactAttribute)]   = typeof(ScenarioFactAttributeDiscoverer);
     DiscovererTypeCache[typeof(TheoryAttribute)] = typeof(ScenarioTheoryAttributeDiscoverer);
 }
Example #8
0
        public ElasticTestFrameworkDiscoverer(IAssemblyInfo assemblyInfo, ISourceInformationProvider sourceProvider,
                                              IMessageSink diagnosticMessageSink, IXunitTestCollectionFactory collectionFactory = null) : base(
                assemblyInfo, sourceProvider, diagnosticMessageSink, collectionFactory)
        {
            var a       = Assembly.Load(new AssemblyName(assemblyInfo.Name));
            var options = a.GetCustomAttribute <ElasticXunitConfigurationAttribute>()?.Options ??
                          new ElasticXunitRunOptions();

            Options = options;
        }
Example #9
0
 protected TestableXunitTestFrameworkDiscoverer(
     IAssemblyInfo assembly,
     ISourceInformationProvider sourceProvider,
     IMessageSink diagnosticMessageSink,
     IXunitTestCollectionFactory collectionFactory)
     : base(assembly, sourceProvider ?? Substitute.For <ISourceInformationProvider>(), diagnosticMessageSink ?? new Xunit.NullMessageSink(), collectionFactory)
 {
     Assembly = assembly;
     Sink     = new TestDiscoverySink();
 }
 public SpecThisTestFrameworkDiscoverer(IAssemblyInfo assemblyInfo, ISourceInformationProvider sourceProvider, IMessageSink diagnosticMessageSink, IXunitTestCollectionFactory collectionFactory = null)
     : base(assemblyInfo, sourceProvider, diagnosticMessageSink)
 {
     IAttributeInfo collectionBehaviorAttribute = assemblyInfo.GetCustomAttributes(typeof(CollectionBehaviorAttribute)).SingleOrDefault<IAttributeInfo>();
     bool flag = collectionBehaviorAttribute != null && collectionBehaviorAttribute.GetNamedArgument<bool>("DisableTestParallelization");
     string configurationFile = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
     TestAssembly testAssembly = new TestAssembly(assemblyInfo, configurationFile);
     this.TestCollectionFactory = collectionFactory ?? ExtensibilityPointFactory.GetXunitTestCollectionFactory(diagnosticMessageSink, collectionBehaviorAttribute, (ITestAssembly)testAssembly);
     this.TestFrameworkDisplayName = string.Format("{0} [{1}, {2}]", XunitTestFrameworkDiscoverer.DisplayName, this.TestCollectionFactory.DisplayName, flag ? "non-parallel" : "parallel");
 }
Example #11
0
 protected TestableXunitTestFrameworkDiscoverer(IAssemblyInfo assembly,
                                                ISourceInformationProvider sourceProvider,
                                                IXunitTestCollectionFactory collectionFactory,
                                                IMessageAggregator messageAggregator)
     : base(assembly,
            sourceProvider ?? Substitute.For <ISourceInformationProvider>(),
            collectionFactory,
            messageAggregator)
 {
     Assembly = assembly;
     Visitor  = new TestDiscoveryVisitor();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="XunitTestFrameworkDiscoverer"/> class.
        /// </summary>
        /// <param name="assemblyInfo">The test assembly.</param>
        /// <param name="sourceProvider">The source information provider.</param>
        /// <param name="collectionFactory">The test collection factory used to look up test collections.</param>
        /// <param name="messageAggregator">The message aggregator to receive environmental warnings from.</param>
        public XunitTestFrameworkDiscoverer(IAssemblyInfo assemblyInfo,
                                            ISourceInformationProvider sourceProvider,
                                            IXunitTestCollectionFactory collectionFactory,
                                            IMessageAggregator messageAggregator)
            : base(assemblyInfo, sourceProvider, messageAggregator)
        {
            var collectionBehaviorAttribute = assemblyInfo.GetCustomAttributes(typeof(CollectionBehaviorAttribute)).SingleOrDefault();
            var disableParallelization = collectionBehaviorAttribute == null ? false : collectionBehaviorAttribute.GetNamedArgument<bool>("DisableTestParallelization");

            TestCollectionFactory = collectionFactory ?? GetTestCollectionFactory(this.AssemblyInfo, collectionBehaviorAttribute);
            TestFrameworkDisplayName = String.Format("{0} [{1}, {2}]",
                                                     DisplayName,
                                                     TestCollectionFactory.DisplayName,
                                                     disableParallelization ? "non-parallel" : "parallel");
        }
Example #13
0
 public LoggedTestFrameworkDiscoverer(
     IAssemblyInfo assemblyInfo,
     ISourceInformationProvider sourceProvider,
     IMessageSink diagnosticMessageSink,
     IXunitTestCollectionFactory collectionFactory = null)
     : base(assemblyInfo, sourceProvider, diagnosticMessageSink, collectionFactory)
 {
     Discoverers = new Dictionary <Type, IXunitTestCaseDiscoverer>()
     {
         { typeof(ConditionalTheoryAttribute), new LoggedConditionalTheoryDiscoverer(diagnosticMessageSink) },
         { typeof(ConditionalFactAttribute), new LoggedConditionalFactDiscoverer(diagnosticMessageSink) },
         { typeof(TheoryAttribute), new LoggedTheoryDiscoverer(diagnosticMessageSink) },
         { typeof(FactAttribute), new LoggedFactDiscoverer(diagnosticMessageSink) }
     };
 }
Example #14
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XunitTestFrameworkDiscoverer"/> class.
        /// </summary>
        /// <param name="assemblyInfo">The test assembly.</param>
        /// <param name="configFileName">The test configuration file.</param>
        /// <param name="sourceProvider">The source information provider.</param>
        /// <param name="diagnosticMessageSink">The message sink used to send diagnostic messages</param>
        /// <param name="collectionFactory">The test collection factory used to look up test collections.</param>
        public XunitTestFrameworkDiscoverer(IAssemblyInfo assemblyInfo,
                                            string configFileName,
                                            ISourceInformationProvider sourceProvider,
                                            IMessageSink diagnosticMessageSink,
                                            IXunitTestCollectionFactory collectionFactory = null)
            : base(assemblyInfo, sourceProvider, diagnosticMessageSink)
        {
            var collectionBehaviorAttribute = assemblyInfo.GetCustomAttributes(typeof(CollectionBehaviorAttribute)).SingleOrDefault();
            var disableParallelization      = collectionBehaviorAttribute != null && collectionBehaviorAttribute.GetNamedArgument <bool>("DisableTestParallelization");

            var testAssembly = new TestAssembly(assemblyInfo, configFileName);

            TestCollectionFactory    = collectionFactory ?? ExtensibilityPointFactory.GetXunitTestCollectionFactory(diagnosticMessageSink, collectionBehaviorAttribute, testAssembly);
            TestFrameworkDisplayName = $"{DisplayName} [{TestCollectionFactory.DisplayName}, {(disableParallelization ? "non-parallel" : "parallel")}]";
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="XunitTestFrameworkDiscoverer"/> class.
        /// </summary>
        /// <param name="assemblyInfo">The test assembly.</param>
        /// <param name="sourceProvider">The source information provider.</param>
        /// <param name="collectionFactory">The test collection factory used to look up test collections.</param>
        /// <param name="messageAggregator">The message aggregator to receive environmental warnings from.</param>
        public XunitTestFrameworkDiscoverer(IAssemblyInfo assemblyInfo,
                                            ISourceInformationProvider sourceProvider,
                                            IXunitTestCollectionFactory collectionFactory,
                                            IMessageAggregator messageAggregator)
        {
            Guard.ArgumentNotNull("assemblyInfo", assemblyInfo);
            Guard.ArgumentNotNull("sourceProvider", sourceProvider);

            this.assemblyInfo = assemblyInfo;
            this.sourceProvider = sourceProvider;
            this.messageAggregator = messageAggregator ?? MessageAggregator.Instance;

            TestCollectionFactory = collectionFactory ?? GetTestCollectionFactory(this.assemblyInfo);
            TestFrameworkDisplayName = String.Format("{0} [{1}, non-parallel]", DisplayName, TestCollectionFactory.DisplayName);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="XunitTestFrameworkDiscoverer"/> class.
        /// </summary>
        /// <param name="assemblyInfo">The test assembly.</param>
        /// <param name="sourceProvider">The source information provider.</param>
        /// <param name="collectionFactory">The test collection factory used to look up test collections.</param>
        /// <param name="messageAggregator">The message aggregator to receive environmental warnings from.</param>
        public XunitTestFrameworkDiscoverer(IAssemblyInfo assemblyInfo,
                                            ISourceInformationProvider sourceProvider,
                                            IXunitTestCollectionFactory collectionFactory,
                                            IMessageAggregator messageAggregator)
            : base(assemblyInfo, sourceProvider, messageAggregator)
        {
            var collectionBehaviorAttribute = assemblyInfo.GetCustomAttributes(typeof(CollectionBehaviorAttribute)).SingleOrDefault();
            var disableParallelization      = collectionBehaviorAttribute == null ? false : collectionBehaviorAttribute.GetNamedArgument <bool>("DisableTestParallelization");

            TestCollectionFactory    = collectionFactory ?? GetTestCollectionFactory(this.AssemblyInfo, collectionBehaviorAttribute);
            TestFrameworkDisplayName = String.Format("{0} [{1}, {2}]",
                                                     DisplayName,
                                                     TestCollectionFactory.DisplayName,
                                                     disableParallelization ? "non-parallel" : "parallel");
        }
        readonly Dictionary<Type, Type> discovererTypeCache = new Dictionary<Type, Type>(); // key is a Type that is or derives from FactAttribute

        /// <summary>
        /// Initializes a new instance of the <see cref="XunitTestFrameworkDiscoverer"/> class.
        /// </summary>
        /// <param name="assemblyInfo">The test assembly.</param>
        /// <param name="sourceProvider">The source information provider.</param>
        /// <param name="diagnosticMessageSink">The message sink used to send diagnostic messages</param>
        /// <param name="collectionFactory">The test collection factory used to look up test collections.</param>
        public XunitTestFrameworkDiscoverer(IAssemblyInfo assemblyInfo,
                                            ISourceInformationProvider sourceProvider,
                                            IMessageSink diagnosticMessageSink,
                                            IXunitTestCollectionFactory collectionFactory = null)
            : base(assemblyInfo, sourceProvider, diagnosticMessageSink)
        {
            var collectionBehaviorAttribute = assemblyInfo.GetCustomAttributes(typeof(CollectionBehaviorAttribute)).SingleOrDefault();
            var disableParallelization = collectionBehaviorAttribute != null && collectionBehaviorAttribute.GetNamedArgument<bool>("DisableTestParallelization");

            string config = null;
#if !PLATFORM_DOTNET
            config = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
#endif
            var testAssembly = new TestAssembly(assemblyInfo, config);

            TestCollectionFactory = collectionFactory ?? ExtensibilityPointFactory.GetXunitTestCollectionFactory(diagnosticMessageSink, collectionBehaviorAttribute, testAssembly);
            TestFrameworkDisplayName = $"{DisplayName} [{TestCollectionFactory.DisplayName}, {(disableParallelization ? "non-parallel" : "parallel")}]";
        }
Example #18
0
    public Discoverer(IAssemblyInfo assemblyInfo,
                      ISourceInformationProvider sourceProvider,
                      IMessageSink diagnosticMessageSink,
                      ITestFrameworkDiscoveryOptions discoveryOptions,
                      IXunitTestCollectionFactory collectionFactory = null)
        : base(assemblyInfo, sourceProvider, diagnosticMessageSink, collectionFactory)
    {
        TestCollectionFactory = collectionFactory;
        Sink             = diagnosticMessageSink;
        DiscoveryOptions = discoveryOptions;

        TestClasses = new List <ITestClass> ();
        foreach (var type in AssemblyInfo.GetTypes(false).Where(IsValidTestClass))
        {
            TestClasses.Add(CreateTestClass(type));
        }
        TestClassesEnumerator = TestClasses.GetEnumerator();
    }
Example #19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="XunitTestFrameworkDiscoverer"/> class.
        /// </summary>
        /// <param name="assemblyInfo">The test assembly.</param>
        /// <param name="sourceProvider">The source information provider.</param>
        /// <param name="diagnosticMessageSink">The message sink used to send diagnostic messages</param>
        /// <param name="collectionFactory">The test collection factory used to look up test collections.</param>
        public XunitTestFrameworkDiscoverer(IAssemblyInfo assemblyInfo,
                                            ISourceInformationProvider sourceProvider,
                                            IMessageSink diagnosticMessageSink,
                                            IXunitTestCollectionFactory collectionFactory = null)
            : base(assemblyInfo, sourceProvider, diagnosticMessageSink)
        {
            var collectionBehaviorAttribute = assemblyInfo.GetCustomAttributes(typeof(CollectionBehaviorAttribute)).SingleOrDefault();
            var disableParallelization      = collectionBehaviorAttribute != null && collectionBehaviorAttribute.GetNamedArgument <bool>("DisableTestParallelization");

            string config = null;

#if !WINDOWS_PHONE_APP && !WINDOWS_PHONE && !DOTNETCORE
            config = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
#endif
            var testAssembly = new TestAssembly(assemblyInfo, config);

            TestCollectionFactory    = collectionFactory ?? ExtensibilityPointFactory.GetXunitTestCollectionFactory(diagnosticMessageSink, collectionBehaviorAttribute, testAssembly);
            TestFrameworkDisplayName = $"{DisplayName} [{TestCollectionFactory.DisplayName}, {(disableParallelization ? "non-parallel" : "parallel")}]";
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="XunitTestFrameworkDiscoverer"/> class.
        /// </summary>
        /// <param name="assemblyInfo">The test assembly.</param>
        /// <param name="sourceProvider">The source information provider.</param>
        /// <param name="diagnosticMessageSink">The message sink used to send diagnostic messages</param>
        /// <param name="collectionFactory">The test collection factory used to look up test collections.</param>
        public XunitTestFrameworkDiscoverer(IAssemblyInfo assemblyInfo,
                                            ISourceInformationProvider sourceProvider,
                                            IMessageSink diagnosticMessageSink,
                                            IXunitTestCollectionFactory collectionFactory = null)
            : base(assemblyInfo, sourceProvider, diagnosticMessageSink)
        {
            var collectionBehaviorAttribute = assemblyInfo.GetCustomAttributes(typeof(CollectionBehaviorAttribute)).SingleOrDefault();
            var disableParallelization = collectionBehaviorAttribute == null ? false : collectionBehaviorAttribute.GetNamedArgument<bool>("DisableTestParallelization");

            string config = null;
#if !WINDOWS_PHONE_APP && !WINDOWS_PHONE && !DNXCORE50
            config = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
#endif
            var testAssembly = new TestAssembly(assemblyInfo, config);

            TestCollectionFactory = collectionFactory ?? ExtensibilityPointFactory.GetXunitTestCollectionFactory(diagnosticMessageSink, collectionBehaviorAttribute, testAssembly);
            TestFrameworkDisplayName = string.Format("{0} [{1}, {2}]",
                                                     DisplayName,
                                                     TestCollectionFactory.DisplayName,
                                                     disableParallelization ? "non-parallel" : "parallel");
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="XunitTestFrameworkDiscoverer"/> class.
        /// </summary>
        /// <param name="assemblyInfo">The test assembly.</param>
        /// <param name="sourceProvider">The source information provider.</param>
        /// <param name="collectionFactory">The test collection factory used to look up test collections.</param>
        /// <param name="messageAggregator">The message aggregator to receive environmental warnings from.</param>
        public XunitTestFrameworkDiscoverer(IAssemblyInfo assemblyInfo,
                                            ISourceInformationProvider sourceProvider,
                                            IXunitTestCollectionFactory collectionFactory,
                                            IMessageAggregator messageAggregator)
            : base(assemblyInfo, sourceProvider, messageAggregator)
        {
            var collectionBehaviorAttribute = assemblyInfo.GetCustomAttributes(typeof(CollectionBehaviorAttribute)).SingleOrDefault();
            var disableParallelization      = collectionBehaviorAttribute == null ? false : collectionBehaviorAttribute.GetNamedArgument <bool>("DisableTestParallelization");

            string config = null;

#if !WINDOWS_PHONE_APP && !WINDOWS_PHONE && !ASPNETCORE50
            config = AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
#endif
            var testAssembly = new TestAssembly(assemblyInfo, config);

            TestCollectionFactory    = collectionFactory ?? ExtensibilityPointFactory.GetXunitTestCollectionFactory(collectionBehaviorAttribute, testAssembly);
            TestFrameworkDisplayName = String.Format("{0} [{1}, {2}]",
                                                     DisplayName,
                                                     TestCollectionFactory.DisplayName,
                                                     disableParallelization ? "non-parallel" : "parallel");
        }
Example #22
0
 public SpecFlowTestDiscoverer(IAssemblyInfo assemblyInfo, ISourceInformationProvider sourceProvider, IMessageSink diagnosticMessageSink, IXunitTestCollectionFactory collectionFactory = null) :
     base(CreateSpecFlowProjectAssemblyInfo(assemblyInfo), sourceProvider, diagnosticMessageSink, collectionFactory)
 {
 }
 public static TestableXunitTestFrameworkDiscoverer Create(IAssemblyInfo assembly = null,
                                                           ISourceInformationProvider sourceProvider = null,
                                                           IMessageSink diagnosticMessageSink = null,
                                                           IXunitTestCollectionFactory collectionFactory = null)
 {
     return new TestableXunitTestFrameworkDiscoverer(assembly ?? Mocks.AssemblyInfo(), sourceProvider, diagnosticMessageSink, collectionFactory);
 }
 protected TestableXunitTestFrameworkDiscoverer(IAssemblyInfo assembly,
                                                ISourceInformationProvider sourceProvider,
                                                IMessageSink diagnosticMessageSink,
                                                IXunitTestCollectionFactory collectionFactory)
     : base(assembly,
            sourceProvider ?? Substitute.For<ISourceInformationProvider>(),
            diagnosticMessageSink ?? new Xunit.NullMessageSink(),
            collectionFactory)
 {
     Assembly = assembly;
     Sink = new TestDiscoverySink();
 }
 protected TestableXunitTestFrameworkDiscoverer(IAssemblyInfo assembly,
                                                ISourceInformationProvider sourceProvider,
                                                IXunitTestCollectionFactory collectionFactory,
                                                IMessageAggregator messageAggregator)
     : base(assembly,
            sourceProvider ?? Substitute.For<ISourceInformationProvider>(),
            collectionFactory,
            messageAggregator)
 {
     Assembly = assembly;
     Visitor = new TestDiscoveryVisitor();
 }
 public TestFrameworkDiscoverer(IAssemblyInfo assemblyInfo, ISourceInformationProvider sourceProvider, IMessageSink diagnosticMessageSink, IList <AssemblyLoaderAttribute> assemblyLoaders, IXunitTestCollectionFactory collectionFactory = null)
     : base(assemblyInfo, sourceProvider, diagnosticMessageSink, collectionFactory)
 {
     foreach (var assemblyLoader in assemblyLoaders)
     {
         DisposalTracker.Add(assemblyLoader);
     }
 }
Example #27
0
 public TestFrameworkDiscoverer(IAssemblyInfo assemblyInfo, ISourceInformationProvider sourceProvider, IMessageSink diagnosticMessageSink, IList<AssemblyLoaderAttribute> assemblyLoaders, IXunitTestCollectionFactory collectionFactory = null)
     : base(assemblyInfo, sourceProvider, diagnosticMessageSink, collectionFactory) {
     foreach (var assemblyLoader in assemblyLoaders) {
         DisposalTracker.Add(assemblyLoader);
     }
 }