We're proud to announce the availability of Custom Load Shapes for tests. Custom Shapes allow you to have very tight programmable control over the shape of user load in your tests.
Typically, LoadForge tests set a maximum number of users to achieve and grow to that based on the user growth rate. For example, I want to reach 10,000 connected users, and you can add 2% of those users per second.
Custom Shaped tests allow you to use python to define how many users should be connected to your system, allowing you to shape tests like the below image shows:
That is an example of a "double wave" test. The code to create that looks like this:
class DoubleWave(LoadTestShape): """ A shape to imitate some specific user behavior. In this example, midday and evening meal times. First peak of users appear at time_limit/3 and second peak appears at 2*time_limit/3 Settings: min_users -- minimum users peak_one_users -- users in first peak peak_two_users -- users in second peak time_limit -- total length of test """ min_users = 20 peak_one_users = 60 peak_two_users = 40 time_limit = 300 def tick(self): run_time = round(self.get_run_time()) if run_time < self.time_limit: user_count = ( (self.peak_one_users - self.min_users) * math.e ** -(((run_time / (self.time_limit / 10 * 2 / 3)) - 5) ** 2) + (self.peak_two_users - self.min_users) * math.e ** -(((run_time / (self.time_limit / 10 * 2 / 3)) - 10) ** 2) + self.min_users ) return (round(user_count), round(user_count)) else: return None
There are many examples available for you to simply copy paste and tweak the numbers with in our Directory.