Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/roboticautomata/selenium-restassured-testing-example
Selenium/Restassured for UI/API Testing in Maven, Testng, Java
https://github.com/roboticautomata/selenium-restassured-testing-example
api java restassured selenium testng
Last synced: about 1 month ago
JSON representation
Selenium/Restassured for UI/API Testing in Maven, Testng, Java
- Host: GitHub
- URL: https://github.com/roboticautomata/selenium-restassured-testing-example
- Owner: RoboticAutomata
- Created: 2024-02-17T21:50:39.000Z (11 months ago)
- Default Branch: main
- Last Pushed: 2024-03-16T12:46:27.000Z (10 months ago)
- Last Synced: 2024-03-16T14:52:49.563Z (10 months ago)
- Topics: api, java, restassured, selenium, testng
- Language: Java
- Homepage: https://linktr.ee/roboticautomata
- Size: 85 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Codeowners: CODEOWNERS
Awesome Lists containing this project
README
# API & UI Testing Example with Restassured, Selenium and TestNG
This repo demonstrates how to do Test Automation using Java, TestNg & Maven.
- For the API Test Automation we use Restassured
- For the UI Test Automation we use Selenium**Table of Contents**
* [Application under Test](#application-under-test)
* [Example Scenario to Automate](#example-scenario-to-automate)
* [Login Page](#login-page)
* [Add User Page](#add-user-page)
* [Contact List](#contact-list)
* [Exactly what APIs are we testing?](#exactly-what-apis-are-we-testing)
* [Add User](#add-user)
* [Login User](#login-user)
* [Logout User](#logout-user)
* [Delete User](#delete-user)
* [Repository Structure](#repository-structure)
* [Run the tests](#run-the-tests)
* [Run the API Tests](#run-the-api-tests)
* [Run the UI Tests](#run-the-ui-tests)
* [Resources](#resources)
* [API Tutorials](#api-tutorials)
* [UI Tutorials](#ui-tutorials)## Application under Test
We will be testing the [Thinking Tester Contact List App](https://thinking-tester-contact-list.herokuapp.com/) (CLA). The CLA enables a user to create an account to manage contacts.
The CLA API Documentation can be found [here](https://documenter.getpostman.com/view/4012288/TzK2bEa8).
## Example Scenario to Automate
Our test covers the specific workflow of opening the login page, creating a new user and logging out.### Login Page
![Login Page](images/LoginPage.png)### Add User Page
![Add User Page](images/AddUserPage.png)### Contact List
![Contact List Page](images/ContactListPage.png)## Exactly what APIs are we testing?
In case Thinking App goes down or the API is updated, here is the gist of the current APIs tested at the time of writing.
### Add User
```
POST Request ->
https://thinking-tester-contact-list.herokuapp.com/usersRequest Body ->
{
"firstName": "Test",
"lastName": "User",
"email": "[email protected]",
"password": "myPassword"
}Response Status ->
201
```### Login User
```
POST Request ->
https://thinking-tester-contact-list.herokuapp.com/users/loginRequest Body ->
{
"email": "[email protected]",
"password": "myNewPassword"
}Response Status ->
200Response Body ->
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MDgyMWYzMDYyZmJiMjEzZTJhZDlhMjAiLCJpYXQiOjE2MTk3M
}
```### Logout User
```
POST Request ->
https://thinking-tester-contact-list.herokuapp.com/users/logoutHeader ->
Authorization: Bearer $tokenResponse Status ->
200
```### Delete User
```
DELETE Request ->
https://thinking-tester-contact-list.herokuapp.com/users/meHeader ->
Authorization: Bearer $tokenResponse Status ->
200
```## Repository Structure
```
src/test/java/ThinkTester/ContactListApp
├── Apis
│ └── UserApi.java #Contains the User API Endpoints & Request Specifications
├── Pages #Page objects for the UI
│ ├── AddUserPage.java
│ ├── BasePage.java
│ ├── ContactListPage.java
│ └── LoginPage.java
├── Tests
│ ├── ApiTests #Tests each API
│ │ └── UserApiTest.java
│ └── UiTests #Test cases for the UI
│ └── SmokeUiTest.java
└── Utils
├── Environment.java #Specifies the Base URI
└── UserFactory.java #Creates data for a Random User
```## Run the tests
### Run the API Tests
```
mvn clean verify -Dtest=*ApiTest
```### Run the UI Tests
```
mvn clean verify -Dtest=*UiTest
```## Resources
### API Tutorials
- [Youtube Video Demo API](https://www.youtube.com/watch?v=3ZI9fF9IeP8)
- [Medium Blog Tutorial API](https://medium.com/@RoboticAutomata/restassured-testng-api-test-automation-tutorial-68be216e4d63)### UI Tutorials
- [Youtube Video Demo UI](https://youtu.be/14JRzMRI5yE)
- [Medium Blog Tutorial UI](https://medium.com/@RoboticAutomata/selenium-testng-ui-test-automation-tutorial-de7ef8bda5af)