uLucasFraga / restassured_for_studies

Repository with automated test for API (rest) using the frameworks: restassured and junit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RESTASSURED-FOR-STUDIES

QA CI/CD ServeRest API

Repository with automated tests for API using the frameworks: restassured and junit

Testing and validating REST services in Java with RESTASSURED:


Table of Contents

Índice README.


Prerequisites

Configuration

environment variables and bash_profile - example:

java: export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home
maven: export PATH=/opt/apache-maven-3.5.3/bin:$PATH
Install Java
Install Maven

Create a maven project or use the pom.xml file already created to download/install its dependencies

Installation

Clone project

  • Clone this repo to your local machine using http or ssh, for example:

git clone https://github.com/uLucasFraga/restassured_for_studies.git

  • Install all dependencies (pom.xml) mvn install and run tests:

cd /your_project

mvn install

Download dependencies via Maven

Tips

  • Use pom.xml to download your new libs and keep the project running via terminal

How to tests

Before running the tests we will need:

  • Create a config.properties file inside the resources folder and insert valid values
  • For example: config.properties.example

The valid values are below:

example_values:
APP_URL=http://localhost:3000
EMAIL_ADMIN=fulano@qa.com
EMAIL_USER=lucas.fraga@qa.com
EMAIL_INVALID=invalid
PASSWORD_INVALID=passinvalid
PASSWORD_ADMIN=teste
PASSWORD_USER=teste@123
NOTE:

This data is exposed but as a good practice (security of sensitive data) it would be interesting not to upload (via .gitignore) the file config.properties to the project.

UP the ServeRest to perform the tests

npx serverest -t 10000

Run all integration tests

mvn -Dtest=AllIntegrationIT tests

Run all contract tests

mvn -Dtest=AllContractIT tests

Run a single tests

mvn -Dtest={your_class}#{your_test} tests

To clean the project, install the dependencies and skip all tests

mvn clean install -DskipUTs=true -DskipITs=true

To run the tests via IDE (IntelliJ)

Right click on project/class on restassured_for_studies > Run 'AllIT' or CTRL+F5

IMPORTANT:

As the repository is only for studies,

the tests only pass with the serverest (empty/clean),

if there is new data, the tests will break.


Support


License

License

About

Repository with automated test for API (rest) using the frameworks: restassured and junit


Languages

Language:Java 100.0%