TABLE OF CONTENTS
3. Generate and Execute Scripts
This article provides the instructions to automate web applications using Java Selenium Framework.
In this use case, you are shopping for a new laptop on an amazon website, making selections based on specific requirements, such as brand, filtering options, adding items to the cart, and proceeding to check out for a purchase. |
Leveraging algoQA, you can perform the following:
1. Prerequisites
- Use algoScraper for Application Scraping
- The algoScraper tool, available as a Chrome extension, serves the purpose of capturing all User Interface (UI) elements and X-paths present on a web page. To integrate this tool into your Chrome or Edge browser, Click here.
- Scrape all the required UI elements and download the file in the CSV format. For more information on scraping UI elements and tool information, see algoScraper as an Extension Tool for Chrome or Edge Users.
- The downloaded spreadsheet contains comprehensive details of UI elements details.
Tip: Ensure that all page names in the scraped file are same as the UI elements’ names.
- Supported Framework for windows - Java selenium
- The framework requires Java and Maven as key components.
To install the latest versions of Java and Maven, refer to the Configuring Web Applications Using Java Selenium Framework.
2. Profile the application
Profiling is the process of creating an offline model of an application under test (AUT), which involves mimicking a UI model of an AUT using nodes, features and UI elements.
Profiling involves:
- Create an Offline Model - To create an offline model, see Profiling article.
- Recording the scenarios using FollowMe feature
Follow Me feature is used to record and save the workflow or scenario or use case. Scenario will be saved in the same sequence it has been recorded.
Note: Recording for the FollowMe feature is done in an offline model. It doesn’t interact with the live application.
For more information, see Follow Me section in the Profiling article.
- Generating Test Cases
Test cases are generated in Gherkin language and are Behavior-driven development (BDD) compliant.
For more information, see Generate Test cases section in the Profiling article.
3. Generate and Execute Scripts
Perform the following:
- In the Main Canvas, click Script Generation button.
- In the Script Generation screen, navigate to the appropriate folder.
- Ensure to select both the files generated in the Test Cases folder. If you happen to select either Feature File or Spreadsheet file in XLSX/XLS format, then you will see the following error message:
- Click Analyze button.
- In the pop-up window, click 'Proceed' to highlight the Generate Script button.
- Click Generate Script.
- Scripts are generated successfully with the specified report, as shown. Click the Close button.
- Execution of scripts on a windows machine:
- Download and extract the script to your local folder. Navigate to the same folder.
- In the folder navigation bar, type cmd and press 'Enter' to view the Command Prompt screen.
- Run the following command to trigger the script:
mvn test
This command will execute the script using Maven, as shown: - Wait until the Build Success message is displayed, which indicates that scripts have been executed successfully.
- You can view the respective report in the Output folder, as shown:
- Reports will be generated in Spark and PDF formats, as shown:
- The sample PDF report is shown in the attached image. It includes the following details:
- Test Results: Number of test cases that passed and failed.
- Execution Time: Total duration taken to execute features, scenarios and steps.
- Step Details: You can view preceding Information for each test step by clicking the feature name link.
- Screenshots: You can also view screenshots for each verification step.
4. Related Articles
Displaying Timestamps for Generated Script Folders to Identify Concurrent Users' Actions.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article