Comments (3)
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.
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.
due to possible impact on parallel run I'm closing the issue.
from ocaramba.
Related Issues (20)
- Noob Questions/Issues Possibly... HOT 4
- Support for .NET Standard / .NET Core / SpecFlow 3.x? HOT 5
- Ocaramba.Features starts 5 instances of Chrome per test HOT 9
- Add an Example for DriverContext.CrossBrowserEnvironment Property HOT 1
- Parallel Execution SpecFlow using Zalenium HOT 2
- How can I run tests in parallel using MS Test and Selenium grid please help with an example HOT 1
- How can I run tests using Headless browser using this framework HOT 1
- Cannot run Chrome in Browserstack HOT 2
- Appium driver HOT 1
- Not all files created when installing NuGet package HOT 1
- AngularPageNavigationTest - may be failing on chrome 77+ HOT 1
- Tests in Test Explorer are grayed out and not running after updating test project to .Net Core 2.2 HOT 2
- How can we Re-run Failed specflow test cases from tear down?? HOT 3
- Edge Chromium does not support
- .NET core and Firefox tests are extremely slow
- Spelling: EdgeChrominium should be replaced with EdgeChromium?
- I am looking for a means to change the folders at run time HOT 1
- Incorrect test duration recorded
- reference to teamcity found in logs HOT 2
- .NET Core 3.1 End of Support
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ocaramba.