A REST API Test Framework for developing the regression suites. The test cases can be run locally or through CI/CD.
- Triggering the automation through a maven command or a testng xml file is the starting point.
- Download the latest docker-compose.yml
from here, a quicker way to download
this is to use below command
curl https://raw.githubusercontent.com/reportportal/reportportal/master/docker-compose.yml -o docker-compose.yml - Once downloaded, execute the below command to pull the required images and start containers
docker-compose -p reportportal up -d --force-recreate - Verify login http://localhost:8080/ui/#login with
default\1q2w3eorsuperadmin\erebus - Create a blank project and copy and paste the below config in
reportportal.propertiesundersrc/test/resources. See the table below. - Read these great posts written below by Automation Hacks to configure the Report portal. By far, these are the only posts with accurate steps.
| Sl.No | Report portal Property Name | Report portal Property Value |
|---|---|---|
| 1 | rp.endpoint | http://localhost:8080 |
| 2 | rp.api.key | <API_KEY> |
| 3 | rp.launch | Java launch |
| 4 | rp.project | api_tests |
- Create a discord account and follow the steps given here to configure a message channel and send the test reports after the test execution.
- Pass your channel's webhook token in the
ApiConstantsclass. - Here we will send the Report Portal Launch URL along with test case metrics. So make sure that your report portal is up and running.
- You're ready to execute your tests now. Follow the below section.
The TestNG has a default value of thread = 5 for parallel testing.
To override the thread values use -DthreadPoolSize=3 -Ddataproviderthreadcount=3 in the below maven command
1. git clone https://github.com/iamcharankumar/api_test_framework.git
2. cd api_test_framework
3. git pull
4. mvn clean test -Dgroups=ALL_SMOKE,ALL_REGRESSION -Dthreads=3 -Ddataproviderthreadcount=3
Note:
- To run specific test cases, use appropriate Test groups present in the 'TestGroups' class.
- Maven usually floods the console with logs during test execution, making it hard to spot what's important. A clean, minimal, Node.js-style output for a Java project felt impossible—until I found this maven dependency.
- Its purpose is simple: "What happened to my test cases?" That’s exactly what it shows—straight to the point, no clutter.
- By following this post by Fabricio, I was able to configure it easily and get the clean output shown below.
- The output works locally and in GitHub Actions as well.
- Huge respect and thanks to the author for this brilliant work! ❤️
