Welcome to REST_GO, a repository that collects REST API Testing Tools and RESTful Services.
With the ever-growing importance of RESTful web services, effective testing methods are paramount. Our repository aims to serve as a one-stop resource for both researchers and practitioners in the realm of REST API testing. By consolidating the most valuable tools and services, we hope to advance the state of the art and ease the tasks of developers and testers alike.
If you find the resources here beneficial, we'd appreciate it if you consider citing our research paper, titled "Automated Test Generation for REST APIs: No Time to Rest Yet".
We currently have 11 open source REST API testing projects:
- EvoMaster: Evolutionary Algorithm and Dynamic Program Analysis approach
- RESTler: Identifies producer-consumer dependencies among request types using OpenAPI definition
- RestTestGen: Generates valid call sequences by constructing and traversing an Operation Dependency Graph (ODG) based on API dependencies
- RESTest: Supports inter-parameter dependency specification and analysis using constraint-based testing
- bBOXRT: Robustness testing tool for REST services, generating invalid inputs combined with valid parameters based on a service description document
- Schemathesis: Property-based testing approach
- Tcases: Models input space using operation's input and output for comprehensive testing
- Dredd: Validates responses based on status codes, headers, and body payloads using sample values from the specification and dummy values
- APIFuzzer: Employs fuzzing with random values and mutations
- RestCT: Combinatorial testing-based approach
- Morest: Dynamically updates RESTful-service Property Graph (RPG) to model API and object schema information.
Given the frequent updates to most of these tools, I recommend visiting their official websites for the latest installation instructions.
We have identified 20 open-source Java-based RESTful services:
- Corona-Warn-App Verification Server: This project has a rate limit (1000 requests per hour).
- ERC-20 RESTful service: This project crashes due to an update in the external dependency (web3j). Since this project is no longer maintained, we cannot use it anymore.
- Features Model MicroService
- Genome Nexus
- LanguageTool
- Simple internet-market
- NCS
- News
- OCVN: Currently, we are having an authentication issue for some operations.
- Person Controller
- Problem & Project Controller: Functional Issue - Cannot obtain code resource
- Project Tracking System
- proxyprint-kitchen: Currently, we are having an authentication issue for some operations.
- RESTful web service study: This service is no longer accessible.
- REST Countries
- SCS
- Scout API: This service is no longer accessible.
- Spring Boot Actuator: Currently, we are facing a broken dependency issue.
- Spring Batch REST: Functional Issue - Cannot obtain job resource
- User Management Microservice
We've collected all services' source codes in services
directory and all specifications in specifications
directory.
To use the services, please install the services (check setup.sh
as a reference) and dependencies.
Then, you can use the python script to run the services. Command Line Arguments:
- SERVICE_NAME: The name of the service you want to run. possible names are: features-service, languagetool, ncs, news, ocvn, proxyprint, restcountries, scout-api, scs, erc20-rest-service, genome-nexus, person-controller, problem-controller, rest-study, spring-batch-rest, spring-boot-sample-app, user-management, cwa-verification, market, project-tracking-system
- COVERAGE_PORT: The port for JaCoCo (Java Code Coverage Library).
- WHITEBOX/BLACKBOX: The approach (either "whitebox" or "blackbox").
python3 run_service.py {SERVICE_NAME} {COVERAGE_PORT} {WHITEBOX/BLACKBOX}
For a precise measurement of code coverage, follow these steps:
- Set Up the Tools: Download the Jacoco Agent and Jacoco CLI. These tools will aid in the measurement process.
- Run the Project with Jacoco Agent: Launch each project with the following option, replacing
{COVERAGE_PORT}
with your chosen port number:
-javaagent:org.jacoco.agent-0.8.7-runtime.jar=includes=*,output=tcpserver,port={COVERAGE_PORT},address=*,dumponexit=true -Dfile.encoding=UTF-8
- Run the Coverage Script: Execute the
get_cov.sh
script:
sh get_cov.sh {COVERAGE_PORT}
This script will produce coverage files at 10-minute intervals over the span of an hour, resulting in files named:
10 minute: jacoco_{COVERAGE_PORT}_1.exec
20 minute: jacoco_{COVERAGE_PORT}_2.exec
30 minute: jacoco_{COVERAGE_PORT}_3.exec
40 minute: jacoco_{COVERAGE_PORT}_4.exec
50 minute: jacoco_{COVERAGE_PORT}_5.exec
60 minute: jacoco_{COVERAGE_PORT}_6.exec
After having the coverage result, run this command to generate the coverage and error report:
python3 report.py {COVERAGE_PORT} {SOURCE_CODE_LOCATION}
Please note that you need to have all the executable Jacoco files generated in the previous step in the same directory. It will generate a report
directory with error.json
that contains error report and res.csv
that contains coverage report.
Some APIs can have an authorization header to increase the API request limit. We recommend to use mitmproxy to add the authorization header.
You need to add your token in authToken.py (Replce TOKEN_HERE
with an appropriate token) and run the following command with the service URL and proxy URL. Mitmproxy accepts the request and forwards it to the specified upstream server.
mitmproxy --mode reverse:SERVICE_URL -p PROXY_PORT_NUMBER -s authToken.py
We provide two proof-of-concept prototypes that help to find example value, inter-parameter dependency, and linked response parameter for each request parameter. proof-of-concept1.py takes parameter description and parameter names in the operation and produce example values and inter-parameter dependency. proof-of-concept2.py takes request parameter names and response parameter names in the specification and produce request parameter and response parameter pairs. Each request parameter name has three response parameter names that are top three similar names.
python3 tools/proof-of-concept1.py {parameter description} {parameter names}
python3 tools/proof-of-concept2.py {request parameter names} {response parameter names}
However, instead of this proof of concept tools, we highly recommend to read Enhancing REST API Testing with NLP Techniques and use NLP2REST as it is more advanced technique.