This project is designed to simulate real-world end-users interacting with the StockTrader application through an external load balancer, such as an AWS Elastic LoadBalancer. The purpose is to test the application's performance, scalability, and reliability under various user scenarios.
The load testing scenario involves the following key features:
-
User Portfolio Creation: The load test will initiate the creation of a new portfolio for a randomly generated user. This step represents the beginning of a user's interaction with the StockTrader application.
-
Stock Purchase: After portfolio creation, the load test will instruct users to buy a random number of shares (between 0 and 100) of a randomly selected stock. This action emulates the common behavior of users buying stock.
-
Stock Sale: Subsequently, a random number of shares of the selected stock will be sold. This action mimics users' interactions with the application to sell their existing holdings.
-
Portfolio Deletion: The load test will conclude by instructing users to delete their portfolios, representing the end of a user's engagement with the application.
-
Think Time: Between each of the above activities, there is a random "think time" period, simulating the intervals during which users ponder their next move or perform other actions on the platform.
-
Page Navigation Steps: The scenarios also includes page-navigation steps. These actions replicate the navigation users typically perform when interacting with the application.
The load testing scenario is highly customizable, allowing you to tailor it to your specific testing requirements. You can get creative and make the following adjustments:
-
Additional Buy/Sell Actions: You can add more buy and sell actions to simulate a more dynamic user behavior. For instance, you can introduce limit orders, market orders, or other trading strategies.
-
Extended Think Time: If you want to stress the application's ability to handle prolonged user interactions, you can increase the "think time" periods.
-
Additional Actions: You can include other actions that users might perform on the StockTrader application, such as checking their portfolio balance, transferring funds, or setting up alerts.
-
Emulate Different User Types: By modifying the scenario, you can emulate different types of user behavior. For example, you can simulate the behavior of novice investors, day traders, or long-term investors by changing the actions included in the scenario
Before running the tool, you need to ensure that the following prerequisites are met.
First, you need to setup SDKMAN and SBT for managing Scala and SBT versions. Follow these steps:
curl -s "https://get.sdkman.io" | bash
sdk install scala
sdk install sbt
Now, you need to clone the loopr repository, which contains the StockTrader Load Testing Tool.
git clone https://github.com/rtclauss/loopr.git
Change your working directory to the loopr repository
cd loopr
You're now ready to run the StockTrader Load Testing Tool.
Use SBT to clean and execute the test. Make sure to replace https://a872f86d8b0b74adc9a6fb3568be2118-cb3a347684a3ce53.elb.us-east-2.amazonaws.com:9443 with your specific test target:
sbt clean GatlingIt/test -DpublicBaseEndpoint=https://a872f86d8b0b74adc9a6fb3568be2118-cb3a347684a3ce53.elb.us-east-2.amazonaws.com:9443