This is a CLI system written in Go to perform load testing on a web service. It allows you to specify a service URL, the total number of requests, and the concurrency level to test the web service.
Make sure you have Go installed on your system. To run the project, follow these steps:
-
Clone the repository to your system:
git clone https://github.com/kameikay/stress-test.git
-
Navigate to the project directory:
cd your-repository
-
Build the project:
go build
-
Execute the project, providing the service URL, the total number of requests, and the concurrency level:
./stress-test --url=http://example.com --requests=1000 --concurrency=10
Alternatively, you can run the project using Docker. Follow these steps:
-
Pull the Docker image from Docker Hub:
docker pull kameikay/stress-test:latest
-
Run the Docker container, providing the necessary parameters:
docker run kameikay/stress-test:latest --url=http://example.com --requests=1000 --concurrency=10
--url
: The URL of the service to be tested.--requests
: The total number of requests.--concurrency
: The number of simultaneous calls.
After running the tests, the system generates a report with the following information:
- Total time spent on execution
- Total number of requests made
- Number of requests with HTTP status 200
- Distribution of other HTTP status codes (such as 404, 500, etc.)
The project includes unit tests to ensure the correct functionality of the features.
To run the tests, use the following command:
go test ./...
Make sure to install this dependency before running the project:
go mod tidy
Contributions are welcome! If you find an issue or have any suggestions to improve this project, feel free to open an issue or submit a pull request.