Selenium To Avo

The Selenium To Avo feature helps you to migrate existing Selenium automation scripts into Avo Assure test cases. It captures Selenium actions executed on the browser and converts them into corresponding Avo Assure actions. This enables teams to reuse their Selenium investments and transition smoothly to Avo’s codeless automation platform.

Prerequisites

The following requirements must be fulfilled before performing migrate Selenium scripts to Avo:

  • Selenium Environment: You have a configured Selenium development environment (such as Eclipse) to execute the scripts.

  • Interceptor Setup: You must set up the interceptors in your project.

  • Script Status: Your Selenium automation scripts are up to date.

  • Error-free Execution: Your Selenium scripts run successfully without errors.

  • Avo Assure Access: You have access to the Avo Assure server.

  • Supported Languages: Your Selenium project uses Java or JavaScript using cucumber BDD framework, as Avo Assure currently supports these programming languages.

Note:

  • During migration, Avo Assure considers only Selenium actions performed on the browser.

  • Avo Assure maps Selenium test data automatically. You should review the migrated data to ensure it is correct.

  • All Selenium select actions are normalized during migration:

    • selectByValue

    • selectByIndex

    • selectByVisibleText

    are migrated as selectByValue in Avo Assure.

Migrating Selenium Scripts

To migrate your scripts, you must first set up the interceptor in your project, generate the scenario file, and then import it into Avo Assure.

The interceptor allows you to execute code before and after your automation logic without modifying the core functionality of the scripts.

Downloading and Configuring the Intercept

To download and configure the Selenium scripts to Avo Assure, perform the following steps:

  1. On the Avo Assure Home page, go to Utilities and select Migrate To Avo tab.

  2. On the Selenium To Avo page, select the programming language used in your Selenium project (such as, Java or JavaScript) to apply the appropriate migration logic.

  3. Select Download to save the intercept file (such as java-intercept.zip) to your system.

  4. Extract the downloaded java-intercept.zip file.

  5. Copy the extracted intercept folder and place it in the required location within your Selenium project directory. For Example, <Path to your Selenium project>/src/main/java.

  6. Configure the Intercept: You can configure the intercept using the following steps:

Note: This configuration is a one-time setup.

Enabling WebDriver Interception
  1. In BrowserFactory.java, add the import statement and update the browser initialization line as shown in the following example:

    import intercept.InterceptWebDriver;

    Before: tldriver.set(new ChromeDriver(options));

After: tldriver.set(new InterceptWebDriver(newChromeDriver(options)));

Explanation:

  • Replacing tldriver.set(new ChromeDriver(options)); with tldriver.set(new InterceptWebDriver(new ChromeDriver(options))); allows the automation framework to monitor and intercept browser actions during test execution.

Updating testRunner Configuration
  1. On the Editor, open testRunner.java.

  2. Add "intercept" to the glue parameter.

  3. Update the glue variable as shown below:

    glue = { "steps", "intercept" }

Explanation:

  • Adding "intercept" to the glue parameter in testRunner.java tells the framework where to look for step definitions related to WebDriver interception.

  • By updating glue = { "steps", "intercept" }, the framework can correctly link your test steps with the interception logic, ensuring smooth execution of tests with the new WebDriver setup.

Enabling Data Parameterization
  1. Add the following code snippet to the setTestData function in your common Excel data reader file (such as CommonStepsForTestDataReader.java):

    import intercept.AvoHooks; AvoHooks.setExcelData(tableValue);

Explanation:

  • tableValue is the variable that stores the test data from your Excel sheet. It can have multiple rows and columns, depending on your test.

  • AvoHooks.setExcelData(tableValue) lets the automation framework use this data during the test, so your tests can run with different inputs automatically.

Generating and Uploading the Scenarios

To generate and upload Selenium scripts to Avo Assure, perform the following actions:

  1. Execute your Selenium automation suite.

Result: The execution generates a scenarios_batch.zip file in your project’s output folder.

Note: The scenarios_batch.zip file is generated at the following location:

<Path to your Selenium project>/src/main/java/intercept/output.

  1. Go to the Selenium To Avo page in Avo Assure.

  2. In the Select Project dropdown, select the Avo Assure project where you want to import the Selenium test cases.

  3. Upload the scenarios_batch.zip file generated in step 1.

  4. After uploading the file, select Start Migration button. The Migration Status dialog opens.

  1. On the Migration Status dialog, the following details are displayed:

  • Element Repository Folder and Testcase Folder name.

  • Testcase name and Migration Status.

  • A downloadable Excel file containing data parameterization details, which the user should review and correct if required.

The Excel file includes the following information:

i. Testcase name.

ii. Test Step Group name.

iii. Step details, including whether data parameterization is present.

  1. Select Ok button to close the Migration Status dialog.

Note: The Download link is enabled only if you configured the Data Parameterization in your code. Otherwise, it is disabled.

Note: After the migration is complete, verify the following:

  • Review the migrated test cases for accuracy.

  • Verify that test data is mapped correctly.

  • Manually validate business-critical test scenarios.

  • Ensure that data is parameterized only if you enabled the Data Parameterization setting. Otherwise, the values are hardcoded.

Last updated

Was this helpful?