{"id":536,"date":"2020-04-11T14:53:19","date_gmt":"2020-04-11T14:53:19","guid":{"rendered":"http:\/\/learnlearn.uk\/alevelcs\/?page_id=536"},"modified":"2020-09-23T00:14:44","modified_gmt":"2020-09-23T00:14:44","slug":"choosing-test-data","status":"publish","type":"page","link":"https:\/\/learnlearn.uk\/alevelcs\/choosing-test-data\/","title":{"rendered":"Choosing Test Data"},"content":{"rendered":"<div class=\"responsive-tabs\">\n<h2 class=\"tabtitle\">Testing Data<\/h2>\n<div class=\"tabcontent\">\n\n<h3>Choosing Testing Data<\/h3>\n<p>It is important that you choose test data that simulates a wide variety of usage and especially that you choose data that tests the three types of test data:<\/p>\n<ul>\n<li>Normal<\/li>\n<li>Abnormal<\/li>\n<li>Boundary \/ Extreme<\/li>\n<\/ul>\n<p>When White Box Testing, as you have access to the source code, you should ensure that your test data covers all the possible programs paths for that function or module.<\/p>\n<p><strong>Example<\/strong><\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow: auto; width: auto; border: solid gray; border-width: .1em .1em .1em .8em; padding: .2em .6em;\">\n<pre style=\"margin: 0; line-height: 125%;\">age <span style=\"color: #333333;\">=<\/span> <span style=\"color: #007020;\">input<\/span>(<span style=\"background-color: #fff0f0;\">\"How old are you?\"<\/span>)\r\n<span style=\"color: #008800; font-weight: bold;\">if<\/span> <span style=\"color: #000000; font-weight: bold;\">not<\/span> age<span style=\"color: #333333;\">.<\/span>isdigit():\r\n    <span style=\"color: #008800; font-weight: bold;\">print<\/span>(<span style=\"background-color: #fff0f0;\">\"Age must be a whole number\"<\/span>)\r\n<span style=\"color: #008800; font-weight: bold;\">elif<\/span> <span style=\"color: #007020;\">int<\/span>(age) <span style=\"color: #333333;\">&lt;<\/span> <span style=\"color: #0000dd; font-weight: bold;\">0<\/span>:\r\n    <span style=\"color: #008800; font-weight: bold;\">print<\/span>(<span style=\"background-color: #fff0f0;\">\"Age must be greater than or equal to zero\"<\/span>)\r\n<span style=\"color: #008800; font-weight: bold;\">elif<\/span> <span style=\"color: #007020;\">int<\/span>(age) <span style=\"color: #333333;\">&lt;<\/span> <span style=\"color: #0000dd; font-weight: bold;\">10<\/span>:\r\n\t<span style=\"color: #008800; font-weight: bold;\">print<\/span>(<span style=\"background-color: #fff0f0;\">\"You are young\"<\/span>)\r\n<span style=\"color: #008800; font-weight: bold;\">elif<\/span> <span style=\"color: #007020;\">int<\/span>(age) <span style=\"color: #333333;\">&gt;<\/span> <span style=\"color: #0000dd; font-weight: bold;\">70<\/span>:\r\n\t<span style=\"color: #008800; font-weight: bold;\">print<\/span>(<span style=\"background-color: #fff0f0;\">\"You are old!\"<\/span>)\r\n<span style=\"color: #008800; font-weight: bold;\">else<\/span>:\r\n\t<span style=\"color: #008800; font-weight: bold;\">print<\/span>(<span style=\"background-color: #fff0f0;\">\"You are a normal age\"<\/span>)\r\n<\/pre>\n<\/div>\n<p>In the code above there are 5 possible paths in the program to test and so your test data should probably include values\u00a0 such as:<\/p>\n<ul>\n<li>2.5<\/li>\n<li>-1<\/li>\n<li>5<\/li>\n<li>20<\/li>\n<li>100<\/li>\n<\/ul>\n\n<\/div><h2 class=\"tabtitle\">Normal<\/h2>\n<div class=\"tabcontent\">\n\n<h3>Normal Data<\/h3>\n<p>Normal Data is data that you would usually<strong> expect<\/strong> to be input within reasonable bounds.<\/p>\n<p>For a user&#8217;s age, you would probably expect a whole number between 10 and 80<\/p>\n<p>&nbsp;<\/p>\n\n<\/div><h2 class=\"tabtitle\">Abnormal<\/h2>\n<div class=\"tabcontent\">\n\n<h3>Abnormal Test Data<\/h3>\n<p>This is test data that you would deem invalid and should be handled appropriately. It is important to use a variety of different invalid data checks.<\/p>\n<p>For a user&#8217;s age, you should check:<\/p>\n<ul>\n<li>Float style input (e.g.\u00a0 2.5)<\/li>\n<li>Character input (e.g. twenty five)<\/li>\n<li>Mixed input( e.g. 25 Years Old)<\/li>\n<li>Out of bounds input ( e.g.\u00a0 \u00a0-5\u00a0 or 300)<\/li>\n<li>Zero length string input (e.g. &#8220;&#8221;)<\/li>\n<\/ul>\n\n<\/div><h2 class=\"tabtitle\">Boundary \/ Extreme<\/h2>\n<div class=\"tabcontent\">\n\n<h3>Boundary \/ Extreme Test Data<\/h3>\n<p>Boundary test data incorporates two main areas:<\/p>\n<ul>\n<li>The data at the very limits of what is deemed normal, to ensure that is allowed (but perhaps with a warning\/notification)<\/li>\n<li>Data that sites on the boundary between two normal ranges, to ensure that the program branches correctly.<\/li>\n<\/ul>\n<p>Boundary test data is extremely important as often logical errors can be found are boundaries.<\/p>\n<p><strong>Example<\/strong><\/p>\n<p><!-- HTML generated using hilite.me --><\/p>\n<div style=\"background: #ffffff; overflow: auto; width: auto; border: solid gray; border-width: .1em .1em .1em .8em; padding: .2em .6em;\">\n<pre style=\"margin: 0; line-height: 125%;\"><span style=\"color: #008800; font-weight: bold;\">try<\/span>:\r\n\ttemp <span style=\"color: #333333;\">=<\/span> <span style=\"color: #007020;\">int<\/span>(<span style=\"color: #007020;\">input<\/span>(<span style=\"background-color: #fff0f0;\">\"What is the temperature?\"<\/span>))\r\n\t\r\n\t<span style=\"color: #008800; font-weight: bold;\">if<\/span> temp <span style=\"color: #333333;\">&lt;<\/span> <span style=\"color: #0000dd; font-weight: bold;\">0<\/span>:\r\n\t\t<span style=\"color: #008800; font-weight: bold;\">print<\/span>(<span style=\"background-color: #fff0f0;\">\"It's freezing!\"<\/span>)\r\n\t<span style=\"color: #008800; font-weight: bold;\">elif<\/span> temp <span style=\"color: #333333;\">&gt;<\/span> <span style=\"color: #0000dd; font-weight: bold;\">0<\/span>:\r\n\t\t<span style=\"color: #008800; font-weight: bold;\">print<\/span>(<span style=\"background-color: #fff0f0;\">\"It's not freezing:\"<\/span>)\r\n\t\r\n<span style=\"color: #008800; font-weight: bold;\">except<\/span>:\r\n\t<span style=\"color: #008800; font-weight: bold;\">print<\/span>(<span style=\"background-color: #fff0f0;\">\"Invalid temperature\"<\/span>)\r\n<\/pre>\n<\/div>\n<p>In the code above a subtle error has been included in the code. If the user inputs the temperature as 0, then nothing at all will be printed out. This error would be highlighted if boundary test data is included.<\/p>\n\n<\/div><h2 class=\"tabtitle\">Resources<\/h2>\n<div class=\"tabcontent\">\n\n<p><a href=\"https:\/\/docs.google.com\/document\/d\/1yW1kRRZQJ8V_UIfAMH64ckQ26177POReq1-rAsvJ_-0\/edit?usp=sharing\">Testing &amp; Maintenance Worksheet<\/a><\/p>\n<\/div><\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Choosing Testing Data It is important that you choose test data that simulates a wide variety of usage and especially that you choose data that tests the three types of test data: Normal Abnormal Boundary \/ Extreme When White Box Testing, as you have access to the source code, you should ensure that your test&hellip;&nbsp;<a href=\"https:\/\/learnlearn.uk\/alevelcs\/choosing-test-data\/\" class=\"\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">Choosing Test Data<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":70,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Choosing Test Data - A Level Computer Science<\/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:\/\/learnlearn.uk\/alevelcs\/choosing-test-data\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Choosing Test Data - A Level Computer Science\" \/>\n<meta property=\"og:description\" content=\"Choosing Testing Data It is important that you choose test data that simulates a wide variety of usage and especially that you choose data that tests the three types of test data: Normal Abnormal Boundary \/ Extreme When White Box Testing, as you have access to the source code, you should ensure that your test&hellip;&nbsp;Read More &raquo;Choosing Test Data\" \/>\n<meta property=\"og:url\" content=\"https:\/\/learnlearn.uk\/alevelcs\/choosing-test-data\/\" \/>\n<meta property=\"og:site_name\" content=\"A Level Computer Science\" \/>\n<meta property=\"article:modified_time\" content=\"2020-09-23T00:14:44+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/choosing-test-data\/\",\"url\":\"https:\/\/learnlearn.uk\/alevelcs\/choosing-test-data\/\",\"name\":\"Choosing Test Data - A Level Computer Science\",\"isPartOf\":{\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/#website\"},\"datePublished\":\"2020-04-11T14:53:19+00:00\",\"dateModified\":\"2020-09-23T00:14:44+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/choosing-test-data\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/learnlearn.uk\/alevelcs\/choosing-test-data\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/choosing-test-data\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"A Level Computer Science Home\",\"item\":\"https:\/\/learnlearn.uk\/alevelcs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Choosing Test Data\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/#website\",\"url\":\"https:\/\/learnlearn.uk\/alevelcs\/\",\"name\":\"A Level Computer Science\",\"description\":\"CIE Specification\",\"publisher\":{\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/learnlearn.uk\/alevelcs\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/#organization\",\"name\":\"A Level Computer Science\",\"url\":\"https:\/\/learnlearn.uk\/alevelcs\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2019\/09\/LearnLearnLogowhite.png\",\"contentUrl\":\"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2019\/09\/LearnLearnLogowhite.png\",\"width\":710,\"height\":98,\"caption\":\"A Level Computer Science\"},\"image\":{\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Choosing Test Data - A Level Computer Science","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:\/\/learnlearn.uk\/alevelcs\/choosing-test-data\/","og_locale":"en_GB","og_type":"article","og_title":"Choosing Test Data - A Level Computer Science","og_description":"Choosing Testing Data It is important that you choose test data that simulates a wide variety of usage and especially that you choose data that tests the three types of test data: Normal Abnormal Boundary \/ Extreme When White Box Testing, as you have access to the source code, you should ensure that your test&hellip;&nbsp;Read More &raquo;Choosing Test Data","og_url":"https:\/\/learnlearn.uk\/alevelcs\/choosing-test-data\/","og_site_name":"A Level Computer Science","article_modified_time":"2020-09-23T00:14:44+00:00","twitter_card":"summary_large_image","twitter_misc":{"Estimated reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/learnlearn.uk\/alevelcs\/choosing-test-data\/","url":"https:\/\/learnlearn.uk\/alevelcs\/choosing-test-data\/","name":"Choosing Test Data - A Level Computer Science","isPartOf":{"@id":"https:\/\/learnlearn.uk\/alevelcs\/#website"},"datePublished":"2020-04-11T14:53:19+00:00","dateModified":"2020-09-23T00:14:44+00:00","breadcrumb":{"@id":"https:\/\/learnlearn.uk\/alevelcs\/choosing-test-data\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/learnlearn.uk\/alevelcs\/choosing-test-data\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/learnlearn.uk\/alevelcs\/choosing-test-data\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"A Level Computer Science Home","item":"https:\/\/learnlearn.uk\/alevelcs\/"},{"@type":"ListItem","position":2,"name":"Choosing Test Data"}]},{"@type":"WebSite","@id":"https:\/\/learnlearn.uk\/alevelcs\/#website","url":"https:\/\/learnlearn.uk\/alevelcs\/","name":"A Level Computer Science","description":"CIE Specification","publisher":{"@id":"https:\/\/learnlearn.uk\/alevelcs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/learnlearn.uk\/alevelcs\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/learnlearn.uk\/alevelcs\/#organization","name":"A Level Computer Science","url":"https:\/\/learnlearn.uk\/alevelcs\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/learnlearn.uk\/alevelcs\/#\/schema\/logo\/image\/","url":"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2019\/09\/LearnLearnLogowhite.png","contentUrl":"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2019\/09\/LearnLearnLogowhite.png","width":710,"height":98,"caption":"A Level Computer Science"},"image":{"@id":"https:\/\/learnlearn.uk\/alevelcs\/#\/schema\/logo\/image\/"}}]}},"rttpg_featured_image_url":null,"rttpg_author":{"display_name":"learnlearnadmin","author_link":"https:\/\/learnlearn.uk\/alevelcs\/author\/learnlearnadmin\/"},"rttpg_comment":0,"rttpg_category":null,"rttpg_excerpt":"Choosing Testing Data It is important that you choose test data that simulates a wide variety of usage and especially that you choose data that tests the three types of test data: Normal Abnormal Boundary \/ Extreme When White Box Testing, as you have access to the source code, you should ensure that your test&hellip;&nbsp;Read&hellip;","_links":{"self":[{"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/pages\/536"}],"collection":[{"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/comments?post=536"}],"version-history":[{"count":4,"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/pages\/536\/revisions"}],"predecessor-version":[{"id":941,"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/pages\/536\/revisions\/941"}],"wp:attachment":[{"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/media?parent=536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}