Skip to content
  • ZipCode Api
  • Blog
  • About RedLine13
RedLine13
RedLine13
Primary Navigation Menu
Menu
  • Start Testing
  • Demo
  • Pricing
  • JMeter
  • Partners
  • Docs
    • Documentation Home
    • AWS Set Up for load testing
    • AWS Approval for Large Tests
    • PHP, NodeJS, Python Load Tests
    • Scalability
    • Jenkins Plugin Setup
    • Premium Features
    • Knowledge Base

Schedule A Load Test

By: David Koziel

Schedule a load test

Once some users have written their load tests, they want to schedule a load test to run at a particular time or as part of a continuous integration build process. Or even run a recurring test at the same time on a schedule.  The RedLine13 API makes this all possible.

A Practical Example

In a previous post we showed how to get started using the RedLine13 API. Building upon this, you can use your scripting language of choice to invoke any action available from our web user interface. This includes running a load test, retrieving results from a previous test, and downloading load test statistics.

Consider the following code sample in C#, where we use the RedLine13 API to start a new JMeter test. Though you may use any language for your scripting, we have selected one to provide a practical example. The LaunchNewTest() method below not only illustrates the mechanics of making an API request to RedLine13, but will allow us to abstract the call to show other concepts.

private static string LaunchNewTest()
{
    using (var request = new HttpRequestMessage(
        new HttpMethod("POST"),
        $"https://www.redline13.com/Api/LoadTest/"))
    {
        var httpClient = new HttpClient();
        request.Headers.Add("X-Redline-Auth", API_KEY);
        var multipartContent = new MultipartFormDataContent();
        multipartContent.Add(new StringContent("jmeter-test"), "testType");
        multipartContent.Add(new StringContent("1"), "numServers");
        multipartContent.Add(new ByteArrayContent(
            File.ReadAllBytes(TEST_PLAN_PATH)), "file",
            Path.GetFileName(TEST_PLAN_PATH));
        multipartContent.Add(new StringContent("us-east-1"), $"server[0][location]");
        multipartContent.Add(new StringContent("m3.medium"), $"server[0][size]");
        multipartContent.Add(new StringContent("1"), $"server[0][num]");
        multipartContent.Add(new StringContent("T"), $"server[0][onDemand]");
        multipartContent.Add(new StringContent("1"), $"server[0][usersPerServer]");
        request.Content = multipartContent;
        var response = httpClient.SendAsync(request).Result;
        return response.Content.ReadAsStringAsync().Result;
    }
}

Schedule a Load with more Complex Conditions

Once we have our API call in our scripting language of choice, we really can encapsulate it in any type of logic that we choose to schedule a load test. The script itself can be triggered by some action (e.g., as part of a continuous integration build process, or as a scheduled task). In addition to this we can also build logic into the script itself to handle even more complex situations:

if (CONDITION)
{
    LaunchNewTest();
}
else
{
    LaunchOldTest();
}

Did you know that RedLine13 offers a full-featured free trial? Sign up now and schedule your load test.

2023-04-04
Previous Post: Guest Post – IoT Load Testing
Next Post: Analyzing the JMeter Dashboard Report Total Row

Recent Posts

  • Using the JMeter Dummy Sampler
  • Top 10 JMeter Plugins
  • Random Data in JMeter Performance Tests
  • Filtering the JMeter Dashboard Report
  • RedLine13 Security Updates For Enterprise Users

Related

  • Using the JMeter Dummy Sampler
  • Top 10 JMeter Plugins
  • Random Data in JMeter Performance Tests
  • Filtering the JMeter Dashboard Report
  • Selecting Custom OpenJDK version for JMeter
  • RedLine13 Security Updates For Enterprise Users
  • Protecting Sensitive Data in JMeter Load Tests
  • A Guide to JMeter Preprocessors and Postprocessors
  • JMeter Timers Primer
  • Analyzing the JMeter Dashboard Report Total Row

© RedLine13, LLC | Privacy Policy | Contract
Contact Us: info@redline13.com

Designed using Responsive Brix. Powered by WordPress.