Getting Started
Installing StageZero
In order to use StageZero
you must first install the core package, as well as your desired framework integration.
dotnet add package StageZero
dotnet add package StageZero.Playwright
dotnet add package StageZero.Selenium
Registering a DriverBuilder
Once you’ve installed all the required packages, you must register your desired framework integration with our DriverBuilder
. Don’t worry, this only has to be done once!
For example, if you’re wanting to use our one of our integrations with NUnit
you can do:
using StageZero.Selenium;
namespace Your.Namespace;
[SetUpFixture]public class GlobalSetup{ [OneTimeSetUp] public class BeforeEverything() { DriverBuilder.Register<WebDriverBuilder>(); }}
using StageZero.Playwright;
namespace Your.Namespace;
[SetUpFixture]public class GlobalSetup{ [OneTimeSetUp] public class BeforeEverything() { DriverBuilder.Register<WebDriverBuilder>(); }}
That’s all the setup code you’ll ever have to write. Now onto writing our first test!
Writing a Test
StageZero
handles all of the underlying logic required to create, navigate, interact with elements, and terminate drivers. All you have to do is write your test, no more managing frameworks!
Following on from the example provided above, you can write a test for the web like:
public class Test{ private IDriverWeb _driver;
[SetUp] public void BeforeEach() { _driver = DriverBuilder.Create(new WebDriverOptions()); }
[Test] public Task NavigateToGoogle() { await _driver.Navigate().ToUrl("https://google.com"); }
[TearDown] public Task AfterEach() { await _driver.Terminate(); }}
Running a Test
Because StageZero
is built on the dotnet
framework, all you have to do is run dotnet test ./path/to/yourproj.csproj
.
Alternatively, if you’re using an IDE you should be able to run your created test in that IDE’s integrated test runner.
Done 🎉
Pat yourself on the back! You’ve just written your first test!