Exemple #1
0
 public ITestInstanceContext CreateTestContext(TestInstance testInstance)
 {
     if (testInstance == null)
     {
         throw new ArgumentNullException(nameof(testInstance));
     }
     if (outputHelper == null)
     {
         throw new InvalidOperationException("TestContext is not set.");
     }
     return(new TestInstanceContextWrapper(outputHelper, testInstance));
 }
        private async Task RunSingleTest(ISeleniumTest testClass, TestConfiguration testConfiguration, string testName, Action <IBrowserWrapper> action)
        {
            var testFullName = $"{testName} for {testConfiguration.BaseUrl} in {testConfiguration.Factory.Name}";

            this.LogVerbose($"(#{Thread.CurrentThread.ManagedThreadId}) {testFullName}: Starting test run");
            try
            {
                var instance = new TestInstance(this, testClass, testConfiguration, testFullName, action);
                await instance.RunAsync();
            }
            finally
            {
                this.LogVerbose($"(#{Thread.CurrentThread.ManagedThreadId}) {testFullName}: Finishing test run");
            }
        }
Exemple #3
0
        private async Task RunSingleTest(ISeleniumTest testClass, TestConfiguration testConfiguration, string testName, Action <IBrowserWrapper> action, IReadOnlyCollection <SkipBrowserAttribute> skipBrowserAttributes)
        {
            var skipBrowserAttribute = skipBrowserAttributes.FirstOrDefault(a => a.BrowserName == testConfiguration.Factory.Name);

            if (skipBrowserAttribute != null)
            {
                this.LogInfo($"(#{Thread.CurrentThread.ManagedThreadId}) {testName}: Test was skipped for " +
                             $"browser: {skipBrowserAttribute.BrowserName}, Reason: {skipBrowserAttribute.Reason}");
                return;
            }

            var testFullName = $"{testName} for {testConfiguration.BaseUrl} in {testConfiguration.Factory.Name}";

            this.LogVerbose($"(#{Thread.CurrentThread.ManagedThreadId}) {testFullName}: Starting test run");
            try
            {
                var instance = new TestInstance(this, testClass, testConfiguration, testFullName, action);
                await instance.RunAsync();
            }
            finally
            {
                this.LogVerbose($"(#{Thread.CurrentThread.ManagedThreadId}) {testFullName}: Finishing test run");
            }
        }
 public TestInstanceContextWrapper(ITestOutputHelper context, TestInstance testInstance) : base(context)
 {
     this.testInstance = testInstance;
 }
 public TestInstanceContextWrapper(TestContext context, TestInstance testInstance)
     : base(context)
 {
     this.testInstance = testInstance;
 }