{"id":810,"date":"2010-04-15T21:33:19","date_gmt":"2010-04-16T01:33:19","guid":{"rendered":"http:\/\/www.webperformanceinc.com\/load_testing\/blog\/?p=810"},"modified":"2012-02-01T14:35:50","modified_gmt":"2012-02-01T18:35:50","slug":"status-code-200-didnt-match-expected-304","status":"publish","type":"post","link":"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/2010\/04\/status-code-200-didnt-match-expected-304\/","title":{"rendered":"Status code 200 didn&#8217;t match expected: 304"},"content":{"rendered":"<p>Suppose you&#8217;ve got a testcase that either worked in the past, or just works sometimes, but now seems to be giving you an error: \u201cThe status code of the response (200) did not match the status code of the response in the Testcase (304)\u201d. This particular error message is probably not a serious error, but it usually means that your test isn&#8217;t quite emulating what a real browser would do.<\/p>\n<p>Fixing this problem in Load Tester is usually easy. Just right click on your testcase, select Properties, and then go to the \u201cRestart Options\u201d tab. Simply check the last checkbox: \u201cUpdate If-Modified-Since\/If-None-Match headers dynamically\u201d, and press OK.<br \/>\n<img decoding=\"async\" src=\"\/images\/blog\/304-error-testcase-ifmod-properties.png\" alt=\"Testcase Properties Dialog\" \/><\/p>\n<p>To understand this problem, let&#8217;s first take a look at the error message. \u201cdid not match the status code of the response in the Testcase (304)\u201d means Load Tester was expecting a 304, based on the original recording. A HTTP 304 means \u201cNot Modified\u201d, and is used whenever the browser is simply checking a file against a cached value. This means the browser already has the file, and is comparing the Last Modified, and\/or the ETag identifying the resource. This means that by looking backwards in the testcase, there is a good chance you&#8217;ll find the same transaction requested earlier, but where a 200 response was received, or the recording was made without having the browser&#8217;s cache automatically cleared.<\/p>\n<p>In the case where a 200 was received earlier, this response will contain the Last Modified header and\/or the ETag header which the browser will use later to check for a change in the file. By turning on the \u201cUpdate If-Modified-Since\/If-None-Match headers dynamically\u201d feature, Load Tester will automatically use the received headers from the 200 response to replace the request headers when it expects a 304.<\/p>\n<p>Without this feature turned on, there are two likely causes this failure appears:<\/p>\n<ol>\n<li>The resource has changed since the last time the testcase was recorded<\/li>\n<li>The server has changed from the one on which the testcase was recorded. In Load Balanced environments, this can mean that the Load Balancer has selected a different server for the user than it did during recording, which usually means that this error only appears occasionally.<\/li>\n<\/ol>\n<p>The Load Balanced environment also leads to another scenario \u2013 that this isn&#8217;t a testcase configuration issue at all. For environments which do not use sticky sessions, or are not performing session assignment for the resource in question, this can mean that for any browser performing a cache check, the full content of the file may be sent, even if the file hasn&#8217;t changed. In this scenario, your site is consuming bandwidth than would otherwise be required. If so, try to synchronize Last-Modified and ETag headers between your webservers. If and only if you are still willing to accept that behavior, you can remove the status code validator (on the <a href=\"https:\/\/www.webperformance.com\/support\/suite\/manual40\/Content\/ActorsView.htm\">Actors View<\/a>) to turn off the error messages and move on with your test.<\/p>\n<p>-Frank, Engineer at Web Performance, Inc.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Suppose you&#8217;ve got a testcase that either worked in the past, or just works sometimes, but now seems to be giving you an error: \u201cThe status code of the response (200) did not match the status code of the response in the Testcase (304)\u201d. This particular error message is probably not a serious error, but it usually means that your test isn&#8217;t quite emulating what a real browser would do.<br \/>\nFixing this problem in Load Tester is usually easy. Just right click on your testcase, select Properties, and then go to the \u201cRestart Options\u201d tab. Simply check the last checkbox: \u201cUpdate &hellip; <a href=\"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/2010\/04\/status-code-200-didnt-match-expected-304\/\">Continue reading &raquo;<\/a><\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[42],"tags":[49,68],"class_list":["post-810","post","type-post","status-publish","format-standard","hentry","category-load-tester-software","tag-load-tester","tag-validator"],"_links":{"self":[{"href":"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-json\/wp\/v2\/posts\/810","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-json\/wp\/v2\/comments?post=810"}],"version-history":[{"count":7,"href":"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-json\/wp\/v2\/posts\/810\/revisions"}],"predecessor-version":[{"id":3113,"href":"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-json\/wp\/v2\/posts\/810\/revisions\/3113"}],"wp:attachment":[{"href":"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-json\/wp\/v2\/media?parent=810"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-json\/wp\/v2\/categories?post=810"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.webperformance.com\/load-testing-tools\/blog\/wp-json\/wp\/v2\/tags?post=810"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}