Git Product home page Git Product logo

Comments (3)

raczeja avatar raczeja commented on July 28, 2024

Hi,
Our framework supports parallel execution, so there can be couple of instance of DriverContext created, also each of test can modify DriverContext e.g.

        /// <summary>
        /// Before the test.
        /// </summary>
        [SetUp]
        public void BeforeTest()
        {
            this.DriverContext.TestTitle = TestContext.CurrentContext.Test.Name;
            this.LogTest.LogTestStarting(this.driverContext);
        }

So we should't use DriverContext in singleton...
Eduard you can show as example of your solution at fork, at least we can look at it

Jakub

from ocaramba.

edo248 avatar edo248 commented on July 28, 2024

Hi,

Well anyway DriverContext is created once per ProjectTestBase. What did at this point is modified ProjectTestBase BeforeClass() the following way:

`public class ProjectTestBase : TestBase
{
private readonly DriverContext driverContext = new DriverContext();

 /***omitted***/

    [OneTimeSetUp]
    public void BeforeClass()
    {
        this.DriverContext.CurrentDirectory = TestContext.CurrentContext.TestDirectory;
        StartPerformanceMeasure();
        this.DriverContext.Start();

        Browser.Current.Driver = this.DriverContext.Driver;
        Browser.Current.DriverContext = this.DriverContext;

    }


 /***omitted***/

}
`

Where browser is a singleton container for Driver and DriverContext.

`
public class Browser
{
public IWebDriver Driver { get; set; }
public DriverContext DriverContext { get; set; }
// private static DriverContext DriverContext { get; set; }
private static Browser instance = new Browser();

    static Browser() { }

    public static Browser Current
    {
        get
        {
            return instance;
        }
    }

}

`

The reason I am doing this is to simplify tests and page objects to hide the DriverContext variable. However, I am interested whether this can cause some issue like parallel run, or similar.

BTW. You did great job with this framework. Really useful.

Eduard

from ocaramba.

raczeja avatar raczeja commented on July 28, 2024

due to possible impact on parallel run I'm closing the issue.

from ocaramba.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.