Пример #1
0
        internal ReportingContextRegistrationManager(ILogger bootstrappingLogger, IServiceCollection services, ITestRunReporterContext testRunReporterContext)
        {
            _bootstrappingLogger    = bootstrappingLogger ?? throw new ArgumentNullException(nameof(bootstrappingLogger));
            _services               = services ?? throw new ArgumentNullException(nameof(services));
            _testRunReporterContext = testRunReporterContext ?? throw new ArgumentNullException(nameof(testRunReporterContext));

            RefreshRegistrationState();
        }
Пример #2
0
            internal ManagerUnderTestBuilder()
            {
                _services = new ServiceCollection();

                WithNoRegisteredServices();

                _logger = NSubstitute.Substitute.For <ILogger>();
                _testRunExecutionContext = NSubstitute.Substitute.For <ITestRunReporterContext>();
            }
Пример #3
0
        private static void RegisterExtentReporting(string prefix, IServiceCollection serviceCollection, ITestRunReporterContext testRunReporterContext)
        {
            if (!testRunReporterContext.InstrumentationSettings.ReportingSettings.Enabled)
            {
                return;
            }

            var testRunReporter = new TestRunReporter(testRunReporterContext.RootReportingFolder, testRunReporterContext.TestRunIdentity);

            serviceCollection.AddSingleton <ITestRunReporter>(isp =>
            {
                return(testRunReporter);
            });

            serviceCollection.AddScoped <ITestCaseReporterContext>(isp =>
            {
                return(new TestCaseReporterContext(rootOutputFolder: testRunReporter.ReportOutputFolder, testCaseIdentity: $"{DateTime.Now.ToString("yyyyMMddHHmmssfff")}"));
            });

            serviceCollection.AddScoped(isp =>
            {
                var testRunReporter         = isp.GetRequiredService <ITestRunReporter>();
                var testCaseReporterContext = isp.GetRequiredService <ITestCaseReporterContext>();
                var logger = isp.GetRequiredService <ILogger>();

                var result = testRunReporter.CreateTestCaseReporter(logger, testCaseReporterContext);
                result.AlwaysCaptureScreenshots = testRunReporterContext.InstrumentationSettings.ReportingSettings.AlwaysCaptureScreenshots;
                return(result);
            });
        }
Пример #4
0
 private static void UseDefaultReportingContexts(string prefix, IServiceCollection serviceCollection, ITestRunReporterContext testRunReporterContext)
 {
     // By doing nothing, the container will be populated with the default services.
 }