{"id":14142,"date":"2014-09-04T15:04:16","date_gmt":"2014-09-04T12:04:16","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=14142"},"modified":"2019-03-21T12:49:35","modified_gmt":"2019-03-21T10:49:35","slug":"junit-runwith-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/","title":{"rendered":"JUnit RunWith Example"},"content":{"rendered":"<p>In this example we are going to explain how to run simultaneously more than one test cases using <a href=\"http:\/\/junit.org\/\"><code>JUnit<\/code><\/a> testing framework and Eclipse IDE. This collection of different test cases that will be executed all together is otherwise called JUnit test suite and for this purpose we use the <code>@RunWith<\/code> and <code>@Suite<\/code> annotations.<\/p>\n<h2><strong>1. Create the java class to be tested<\/strong><\/h2>\n<p>Open Eclipse IDE and create a new project called <code>JunitRunWithExample<\/code>. Create a new package called <code>com.javacodegeeks.junit.suite<\/code> and then, create a java class named <code>FirstDayAtSchool.java<\/code>, which will be the class to be tested. Below is the code of the class <code>FirstDayAtSchool.java<\/code>.<\/p>\n<p>&nbsp;<br \/>\n<span style=\"text-decoration: underline\"><em>FirstDayAtSchool.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.junit.suite;\n\nimport java.util.Arrays;\n\npublic class FirstDayAtSchool {\n\tpublic String[] prepareMyBag() {\n\t\tString[] schoolbag = { \"Books\", \"Notebooks\", \"Pens\" };\n\t\tSystem.out.println(\"My school bag contains: \"\n\t\t\t\t+ Arrays.toString(schoolbag));\n\t\treturn schoolbag;\n\t}\n\n\tpublic String[] addPencils() {\n\t\tString[] schoolbag = { \"Books\", \"Notebooks\", \"Pens\", \"Pencils\" };\n\t\tSystem.out.println(\"Now my school bag contains: \"\n\t\t\t\t+ Arrays.toString(schoolbag));\n\t\treturn schoolbag;\n\t}\n}\n<\/pre>\n<p>As we can observe in the above class, there are two methods, <code>prepareMyBag()<\/code> and <code>addPencils()<\/code>, that they are just printing out the content of an array of strings.<\/p>\n<h2><strong>2. Create JUnit tests<\/strong><\/h2>\n<p>In this section, we will create the test cases for the above class. Before you create the test class, it is considered as good practice to create a new source folder dedicated to tests. For this purpose, right-click your project, select <em>New -&gt; Source Folder<\/em>, name the new source folder <code>test<\/code> and click <em>Finish<\/em>.<\/p>\n<p><figure id=\"attachment_14143\" aria-describedby=\"caption-attachment-14143\" style=\"width: 613px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/new_src_water.png\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/new_src_water.png\" alt=\"Create new source folder for junit tests.\" width=\"613\" height=\"498\" class=\"size-full wp-image-14143\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/new_src_water.png 613w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/new_src_water-300x243.png 300w\" sizes=\"(max-width: 613px) 100vw, 613px\" \/><\/a><figcaption id=\"caption-attachment-14143\" class=\"wp-caption-text\">Figure 1: Create new source folder for junit tests.<\/figcaption><\/figure><\/p>\n<p>You can also have the same result by right-clicking on your project and select <em>Properties -&gt; Java Build Path -&gt; Source<\/em> and <em>Add Folder<\/em>. You can see the result in the figure below:<\/p>\n<p><figure id=\"attachment_14156\" aria-describedby=\"caption-attachment-14156\" style=\"width: 664px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/rsz_junit4.jpg\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/rsz_junit4.jpg\" alt=\"Figure 2\" width=\"664\" height=\"421\" class=\"size-full wp-image-14156\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/rsz_junit4.jpg 664w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/rsz_junit4-300x190.jpg 300w\" sizes=\"(max-width: 664px) 100vw, 664px\" \/><\/a><figcaption id=\"caption-attachment-14156\" class=\"wp-caption-text\">Figure 2<\/figcaption><\/figure><div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<p>Now we are ready to proceed with the creation of the JUnit test classes.<br \/>\nRight-click on the class that we want to test, in this case the class named <code>FirstDayAtSchool.java<\/code> and select <em>New \u2192 JUnit Test Case<\/em>.<\/p>\n<p>In the following wizard select the New JUnit 4 test flag and select the test source folder, so that your test class will be created in this folder.<\/p>\n<p><figure id=\"attachment_14147\" aria-describedby=\"caption-attachment-14147\" style=\"width: 613px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/new_test_case_wat.png\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/new_test_case_wat.png\" alt=\"Figure 3: Create a new junit test class.\" width=\"613\" height=\"694\" class=\"size-full wp-image-14147\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/new_test_case_wat.png 613w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/new_test_case_wat-264x300.png 264w\" sizes=\"(max-width: 613px) 100vw, 613px\" \/><\/a><figcaption id=\"caption-attachment-14147\" class=\"wp-caption-text\">Figure 3: Create a new junit test class.<\/figcaption><\/figure><\/p>\n<p>If your project does not contain the JUnit library in its classpath, the following message will be displayed so as to add the JUnit library to the classpath.<\/p>\n<p><figure id=\"attachment_14228\" aria-describedby=\"caption-attachment-14228\" style=\"width: 613px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/junitlib.png\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/junitlib.png\" alt=\"Figure 4: Add JUnit library to the classpath.\" width=\"613\" height=\"328\" class=\"size-full wp-image-14228\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/junitlib.png 613w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/junitlib-300x160.png 300w\" sizes=\"(max-width: 613px) 100vw, 613px\" \/><\/a><figcaption id=\"caption-attachment-14228\" class=\"wp-caption-text\">Figure 4: Add JUnit library to the classpath.<\/figcaption><\/figure><\/p>\n<p>Also, we would like to test only the first method of this class in this specific test, so we can select <em>Next<\/em> in the wizard and choose the method <code>prepareMyBag()<\/code>.<\/p>\n<p><figure id=\"attachment_14148\" aria-describedby=\"caption-attachment-14148\" style=\"width: 614px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/junit7.png\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/junit7.png\" alt=\"Figure 4: Select methods for which test method stubs will be created.\" width=\"614\" height=\"692\" class=\"size-full wp-image-14148\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/junit7.png 614w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/junit7-266x300.png 266w\" sizes=\"(max-width: 614px) 100vw, 614px\" \/><\/a><figcaption id=\"caption-attachment-14148\" class=\"wp-caption-text\">Figure 5: Select methods for which test method stubs will be created.<\/figcaption><\/figure><\/p>\n<p>The code of the first test class which is named <code>FirstDayAtSchoolTest.java<\/code>, follows.<\/p>\n<p><span style=\"text-decoration: underline\"><em>FirstDayAtSchoolTest.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.junit.suite;\n\nimport static org.junit.Assert.*;\n\nimport org.junit.Test;\n\npublic class FirstDayAtSchoolTest {\n\n\tFirstDayAtSchool school = new FirstDayAtSchool();\n\tString[] bag = { \"Books\", \"Notebooks\", \"Pens\" };\n\n\t@Test\n\tpublic void testPrepareMyBag() {\n\t\tSystem.out.println(\"Inside testPrepareMyBag()\");\n\t\tassertArrayEquals(bag, school.prepareMyBag());\n\t}\n\n}\n<\/pre>\n<p>Following the same procedure, we create another test case for the class <code>FirstDayAtSchool.java<\/code> which is called <code>FirstDayAtSchoolTest2.java<\/code> and tests the second method of the class named <code>addPencils()<\/code>.[ulp id=&#8217;ODQaBEw1BIbHApZq&#8217;]<\/p>\n<p><span style=\"text-decoration: underline\"><em>FirstDayAtSchoolTest2.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.junit.suite;\n\nimport static org.junit.Assert.*;\n\nimport org.junit.Test;\n\npublic class FirstDayAtSchoolTest2 {\n\n\tFirstDayAtSchool school = new FirstDayAtSchool();\n\tString[] bag = { \"Books\", \"Notebooks\", \"Pens\", \"Pencils\" };\n\n\t@Test\n\tpublic void testAddPencils() {\n\t\tSystem.out.println(\"Inside testAddPencils()\");\n\t\tassertArrayEquals(bag, school.addPencils());\n\t}\n\n}\n<\/pre>\n<h2><strong>3. Create test suite using annotation @RunWith<\/strong><\/h2>\n<p>Now, we are going to create the test suite class. Right-click on the test source folder and select <em>New -&gt; Other -&gt; JUnit -&gt; JUnit Test Suite<\/em>. Then, choose the name of the suite and the test classes that will be included in the suite and click <em>Finish<\/em>.<\/p>\n<p><figure id=\"attachment_14150\" aria-describedby=\"caption-attachment-14150\" style=\"width: 613px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/test_suite.png\"><img decoding=\"async\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/test_suite.png\" alt=\"Figure 5: Create a test suite.\" width=\"613\" height=\"511\" class=\"size-full wp-image-14150\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/test_suite.png 613w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/test_suite-300x250.png 300w\" sizes=\"(max-width: 613px) 100vw, 613px\" \/><\/a><figcaption id=\"caption-attachment-14150\" class=\"wp-caption-text\">Figure 6: Create a test suite.<\/figcaption><\/figure><\/p>\n<p>The class following is the test suite of the two test classes.<\/p>\n<p><span style=\"text-decoration: underline\"><em>AllTests.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package com.javacodegeeks.junit.suite;\n\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Suite;\nimport org.junit.runners.Suite.SuiteClasses;\n\n@RunWith(Suite.class)\n@SuiteClasses({ FirstDayAtSchoolTest.class, FirstDayAtSchoolTest2.class })\npublic class AllTests {\n\n}\n<\/pre>\n<p>In the test suite, we can see that there are two annotations,<code> @RunWith<\/code> and <code>@SuiteClasses<\/code>.<br \/>\nLet&#8217;s give a short explanation of them.<\/p>\n<ul>\n<li>\n<h3><code><strong>@RunWith<\/strong><\/code><\/h3>\n<\/li>\n<\/ul>\n<p>When a class is annotated with <code>@RunWith<\/code>, JUnit will invoke the class in which is annotated so as to run the tests, instead of using the runner built into JUnit.<\/p>\n<ul>\n<li>\n<h3><code><strong>@SuiteClasses<\/strong><\/code><\/h3>\n<\/li>\n<\/ul>\n<p>The <code>@SuiteClasses<\/code> annotation specifies the classes to be executed when a class annotated with <code>@RunWith(Suite.class)<\/code> is run.<\/p>\n<p>Now we can run the test suite by right-clicking on the suite and select <em>Run As -&gt; JUnit Test<\/em>.<br \/>\nIf we run the above code, we will have the following results:<\/p>\n<ul>\n<h3>\n<li>Output:<\/li>\n<\/h3>\n<\/ul>\n<pre class=\"brush:bash\">Inside testPrepareMyBag()\nMy school bag contains: [Books, Notebooks, Pens]\nInside testAddPencils()\nNow my school bag contains: [Books, Notebooks, Pens, Pencils]\n<\/pre>\n<h2><strong>Download the source code<\/strong><\/h2>\n<p>This was an example of how to execute test suites in JUnit testing framework along with the <code>@RunWith<\/code> annotation.<\/p>\n<div class=\"download\"><strong>Download<\/strong><br \/>\nYou can download the full source code of this example here : <a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2014\/09\/JunitRunWithExample.zip\">JunitRunWithExample<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this example we are going to explain how to run simultaneously more than one test cases using JUnit testing framework and Eclipse IDE. This collection of different test cases that will be executed all together is otherwise called JUnit test suite and for this purpose we use the @RunWith and @Suite annotations. 1. Create &hellip;<\/p>\n","protected":false},"author":9,"featured_media":6678,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-14142","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-junit"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JUnit RunWith Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In this example we are going to explain how to run simultaneously more than one test cases using JUnit testing framework and Eclipse IDE. This collection\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JUnit RunWith Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In this example we are going to explain how to run simultaneously more than one test cases using JUnit testing framework and Eclipse IDE. This collection\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/\" \/>\n<meta property=\"og:site_name\" content=\"Examples Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2014-09-04T12:04:16+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-21T10:49:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Konstantina Dimtsa\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Konstantina Dimtsa\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/\"},\"author\":{\"name\":\"Konstantina Dimtsa\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/5fc06d4d50814931c15af68106832a56\"},\"headline\":\"JUnit RunWith Example\",\"datePublished\":\"2014-09-04T12:04:16+00:00\",\"dateModified\":\"2019-03-21T10:49:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/\"},\"wordCount\":664,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg\",\"articleSection\":[\"junit\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/\",\"name\":\"JUnit RunWith Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg\",\"datePublished\":\"2014-09-04T12:04:16+00:00\",\"dateModified\":\"2019-03-21T10:49:35+00:00\",\"description\":\"In this example we are going to explain how to run simultaneously more than one test cases using JUnit testing framework and Eclipse IDE. This collection\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/#primaryimage\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/examples.javacodegeeks.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java Development\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Core Java\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"junit\",\"item\":\"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/junit\/\"},{\"@type\":\"ListItem\",\"position\":5,\"name\":\"JUnit RunWith Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Examples and Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\/\/examples.javacodegeeks.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/javacodegeeks\",\"https:\/\/x.com\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/5fc06d4d50814931c15af68106832a56\",\"name\":\"Konstantina Dimtsa\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/10\/Konstantina-Dimtsa-96x96.jpg\",\"contentUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/10\/Konstantina-Dimtsa-96x96.jpg\",\"caption\":\"Konstantina Dimtsa\"},\"description\":\"Konstantina has graduated from the Department of Informatics and Telecommunications in National and Kapodistrian University of Athens (NKUA) and she is currently pursuing M.Sc studies in Advanced Information Systems at the same department. She is also working as a research associate for NKUA in the field of telecommunications. Her main interests lie in software engineering, web applications, databases and telecommunications.\",\"sameAs\":[\"http:\/\/www.javacodegeeks.com\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/konstantina-dimtsa\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JUnit RunWith Example - Java Code Geeks","description":"In this example we are going to explain how to run simultaneously more than one test cases using JUnit testing framework and Eclipse IDE. This collection","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:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/","og_locale":"en_US","og_type":"article","og_title":"JUnit RunWith Example - Java Code Geeks","og_description":"In this example we are going to explain how to run simultaneously more than one test cases using JUnit testing framework and Eclipse IDE. This collection","og_url":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2014-09-04T12:04:16+00:00","article_modified_time":"2019-03-21T10:49:35+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg","type":"image\/jpeg"}],"author":"Konstantina Dimtsa","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Konstantina Dimtsa","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/"},"author":{"name":"Konstantina Dimtsa","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/5fc06d4d50814931c15af68106832a56"},"headline":"JUnit RunWith Example","datePublished":"2014-09-04T12:04:16+00:00","dateModified":"2019-03-21T10:49:35+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/"},"wordCount":664,"commentCount":1,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg","articleSection":["junit"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/","url":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/","name":"JUnit RunWith Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg","datePublished":"2014-09-04T12:04:16+00:00","dateModified":"2019-03-21T10:49:35+00:00","description":"In this example we are going to explain how to run simultaneously more than one test cases using JUnit testing framework and Eclipse IDE. This collection","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/#primaryimage","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-runwith-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/examples.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java Development","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/"},{"@type":"ListItem","position":3,"name":"Core Java","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/"},{"@type":"ListItem","position":4,"name":"junit","item":"https:\/\/examples.javacodegeeks.com\/category\/java-development\/core-java\/junit\/"},{"@type":"ListItem","position":5,"name":"JUnit RunWith Example"}]},{"@type":"WebSite","@id":"https:\/\/examples.javacodegeeks.com\/#website","url":"https:\/\/examples.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Examples and Code Snippets","publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/examples.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/examples.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/examples.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/5fc06d4d50814931c15af68106832a56","name":"Konstantina Dimtsa","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/10\/Konstantina-Dimtsa-96x96.jpg","contentUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/10\/Konstantina-Dimtsa-96x96.jpg","caption":"Konstantina Dimtsa"},"description":"Konstantina has graduated from the Department of Informatics and Telecommunications in National and Kapodistrian University of Athens (NKUA) and she is currently pursuing M.Sc studies in Advanced Information Systems at the same department. She is also working as a research associate for NKUA in the field of telecommunications. Her main interests lie in software engineering, web applications, databases and telecommunications.","sameAs":["http:\/\/www.javacodegeeks.com"],"url":"https:\/\/examples.javacodegeeks.com\/author\/konstantina-dimtsa\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/14142","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=14142"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/14142\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media\/6678"}],"wp:attachment":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=14142"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=14142"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=14142"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}