Accelerate Test Execution
To speed up the CI process, we developed a group of features that support every phаse of the process, from test creation to execution. Let’s take a look at how BELLATRIX can speed up your test execution by enhanced finding and waiting of elements, and providing an improved browser life cycle control and the ability to run tests in headless mode.
Optimized Element Finding and Waiting
Better finding and waiting of elements out of the box and flexible setup.
One of the most significant problems in test automation is handling timeouts and performing actions on elements which may not be on the page right now.
If you use global timeouts such as WebDriver implicit wait.
IWebDriver driver = new ChromeDriver(); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30);
In some cases, you may need a larger wait interval. What do you do if this happens? One option is to increase the global timeout, but this will affect all existing tests, slowing down the whole test run significantly.
Another option is to use the global timeout and occasionally add hard-coded pauses in your tests where needed.
However, this is the worst thing you can do. One time you may need to wait 1 second, and another time 5 seconds. If you always use the biggest possible pause, your tests will get slower and slower.
BELLATRIX hides the whole complexity of searching and waiting for elements. All elements are returned immediately when they are present on the page in the right state.
Optimized Browser Life Cycle Control
Reuse the browser and configure it when to restart.
Two of the operations that take the most time in web tests are related to starting and closing the web browsers. Each of these operations can take from a fraction of a second to several seconds. If you open and close the browser for each test and you have thousands of tests, this can make your test runs more than twice as long!
To battle this problem, BELLATRIX offers an automatic way of handling the browser life cycle across multiple tests. You need to set this behavior in the Browser attribute applied to each test class.
[Browser(BrowserType.Firefox, BrowserBehavior.ReuseIfStarted)] public class BellatrixBrowserBehaviourTests : WebTest
The browser lifecycle is configured through the browser behavior property. Available options:
For each test a separate WebDriver instance is created and the previous browser is closed.
The browser is only restarted if the previous test failed.
The browser is only restarted if the previous test’s browser was different. In all other cases, the browser is reused if possible.
If you use one of the “restart on fail” or “reuse if started” options, it can significantly decrease the test execution time, eliminating the additional time for browser initialization and disposal.
Run Tests in Headless Mode
Your tests execute even faster if you use the so-called headless mode.
BELLATRIX supports all 5 major browsers- Chrome, Firefox, Edge, Opera and Internet Explorer. In this mode, tests run in the browser but the browser’s UI is not rendered. In theory, it should be faster.
BELLATRIX can run tests in headless mode using Chrome and Firefox engines.
You just need to set the ChromeHeadless or FirefoxHeadless for browser type in the Browser attribute.
All tests in the class will be executed in Firefox browser in headless mode.
Software Machine Automation
Learn how to create a software management automation library, allowing you to install/upgrade desired software such as browsers, extensions through code.
Traditional tools are not built for modern automation and a DevOps approach, which can make achieving consistency and gaining insights across your environment difficult. There are a lot of different installer formats and multiple approaches to deploying software. Deploying software without package management can be complicated and time-consuming. Software management automation simplifies this through a simple, repeatable, and automated approach, by using a universal packaging format for managing all software. It doesn’t matter if you are using native installers, zips, scripts, binaries, or in-house developed applications and tools.
Execute Tests in Docker Containers using Selenoid
Selenoid is a robust implementation of the Selenium hub using Docker containers to launch browsers. No need to manually install browsers or dive into WebDriver documentation. Any browser session can be saved to the H.264 video. An API to list, download, and delete saved log files. Suitable for personal usage and in big clusters.