This is an Automation project using Java with Selenium Webdriver for UI Tests and REST Assured for API Tests. This project has been developed by Douglas Urrea Ocampo to improve learning on advanced Automation testing.
The main features of this project has the following:
- Page Object Model (POM) as a design pattern for creating an Object directory for web UI elements.
- Page Factory is a class provided by Selenium WebDriver to support Page Object Design patterns. In Page Factory, tester used @FindBy annotation. The initElements method is used to initialize web elements.
- Interface to bind static constants and abstract methods to achieve Data Abstraction and multiple Inheritance.
- The re-usability of code to avoid unnecessary data exposure to the user by using the abstraction.
- TestNG is a framework for writing test automation tests.
- REST Assured is a framework for writing RESTful API tests.
- Selenium Webdriver is a webdriver that supports UI Tests.
- Name:
Douglas Urrea Ocampo
- Country:
Colombia
- City:
Medellin
- E-mail:
[email protected]
- LinkedIn: https://www.linkedin.com/in/douglasfugazi
- Contact: https://douglasfugazi.co
This is an end-to-end UI tests using Selenium Webdriver and API tests using REST Assured. The website under test was MercadoLibre e-commerce website here with a BaseUrl to test different domain access according to the desired location. I must say it was fun learning and automating this website because it was challenging in some respects.
- Browser is Microsoft Edge in order to have a different approach to test.
- User will navigate to the website and select a category on the navigation menu and verify the total results on the page.
- User will select a product and verify the product details.
- End-to-end UI tests has the following scenarios:
- Scenario 1:
- Test to verify the "Air Condition" category workflow
- Scenario 2:
- Test to verify the "Smartphones" category workflow
- Scenario 3:
- Test to verify the "Fragrances" category workflow
- Scenario 4:
- Test to verify the "Tools" category workflow
- Scenario 5:
- Test to verify the "Baby" category workflow
- Scenario 6:
- Test to verify the Logo Page is displayed
- Scenario 7:
- Test to verify the Product Page with the product details
- Scenario 1:
- REST API tests has the following scenarios:
- Scenario 1:
- Test to get the product by name
- Method GET to Search Product to verify API response
- Scenario 2:
- Test to get the product by id
- Method GET to Product by id to verify API response
- Scenario 1:
- After the test, assertions will be validated to each test, user will check for the logo and select a product and verify the product details.
- Annotation @Test will be used to group the tests by Smoke and Regression tests.
- Each tests will finish automatically and the browser will be closed.
- Download the latest Java JDK from here
- Install git from here
- Selenium Webdriver from here
- Get WebDriverManager from here
- Install Apache Maven from here
- Test Runner is TestNG 7 from here
- API REST Assured from here
- Build Tool is Maven the latest version
- Note: ChromeDriver.exe is not necessary, you should use the WebDriverManager capabilities.
- Note: POM.xml has all configuration installed, you should use the Maven build tool only.
- Download the project from GitHub
- Option 1:
git clone https://github.com/fugazi/carbonlibre-ui-api-selenium.git
- Option 2: Download it as a Zip file and extract it
- Option 1:
- CD into the
Carbon Libre > carbonlibre-ui-api-selenium
folder - Set up Maven
- Run the following command in the terminal:
- Option 1:
mvn clean
- Option 2:
mvn clean package
- Option 1:
- Run the following command in the terminal:
- Running Tests in the project
- Option 1: run
mvn clean install
in the path of the project - Option 2: Open the project baseline and run each Selenium Test and REST API tests
- Option 1: run
- Enjoy the project! 😎
TBA
- Selenium project Baseline:
Carbon Libre
- Base Interface
BaseUrl.java
into foldersrc\test\java\com\ui\tests
- Selenium UI Tests
CategoriesTest.java
into foldersrc\test\java\com\ui\tests
- Selenium UI Tests
ProductTest.java
(Tests with Login Credentials) into foldersrc\test\java\com\ui\tests
- Page Factory Objects
CategoriesPage.java
into foldersrc\test\java\com\ui\tests\carbonlibre\Pages
- Page Factory Objects
ProductPage.java
into foldersrc\test\java\com\ui\tests\carbonlibre\Pages
- Base Interface
- testName:
ui.tests.carbonlibre.CategoriesTest
andui.tests.carbonlibre.ProductTest
- API RestAssured project Baseline:
Carbon Libre
- Base Utility Class
BaseSetup.java
into foldersrc\test\java\com\api\tests
- REST API Tests
RestfulApiTest.java
into foldersrc\test\java\com\api\tests
- Base Utility Class
- testName:
api.tests.carbonlibre.RestfulApiTest
- Display dependencies updates:
mvn versions:display-dependency-updates
- Update properties:
mvn versions:update-properties
- Execute Surefire Tests:
mvn surefire:test
andmvn surefire-report:report