Skip to content

ProjectTestBase class

Jakub Raczek edited this page May 7, 2016 · 9 revisions

ProjectTestBase class should be added as a content to you project during installation of nuget package. Implementation of ProjectTestBase classes defer depending on unit test framework you selected to use with our test framework

Each of ProjectTestBase class contains methods for the internet browser to configure it with proper settings and start it before tests

            this.DriverContext.CurrentDirectory = TestContext.CurrentContext.TestDirectory;
            this.DriverContext.TestTitle = TestContext.CurrentContext.Test.Name;
            this.LogTest.LogTestStarting(this.driverContext);
            this.DriverContext.Start();

after test the browser is stopped and additional action are taken in case if test failure, like taking the screen shots

this.DriverContext.IsTestFailed = TestContext.CurrentContext.Result.Outcome.Status == TestStatus.Failed || !this.driverContext.VerifyMessages.Count.Equals(0);
            this.SaveTestDetailsIfTestFailed(this.driverContext);
            this.DriverContext.Stop();
            this.LogTest.LogTestEnding(this.driverContext);
            if (this.IsVerifyFailedAndClearMessages(this.driverContext) && TestContext.CurrentContext.Result.Outcome.Status != TestStatus.Failed)
            {
                Assert.Fail();
            }
Clone this wiki locally