Skip to content

Latest commit

 

History

History
111 lines (79 loc) · 3.5 KB

README.md

File metadata and controls

111 lines (79 loc) · 3.5 KB

.NET Example with Healenium

Docker Pulls License

.NET + NUnit + MSBuild project with healenium usage example

1. Start Healenium components

2. Configuration RemoteWebDriver for Healenium

3. Run tests

4. Monitoring tests running

How to start

1. Start Healenium components

Go into healenium folder

cd healenium

Run Healenium with Selenoid:

Note: browsers.json consists of target browsers and appropriate versions. Before run healenium you have to manually pull selenoid browser docker images with version specified in browsers.json

Example pull selenoid chrome image:

docker pull selenoid/vnc:chrome_102.0

Full list of browser images you can find here

Run healenium with Selenoid:

docker-compose up -d

Run Healenium with Selenium-Grid:

docker-compose -f docker-compose-selenium-grid.yaml up -d

ATTENTION

Verify the next images are Up and Running

  • postgres-db (PostgreSQL database to store etalon selector / healing / report)
  • hlm-proxy (Proxy client request to Selenium server)
  • hlm-backend (CRUD service)
  • selector imitator (Convert healed locator to convenient format)
  • selenoid/selenium-grid (Selenium server)

2. Configuration RemoteWebDriver for Healenium

To run using Healenium create RemoteWebDriver with URL http://<remote webdriver host>:8085:

    var optionsChrome = new ChromeOptions();
    optionsChrome.AddArguments("--no-sandbox");
    _driver = new RemoteWebDriver(new Uri("http://localhost:8085"), optionsChrome);

To temporarily disable the healing mechanism for certain sections of your code, use the following syntax:

    IJavaScriptExecutor jsExecutor = (IJavaScriptExecutor) Driver;
    jsExecutor.ExecuteScript("disable_healing_true");
   ... // Your code that does not require healing
   jsExecutor.ExecuteScript("disable_healing_false");

3. Run tests

You can run tests via Test Explorer To run tests for specified test project in terminal with nunit3-console you need to go to /bin/Debug/ project folder

If you want to execute tests from Healenium.Selenium.Tests project, please use the command:

nunit3-console Healenium.Selenium.Tests.dll --where "class=~MarkupTests"

In case you want to run all tests in project use this command:

nunit3-console Healenium.Selenium.Tests.dll

If you want to get a Report Portal report you could use this command:

nunit3-console Healenium.SeleniumRP.Tests.dll --where "class=~MarkupTests"

Do not forget to specify your rp.uuid and rp.project values in ReportPortal.config.json file

How to configure Report Portal with NUnit you can read here: https://github.com/reportportal/agent-net-nunit

4. Monitoring tests running

You can monitor tests running if you using Healenium with Selenoid plus Selenoid Ui, go to :

http://localhost:8080

Community / Support