Repository with automated tests for API using the frameworks: restassured and junit
Testing and validating REST services in Java with RESTASSURED:
Índice
README
.
environment variables and bash_profile - example:
- Mac, Windows and Linux: https://www.liquidweb.com/kb/how-to-install-java-on-ubuntu-windows-and-macos
- Mac, Windows and Linux: https://www.baeldung.com/install-maven-on-windows-linux-mac
Create a maven project or use the pom.xml file already created to download/install its dependencies
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
Tips
- Use pom.xml to download your new libs and keep the project running via terminal
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:
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
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
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.
-
Twitter at
@ulucasfraga
-
Facebook at
my_facebook
-
Linkedin at
my_linkedin
-
E-mail:
lucass.fragaa@gmail.com
-
Skype:
live:lucass.fragaa
- MIT license
- Copyright 2018 © Lucas Fraga.