{"id":320,"date":"2013-11-15T12:45:29","date_gmt":"2013-11-15T17:45:29","guid":{"rendered":"https:\/\/www.redline13.com\/blog\/?p=320"},"modified":"2022-01-03T20:00:18","modified_gmt":"2022-01-04T01:00:18","slug":"handling-failures-in-your-custom-test-script","status":"publish","type":"post","link":"https:\/\/www.redline13.com\/blog\/2013\/11\/handling-failures-in-your-custom-test-script\/","title":{"rendered":"Handling Failures in your Custom Test Script"},"content":{"rendered":"<p>When writing a Custom test script, you need to add the ability to handle errors. \u00a0Otherwise, the test script will cause that client to fail.<\/p>\n<p>This happens frequently because the request failed by receiving no response or timing out. \u00a0Once it fails, that user test stops.<\/p>\n<p>If you want to continue after an error, you should wrap the goToUrl call in a try\/catch. In the catch, add something like:<br \/>\n<code><br \/>\ncatch (Exception $e) {<br \/>\n&nbsp;&nbsp;\/\/ Record error<br \/>\n&nbsp;&nbsp;$msg = $e-&gt;getMessage();<br \/>\n&nbsp;&nbsp;recordError($msg ? $msg : 'Unknown error');<br \/>\n}<\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>When writing a Custom test script, you need to add the ability to handle errors. \u00a0Otherwise, the test script will cause that client to fail. This happens frequently because the request failed by receiving no response or timing out. \u00a0Once it fails, that user test stops. If you want to continue after an error, you should wrap the goToUrl call in a try\/catch. In the catch, add something like: catch (Exception $e) { &nbsp;&nbsp;\/\/ Record error<a class=\"more-link\" href=\"https:\/\/www.redline13.com\/blog\/2013\/11\/handling-failures-in-your-custom-test-script\/\">Read More &rarr;<\/a><\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,10],"tags":[195,318],"class_list":{"0":"entry","1":"post","2":"publish","3":"author-richardfriedman","4":"post-320","6":"format-standard","7":"category-blog","8":"category-php","9":"post_tag-error-handling","10":"post_tag-load-testing"},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.12 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Handling Failures in your Custom Test Script - RedLine13<\/title>\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\/2013\/11\/handling-failures-in-your-custom-test-script\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Handling Failures in your Custom Test Script - RedLine13\" \/>\n<meta property=\"og:description\" content=\"When writing a Custom test script, you need to add the ability to handle errors. \u00a0Otherwise, the test script will cause that client to fail. This happens frequently because the request failed by receiving no response or timing out. \u00a0Once it fails, that user test stops. If you want to continue after an error, you should wrap the goToUrl call in a try\/catch. In the catch, add something like: catch (Exception $e) { &nbsp;&nbsp;\/\/ Record errorRead More &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.redline13.com\/blog\/2013\/11\/handling-failures-in-your-custom-test-script\/\" \/>\n<meta property=\"og:site_name\" content=\"RedLine13\" \/>\n<meta property=\"article:published_time\" content=\"2013-11-15T17:45:29+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-01-04T01:00:18+00:00\" \/>\n<meta name=\"author\" content=\"Rich Friedman\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Rich Friedman\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.redline13.com\/blog\/2013\/11\/handling-failures-in-your-custom-test-script\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.redline13.com\/blog\/2013\/11\/handling-failures-in-your-custom-test-script\/\"},\"author\":{\"name\":\"Rich Friedman\",\"@id\":\"https:\/\/www.redline13.com\/blog\/#\/schema\/person\/0fadb7f3ef665407f3c93c8ec84e741a\"},\"headline\":\"Handling Failures in your Custom Test Script\",\"datePublished\":\"2013-11-15T17:45:29+00:00\",\"dateModified\":\"2022-01-04T01:00:18+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.redline13.com\/blog\/2013\/11\/handling-failures-in-your-custom-test-script\/\"},\"wordCount\":77,\"publisher\":{\"@id\":\"https:\/\/www.redline13.com\/blog\/#organization\"},\"keywords\":[\"Error Handling\",\"Load Testing\"],\"articleSection\":[\"Blog\",\"Custom PHP\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.redline13.com\/blog\/2013\/11\/handling-failures-in-your-custom-test-script\/\",\"url\":\"https:\/\/www.redline13.com\/blog\/2013\/11\/handling-failures-in-your-custom-test-script\/\",\"name\":\"Handling Failures in your Custom Test Script - RedLine13\",\"isPartOf\":{\"@id\":\"https:\/\/www.redline13.com\/blog\/#website\"},\"datePublished\":\"2013-11-15T17:45:29+00:00\",\"dateModified\":\"2022-01-04T01:00:18+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.redline13.com\/blog\/2013\/11\/handling-failures-in-your-custom-test-script\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.redline13.com\/blog\/2013\/11\/handling-failures-in-your-custom-test-script\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.redline13.com\/blog\/2013\/11\/handling-failures-in-your-custom-test-script\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.redline13.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Handling Failures in your Custom Test Script\"}]},{\"@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\/0fadb7f3ef665407f3c93c8ec84e741a\",\"name\":\"Rich Friedman\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.redline13.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/8651ce662fc18353b90c1922f9d29efb01173afa5500224b4d9a355d858a7bd9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/8651ce662fc18353b90c1922f9d29efb01173afa5500224b4d9a355d858a7bd9?s=96&d=mm&r=g\",\"caption\":\"Rich Friedman\"},\"sameAs\":[\"http:\/\/richardfriedman@yahoo.com\"],\"url\":\"https:\/\/www.redline13.com\/blog\/author\/richardfriedman\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Handling Failures in your Custom Test Script - RedLine13","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\/2013\/11\/handling-failures-in-your-custom-test-script\/","og_locale":"en_US","og_type":"article","og_title":"Handling Failures in your Custom Test Script - RedLine13","og_description":"When writing a Custom test script, you need to add the ability to handle errors. \u00a0Otherwise, the test script will cause that client to fail. This happens frequently because the request failed by receiving no response or timing out. \u00a0Once it fails, that user test stops. If you want to continue after an error, you should wrap the goToUrl call in a try\/catch. In the catch, add something like: catch (Exception $e) { &nbsp;&nbsp;\/\/ Record errorRead More &rarr;","og_url":"https:\/\/www.redline13.com\/blog\/2013\/11\/handling-failures-in-your-custom-test-script\/","og_site_name":"RedLine13","article_published_time":"2013-11-15T17:45:29+00:00","article_modified_time":"2022-01-04T01:00:18+00:00","author":"Rich Friedman","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Rich Friedman"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.redline13.com\/blog\/2013\/11\/handling-failures-in-your-custom-test-script\/#article","isPartOf":{"@id":"https:\/\/www.redline13.com\/blog\/2013\/11\/handling-failures-in-your-custom-test-script\/"},"author":{"name":"Rich Friedman","@id":"https:\/\/www.redline13.com\/blog\/#\/schema\/person\/0fadb7f3ef665407f3c93c8ec84e741a"},"headline":"Handling Failures in your Custom Test Script","datePublished":"2013-11-15T17:45:29+00:00","dateModified":"2022-01-04T01:00:18+00:00","mainEntityOfPage":{"@id":"https:\/\/www.redline13.com\/blog\/2013\/11\/handling-failures-in-your-custom-test-script\/"},"wordCount":77,"publisher":{"@id":"https:\/\/www.redline13.com\/blog\/#organization"},"keywords":["Error Handling","Load Testing"],"articleSection":["Blog","Custom PHP"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.redline13.com\/blog\/2013\/11\/handling-failures-in-your-custom-test-script\/","url":"https:\/\/www.redline13.com\/blog\/2013\/11\/handling-failures-in-your-custom-test-script\/","name":"Handling Failures in your Custom Test Script - RedLine13","isPartOf":{"@id":"https:\/\/www.redline13.com\/blog\/#website"},"datePublished":"2013-11-15T17:45:29+00:00","dateModified":"2022-01-04T01:00:18+00:00","breadcrumb":{"@id":"https:\/\/www.redline13.com\/blog\/2013\/11\/handling-failures-in-your-custom-test-script\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.redline13.com\/blog\/2013\/11\/handling-failures-in-your-custom-test-script\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.redline13.com\/blog\/2013\/11\/handling-failures-in-your-custom-test-script\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.redline13.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Handling Failures in your Custom Test Script"}]},{"@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\/0fadb7f3ef665407f3c93c8ec84e741a","name":"Rich Friedman","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.redline13.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/8651ce662fc18353b90c1922f9d29efb01173afa5500224b4d9a355d858a7bd9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8651ce662fc18353b90c1922f9d29efb01173afa5500224b4d9a355d858a7bd9?s=96&d=mm&r=g","caption":"Rich Friedman"},"sameAs":["http:\/\/richardfriedman@yahoo.com"],"url":"https:\/\/www.redline13.com\/blog\/author\/richardfriedman\/"}]}},"_links":{"self":[{"href":"https:\/\/www.redline13.com\/blog\/wp-json\/wp\/v2\/posts\/320","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\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.redline13.com\/blog\/wp-json\/wp\/v2\/comments?post=320"}],"version-history":[{"count":1,"href":"https:\/\/www.redline13.com\/blog\/wp-json\/wp\/v2\/posts\/320\/revisions"}],"predecessor-version":[{"id":8631,"href":"https:\/\/www.redline13.com\/blog\/wp-json\/wp\/v2\/posts\/320\/revisions\/8631"}],"wp:attachment":[{"href":"https:\/\/www.redline13.com\/blog\/wp-json\/wp\/v2\/media?parent=320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.redline13.com\/blog\/wp-json\/wp\/v2\/categories?post=320"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.redline13.com\/blog\/wp-json\/wp\/v2\/tags?post=320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}