{"id":10463,"date":"2023-04-04T09:09:04","date_gmt":"2023-04-04T13:09:04","guid":{"rendered":"https:\/\/www.redline13.com\/blog\/?p=10463"},"modified":"2023-09-12T07:07:55","modified_gmt":"2023-09-12T11:07:55","slug":"schedule-a-load-test","status":"publish","type":"post","link":"https:\/\/www.redline13.com\/blog\/2023\/04\/schedule-a-load-test\/","title":{"rendered":"Schedule a Load Test"},"content":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-10464 size-medium\" src=\"https:\/\/www.redline13.com\/blog\/wp-content\/uploads\/2023\/04\/word-image-10463-1-300x225.png\" alt=\"Schedule a load test\" width=\"300\" height=\"225\" srcset=\"https:\/\/www.redline13.com\/blog\/wp-content\/uploads\/2023\/04\/word-image-10463-1-300x225.png 300w, https:\/\/www.redline13.com\/blog\/wp-content\/uploads\/2023\/04\/word-image-10463-1.png 400w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><span style=\"font-weight: 400;\">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.&nbsp; The RedLine13 <\/span><a href=\"https:\/\/www.redline13.com\/ApiDoc\"><span style=\"font-weight: 400;\">API<\/span><\/a><span style=\"font-weight: 400;\"> makes this all possible.<\/span><\/p>\n<h3>A Practical Example<\/h3>\n<p>In a previous post we showed how to <a href=\"https:\/\/www.redline13.com\/blog\/2021\/04\/getting-started-with-the-redline13-api\/'\">get started using the RedLine13 API<\/a>. 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.<\/p>\n<p>Consider the following code sample in C#, where we use the RedLine13 API to start a new <a href=\"https:\/\/jmeter.apache.org\/usermanual\/index.html\">JMeter<\/a> test. Though you may use any language for your scripting, we have selected one to provide a practical example. The <code>LaunchNewTest()<\/code> 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.<\/p>\n<pre><strong>private static string LaunchNewTest()<\/strong>\n<strong>{<\/strong>\n<strong>    using (var request = new HttpRequestMessage(<\/strong>\n<strong>        new HttpMethod(\"POST\"),<\/strong>\n<strong>        $\"https:\/\/www.redline13.com\/Api\/LoadTest\/\"))<\/strong>\n<strong>    {<\/strong>\n<strong>        var httpClient = new HttpClient();<\/strong>\n<strong>        request.Headers.Add(\"X-Redline-Auth\", API_KEY);<\/strong>\n<strong>        var multipartContent = new MultipartFormDataContent();<\/strong>\n<strong>        multipartContent.Add(new StringContent(\"jmeter-test\"), \"testType\");<\/strong>\n<strong>        multipartContent.Add(new StringContent(\"1\"), \"numServers\");<\/strong>\n<strong>        multipartContent.Add(new ByteArrayContent(<\/strong>\n<strong>            File.ReadAllBytes(TEST_PLAN_PATH)), \"file\",<\/strong>\n<strong>            Path.GetFileName(TEST_PLAN_PATH));<\/strong>\n<strong>        multipartContent.Add(new StringContent(\"us-east-1\"), $\"server[0][location]\");<\/strong>\n<strong>        multipartContent.Add(new StringContent(\"m3.medium\"), $\"server[0][size]\");<\/strong>\n<strong>        multipartContent.Add(new StringContent(\"1\"), $\"server[0][num]\");<\/strong>\n<strong>        multipartContent.Add(new StringContent(\"T\"), $\"server[0][onDemand]\");<\/strong>\n<strong>        multipartContent.Add(new StringContent(\"1\"), $\"server[0][usersPerServer]\");<\/strong>\n<strong>        request.Content = multipartContent;<\/strong>\n<strong>        var response = httpClient.SendAsync(request).Result;<\/strong>\n<strong>        return response.Content.ReadAsStringAsync().Result;<\/strong>\n<strong>    }<\/strong>\n<strong>}<\/strong><\/pre>\n<h3>Schedule a Load with more Complex Conditions<\/h3>\n<p>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 (<em>e.g.<\/em>, as part of a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Continuous_integration\">continuous integration<\/a> build process, or as a <a href=\"https:\/\/learn.microsoft.com\/en-us\/powershell\/module\/scheduledtasks\/set-scheduledtask?view=windowsserver2022-ps\">scheduled task<\/a>). In addition to this we can also build logic into the script itself to handle even more complex situations:<\/p>\n<pre><strong>if (CONDITION)<\/strong>\n<strong>{<\/strong>\n<strong>    LaunchNewTest();<\/strong>\n<strong>}<\/strong>\n<strong>else<\/strong>\n<strong>{<\/strong>\n<strong>    LaunchOldTest();<\/strong>\n<strong>}<\/strong><\/pre>\n<hr>\n<p>Did you know that RedLine13 offers a full-featured free trial? <a href=\"https:\/\/www.redline13.com\/Service\">Sign up now<\/a> and schedule your load test.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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.&nbsp; 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<a class=\"more-link\" href=\"https:\/\/www.redline13.com\/blog\/2023\/04\/schedule-a-load-test\/\">Read More &rarr;<\/a><\/p>\n","protected":false},"author":11,"featured_media":10464,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[77,614,141,283,318,424,615],"class_list":{"0":"entry","1":"post","2":"publish","3":"author-dkoziel","4":"post-10463","6":"format-standard","7":"has-post-thumbnail","8":"category-blog","9":"post_tag-api","10":"post_tag-automation","11":"post_tag-continuous-integration","12":"post_tag-jmeter","13":"post_tag-load-testing","14":"post_tag-redline13","15":"post_tag-scripting"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.12 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Schedule a Load Test - RedLine13<\/title>\n<meta name=\"description\" content=\"Schedule A Load Test with the RedLine13 API as a scheduled task or as part of a continuous integration build process.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.redline13.com\/blog\/2023\/04\/schedule-a-load-test\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Schedule a Load Test - RedLine13\" \/>\n<meta property=\"og:description\" content=\"Schedule A Load Test with the RedLine13 API as a scheduled task or as part of a continuous integration build process.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.redline13.com\/blog\/2023\/04\/schedule-a-load-test\/\" \/>\n<meta property=\"og:site_name\" content=\"RedLine13\" \/>\n<meta property=\"article:published_time\" content=\"2023-04-04T13:09:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-09-12T11:07:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.redline13.com\/blog\/wp-content\/uploads\/2023\/04\/word-image-10463-1.png\" \/>\n\t<meta property=\"og:image:width\" content=\"400\" \/>\n\t<meta property=\"og:image:height\" content=\"300\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"David Koziel\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"David Koziel\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.redline13.com\/blog\/2023\/04\/schedule-a-load-test\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.redline13.com\/blog\/2023\/04\/schedule-a-load-test\/\"},\"author\":{\"name\":\"David Koziel\",\"@id\":\"https:\/\/www.redline13.com\/blog\/#\/schema\/person\/51d282221e3230ab35f964f98ada9b20\"},\"headline\":\"Schedule a Load Test\",\"datePublished\":\"2023-04-04T13:09:04+00:00\",\"dateModified\":\"2023-09-12T11:07:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.redline13.com\/blog\/2023\/04\/schedule-a-load-test\/\"},\"wordCount\":272,\"publisher\":{\"@id\":\"https:\/\/www.redline13.com\/blog\/#organization\"},\"keywords\":[\"api\",\"automation\",\"continuous integration\",\"JMeter\",\"Load Testing\",\"RedLine13\",\"scripting\"],\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.redline13.com\/blog\/2023\/04\/schedule-a-load-test\/\",\"url\":\"https:\/\/www.redline13.com\/blog\/2023\/04\/schedule-a-load-test\/\",\"name\":\"Schedule a Load Test - RedLine13\",\"isPartOf\":{\"@id\":\"https:\/\/www.redline13.com\/blog\/#website\"},\"datePublished\":\"2023-04-04T13:09:04+00:00\",\"dateModified\":\"2023-09-12T11:07:55+00:00\",\"description\":\"Schedule A Load Test with the RedLine13 API as a scheduled task or as part of a continuous integration build process.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.redline13.com\/blog\/2023\/04\/schedule-a-load-test\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.redline13.com\/blog\/2023\/04\/schedule-a-load-test\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.redline13.com\/blog\/2023\/04\/schedule-a-load-test\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.redline13.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Schedule a Load Test\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.redline13.com\/blog\/#website\",\"url\":\"https:\/\/www.redline13.com\/blog\/\",\"name\":\"RedLine13\",\"description\":\"(Almost) Free Load Testing in the Cloud\",\"publisher\":{\"@id\":\"https:\/\/www.redline13.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.redline13.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.redline13.com\/blog\/#organization\",\"name\":\"RedLine13\",\"url\":\"https:\/\/www.redline13.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.redline13.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.redline13.com\/blog\/wp-content\/uploads\/2013\/06\/cropped-rl13-header-logo.jpg\",\"contentUrl\":\"https:\/\/www.redline13.com\/blog\/wp-content\/uploads\/2013\/06\/cropped-rl13-header-logo.jpg\",\"width\":300,\"height\":68,\"caption\":\"RedLine13\"},\"image\":{\"@id\":\"https:\/\/www.redline13.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.redline13.com\/blog\/#\/schema\/person\/51d282221e3230ab35f964f98ada9b20\",\"name\":\"David Koziel\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.redline13.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/2babf644e0993fc86893c24d7525f1e3be114a8746c01249797f25587ae1697a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/2babf644e0993fc86893c24d7525f1e3be114a8746c01249797f25587ae1697a?s=96&d=mm&r=g\",\"caption\":\"David Koziel\"},\"url\":\"https:\/\/www.redline13.com\/blog\/author\/dkoziel\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Schedule a Load Test - RedLine13","description":"Schedule A Load Test with the RedLine13 API as a scheduled task or as part of a continuous integration build process.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.redline13.com\/blog\/2023\/04\/schedule-a-load-test\/","og_locale":"en_US","og_type":"article","og_title":"Schedule a Load Test - RedLine13","og_description":"Schedule A Load Test with the RedLine13 API as a scheduled task or as part of a continuous integration build process.","og_url":"https:\/\/www.redline13.com\/blog\/2023\/04\/schedule-a-load-test\/","og_site_name":"RedLine13","article_published_time":"2023-04-04T13:09:04+00:00","article_modified_time":"2023-09-12T11:07:55+00:00","og_image":[{"width":400,"height":300,"url":"https:\/\/www.redline13.com\/blog\/wp-content\/uploads\/2023\/04\/word-image-10463-1.png","type":"image\/png"}],"author":"David Koziel","twitter_card":"summary_large_image","twitter_misc":{"Written by":"David Koziel","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.redline13.com\/blog\/2023\/04\/schedule-a-load-test\/#article","isPartOf":{"@id":"https:\/\/www.redline13.com\/blog\/2023\/04\/schedule-a-load-test\/"},"author":{"name":"David Koziel","@id":"https:\/\/www.redline13.com\/blog\/#\/schema\/person\/51d282221e3230ab35f964f98ada9b20"},"headline":"Schedule a Load Test","datePublished":"2023-04-04T13:09:04+00:00","dateModified":"2023-09-12T11:07:55+00:00","mainEntityOfPage":{"@id":"https:\/\/www.redline13.com\/blog\/2023\/04\/schedule-a-load-test\/"},"wordCount":272,"publisher":{"@id":"https:\/\/www.redline13.com\/blog\/#organization"},"keywords":["api","automation","continuous integration","JMeter","Load Testing","RedLine13","scripting"],"articleSection":["Blog"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.redline13.com\/blog\/2023\/04\/schedule-a-load-test\/","url":"https:\/\/www.redline13.com\/blog\/2023\/04\/schedule-a-load-test\/","name":"Schedule a Load Test - RedLine13","isPartOf":{"@id":"https:\/\/www.redline13.com\/blog\/#website"},"datePublished":"2023-04-04T13:09:04+00:00","dateModified":"2023-09-12T11:07:55+00:00","description":"Schedule A Load Test with the RedLine13 API as a scheduled task or as part of a continuous integration build process.","breadcrumb":{"@id":"https:\/\/www.redline13.com\/blog\/2023\/04\/schedule-a-load-test\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.redline13.com\/blog\/2023\/04\/schedule-a-load-test\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.redline13.com\/blog\/2023\/04\/schedule-a-load-test\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.redline13.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Schedule a Load Test"}]},{"@type":"WebSite","@id":"https:\/\/www.redline13.com\/blog\/#website","url":"https:\/\/www.redline13.com\/blog\/","name":"RedLine13","description":"(Almost) Free Load Testing in the Cloud","publisher":{"@id":"https:\/\/www.redline13.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.redline13.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.redline13.com\/blog\/#organization","name":"RedLine13","url":"https:\/\/www.redline13.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.redline13.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.redline13.com\/blog\/wp-content\/uploads\/2013\/06\/cropped-rl13-header-logo.jpg","contentUrl":"https:\/\/www.redline13.com\/blog\/wp-content\/uploads\/2013\/06\/cropped-rl13-header-logo.jpg","width":300,"height":68,"caption":"RedLine13"},"image":{"@id":"https:\/\/www.redline13.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.redline13.com\/blog\/#\/schema\/person\/51d282221e3230ab35f964f98ada9b20","name":"David Koziel","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.redline13.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/2babf644e0993fc86893c24d7525f1e3be114a8746c01249797f25587ae1697a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2babf644e0993fc86893c24d7525f1e3be114a8746c01249797f25587ae1697a?s=96&d=mm&r=g","caption":"David Koziel"},"url":"https:\/\/www.redline13.com\/blog\/author\/dkoziel\/"}]}},"_links":{"self":[{"href":"https:\/\/www.redline13.com\/blog\/wp-json\/wp\/v2\/posts\/10463","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.redline13.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.redline13.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.redline13.com\/blog\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/www.redline13.com\/blog\/wp-json\/wp\/v2\/comments?post=10463"}],"version-history":[{"count":8,"href":"https:\/\/www.redline13.com\/blog\/wp-json\/wp\/v2\/posts\/10463\/revisions"}],"predecessor-version":[{"id":10866,"href":"https:\/\/www.redline13.com\/blog\/wp-json\/wp\/v2\/posts\/10463\/revisions\/10866"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.redline13.com\/blog\/wp-json\/wp\/v2\/media\/10464"}],"wp:attachment":[{"href":"https:\/\/www.redline13.com\/blog\/wp-json\/wp\/v2\/media?parent=10463"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.redline13.com\/blog\/wp-json\/wp\/v2\/categories?post=10463"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.redline13.com\/blog\/wp-json\/wp\/v2\/tags?post=10463"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}