{"id":47972,"date":"2017-06-26T11:00:47","date_gmt":"2017-06-26T08:00:47","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=47972"},"modified":"2019-03-20T13:48:45","modified_gmt":"2019-03-20T11:48:45","slug":"junit-run-tests-in-parallel","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/","title":{"rendered":"JUnit Run Tests in Parallel"},"content":{"rendered":"<p>In this example, we will show you the usage of JUnit while running test in parallel. We have seen lots of cases where we need to run our test cases in parallel. There might be multiple reasons for that like to run test cases in a small time or take advantage of the multi-core CPU so that all your test cases are executed fast.<\/p>\n<p>The reasons can be multiple. But when comes to the JUnit framework, it has its own way of dealing with the parallel test cases. We want our test cases to execute faster than when running one by one.<\/p>\n<p>In small examples, you will not see a significant change. But when you have a bigger application, then you have to run test cases within a specific period of time without contributing any errors.\n<\/p>\n<h2>1. Introduction<\/h2>\n<p>JUnit provides an experimental class <code>ParallelComputer<\/code>. It has various ways where we can run our test cases in parallel. We will see the detailed example below.<\/p>\n<p>We will analyze the methods that are used in our example. We will also see how we can achieve the parallel execution without the <code>ParallelComputer<\/code> class.<\/p>\n<p>There is another way i.e. to use a surefire plugin of Maven that helps us to run the test cases in parallel. We will also see how we can achieve it. But for this example, we will concentrate on the use of the class <code>ParallelComputer<\/code> of JUnit.<\/p>\n<h2>2. Technologies Used<\/h2>\n<p>We will be using the following technologies while building an example. Here we are taking the latest version of each technology.<\/p>\n<ul>\n<li><strong>Java 1.8<\/strong> \u2013 We will be using the latest version of Java. There is no specific feature of Java 1.8 that has been used.<\/li>\n<li><strong>JUnit 4.12<\/strong> \u2013 This is the main testing framework that we will be using.<\/li>\n<li><strong>Maven<\/strong> \u2013 This is the build and dependency tool for this example.<\/li>\n<li><strong>Eclipse<\/strong> \u2013 IDE for writing the code.<\/li>\n<\/ul>\n<p>For links to the latest versions and there websites visit the <a href=\"#references\"><strong>reference<\/strong><\/a> section of the tutorial. Now, we have defined the technologies to be used. Let\u2019s start the setup of our example.<\/p>\n<h2>3. Project Setup<\/h2>\n<div class=\"tip\"><strong>Tip<\/strong><br \/>\nYou may skip project creation and jump directly to the <a href=\"#code\"><strong>beginning of the example<\/strong><\/a> below.<\/div>\n<p>As you already know, we are using the Eclipse. So start by opening the Eclipse.<br \/>\nClick on the <strong>File -&gt; New -&gt; Maven Project<\/strong>.<br \/>\nYou will see the first screen as shown here. Simply check the first checkbox and click on the <strong>Next<\/strong> button.<\/p>\n<p><figure id=\"attachment_48061\" aria-describedby=\"caption-attachment-48061\" style=\"width: 725px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/06\/junitparallel-setup-1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-48061\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/06\/junitparallel-setup-1.jpg\" alt=\"JUnit Parallel Test Setup 1\" width=\"725\" height=\"503\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/06\/junitparallel-setup-1.jpg 725w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/06\/junitparallel-setup-1-300x208.jpg 300w\" sizes=\"(max-width: 725px) 100vw, 725px\" \/><\/a><figcaption id=\"caption-attachment-48061\" class=\"wp-caption-text\">Figure 1: JUnit Parallel Test Setup 1<\/figcaption><\/figure><\/p>\n<p>On this screen, fill all the details as shown here and click on the <strong>Finish<\/strong> button.<\/p>\n<p><figure id=\"attachment_48062\" aria-describedby=\"caption-attachment-48062\" style=\"width: 718px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/06\/junitparallel-setup-2.jpg\"><img decoding=\"async\" class=\"size-full wp-image-48062\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/06\/junitparallel-setup-2.jpg\" alt=\"JUnit Parallel Test Setup 2\" width=\"718\" height=\"663\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/06\/junitparallel-setup-2.jpg 718w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/06\/junitparallel-setup-2-300x277.jpg 300w\" sizes=\"(max-width: 718px) 100vw, 718px\" \/><\/a><figcaption id=\"caption-attachment-48062\" class=\"wp-caption-text\">Figure 2: JUnit Parallel Test Setup 2<\/figcaption><\/figure><\/p>\n<p>With the click of the Finish button, we are ready with the blank Maven project. To continue we have to do some changes in <code>pom.xml<\/code> file. See the next section.<\/p>\n<p>&nbsp;<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<h2>4. JUnit Parallel Test<\/h2>\n<p>Now when we are ready with the blank Maven project, we need to do some changes the <code>pom.xml<\/code> file.<\/p>\n<h3>4.1 XML Configurations<\/h3>\n<p><span style=\"text-decoration: underline;\"><em>pom.xml<\/em><\/span><\/p>\n<pre class=\"brush:xml;wrap-lines:false;highlight:[4,18,19]\">... \n&lt;dependencies&gt;\n     &lt;dependency&gt;\n         &lt;groupId&gt;junit&lt;\/groupId&gt;\n         &lt;artifactId&gt;junit&lt;\/artifactId&gt;\n         &lt;version&gt;4.12&lt;\/version&gt;\n     &lt;\/dependency&gt;\n &lt;\/dependencies&gt;\n &lt;build&gt;\n     &lt;finalName&gt;junitparallel&lt;\/finalName&gt;\n     &lt;plugins&gt;\n         &lt;plugin&gt;\n             &lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt;\n             &lt;artifactId&gt;maven-compiler-plugin&lt;\/artifactId&gt;\n             &lt;version&gt;2.5.1&lt;\/version&gt;\n             &lt;inherited&gt;true&lt;\/inherited&gt;\n             &lt;configuration&gt;\n                 &lt;source&gt;1.8&lt;\/source&gt;\n                 &lt;target&gt;1.8&lt;\/target&gt;\n             &lt;\/configuration&gt;\n         &lt;\/plugin&gt;\n     &lt;\/plugins&gt;\n &lt;\/build&gt;\n...\n<\/pre>\n<p><strong>Line 4:<\/strong> will fetch the JUnit jar from maven repository.<br \/>\n<strong>Line 18, 19:<\/strong> will simply make the project compile with a Java 1.8 version.<\/p>\n<h3>4.2 Test Classes<\/h3>\n<p>First, we will create 2 classes which have test cases that we will run.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>TestClassA.java<\/em><\/span><\/p>\n<pre class=\"brush:java;wrap-lines:false;\">package junitparallel;\n\nimport org.junit.Test;\n\npublic class TestClassA {\n\n    @Test\n    public void test_A1(){\n        System.out.println(\"Class A Test 1\");\n    }\n    \n    @Test\n    public void test_A2(){\n        System.out.println(\"Class A Test 2\");\n    }\n    \n    @Test\n    public void test_A3(){\n        System.out.println(\"Class A Test 3\");\n    }\n    \n    @Test\n    public void test_A4(){\n        System.out.println(\"Class A Test 4\");\n    }\n}\n<\/pre>\n<p><span style=\"text-decoration: underline;\"><em>TestClassB.java<\/em><\/span><\/p>\n<pre class=\"brush:java;wrap-lines:false\">package junitparallel;\n\nimport org.junit.Test;\n\npublic class TestClassB {\n\n    @Test\n    public void test_B1() {\n        System.out.println(\"Class B Test 1\");\n    }\n\n    @Test\n    public void test_B2() {\n        System.out.println(\"Class B Test 2\");\n    }\n    \n    @Test\n    public void test_B3() {\n        System.out.println(\"Class B Test 3\");\n    }\n\n    @Test\n    public void test_B4() {\n        System.out.println(\"Class B Test 4\");\n    }\n}\n\n<\/pre>\n<p>These are simple classes with methods having print statements. We will see further that when we run these classes without parallel functionality, then they will run one by one.<\/p>\n<p>Let&#8217;s create a test suite to run the above test cases.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>TestSuiteSimple.java<\/em><\/span><\/p>\n<pre class=\"brush:java;wrap-lines:false\">package junitparallel;\n\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Suite;\nimport org.junit.runners.Suite.SuiteClasses;\n\n@RunWith(Suite.class)\n@SuiteClasses({ TestClassA.class, TestClassB.class })\npublic class TestSuiteSimple {\n\n}\n<\/pre>\n<p>So, once you run the above class you will see the following output in the console.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Output<\/em><\/span><\/p>\n<pre class=\"brush:bash;wrap-lines:false;\">Class A Test 1\nClass A Test 2\nClass A Test 3\nClass A Test 4\nClass B Test 1\nClass B Test 2\nClass B Test 3\nClass B Test 4\n<\/pre>\n<p>As you can see, all test cases have been executed one by one. All test cases of <code>TestClassA<\/code> were executed first and then the test cases of the <code>TestClassB<\/code>.<\/p>\n<p>Let&#8217;s see the parallel case now.<\/p>\n<h3>4.3 JUnit Parallel Tests<\/h3>\n<p>Now, we will create a class that will run the test cases parallel.<br \/>\nHere we will be using the experimental <code>ParallelComputer<\/code> class of the JUnit. We will see that <code>ParallelComputer<\/code> has different ways of running.[ulp id=&#8217;ODQaBEw1BIbHApZq&#8217;]<\/p>\n<p><span style=\"text-decoration: underline;\"><em>TestClassParallel.java<\/em><\/span><\/p>\n<pre class=\"brush:java;wrap-lines:false;highlight:[14,19,24]\">package junitparallel;\n\nimport org.junit.Test;\nimport org.junit.experimental.ParallelComputer;\nimport org.junit.runner.JUnitCore;\n\npublic class TestClassParallel {\n\n    @Test\n    public void test() {\n        Class[] cls = { TestClassA.class, TestClassB.class };\n\n        \/\/ Parallel among classes\n        JUnitCore.runClasses(ParallelComputer.classes(), cls);\n\n        System.out.println(\"----------------------------\");\n        \n        \/\/ Parallel among methods in a class\n        JUnitCore.runClasses(ParallelComputer.methods(), cls);\n\n        System.out.println(\"----------------------------\");\n        \n        \/\/ Parallel all methods in all classes\n        JUnitCore.runClasses(new ParallelComputer(true, true), cls);\n    }\n}\n<\/pre>\n<p><strong>Line 14:<\/strong> will run the classes in parallel while running test cases.<br \/>\n<strong>Line 19:<\/strong> will run the methods of same classes parallel.<br \/>\n<strong>Line 24:<\/strong> will run all methods in all classes in parallel. Here the first parameter will let us know that we need to run classes in parallel, while the second parameter specifies the methods to run in parallel.<\/p>\n<p>Once we run the above class we will see the following output.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>Output<\/em><\/span><\/p>\n<pre class=\"brush:bash;wrap-lines:false;\">Class B Test 1\nClass A Test 1\nClass A Test 2\nClass B Test 2\nClass A Test 3\nClass B Test 3\nClass A Test 4\nClass B Test 4\n----------------------------\nClass A Test 1\nClass A Test 2\nClass A Test 3\nClass A Test 4\nClass B Test 1\nClass B Test 2\nClass B Test 3\nClass B Test 4\n----------------------------\nClass A Test 1\nClass A Test 2\nClass B Test 1\nClass B Test 2\nClass B Test 3\nClass A Test 4\nClass B Test 4\nClass A Test 3\n\n<\/pre>\n<p>From the above output, we can see how both classes run in parallel.<\/p>\n<h2>5. Using the surefire plugin<\/h2>\n<p>If you do not want to go with the <code>ParallelComputer<\/code> class then you can use the surefire plugin of maven.<br \/>\nSimply put the below line in the <code>pom.xml<\/code> file.<\/p>\n<pre class=\"brush:xml;wrap-lines:false;highlight:[9,10]\">...\n&lt;build&gt;\n    &lt;plugins&gt;\n        &lt;plugin&gt;\n            &lt;groupId&gt;org.apache.maven.plugins&lt;\/groupId&gt;\n            &lt;artifactId&gt;maven-surefire-plugin&lt;\/artifactId&gt;\n            &lt;version&gt;2.7.1&lt;\/version&gt;\n            &lt;configuration&gt;\n                &lt;parallel&gt;classes&lt;\/parallel&gt;\n                &lt;threadCount&gt;5&lt;\/threadCount&gt;\n            &lt;\/configuration&gt;\n        &lt;\/plugin&gt;\n    &lt;\/plugins&gt;\n&lt;\/build&gt;\n...\n<\/pre>\n<p><strong>Line 9:<\/strong> specifies that we want to run our classes parallel while testing. We can also specify the methods instead of classes if we want to run methods parallel and not classes. See below:<\/p>\n<pre class=\"brush:xml;wrap-lines:false;\">...\n&lt;parallel&gt;methods&lt;\/parallel&gt;\n...\n<\/pre>\n<p><strong>Line 10:<\/strong> specifies the number of threads to be generated while running our test cases. This facility is not available when we use <code>ParalleComputer<\/code> class.<\/p>\n<p>This way you do not have to handle anything and is automatically handled by the surefire plugin.<\/p>\n<h2>6. Conclusion<\/h2>\n<p>There are 2 ways to run our test cases in parallel.<\/p>\n<ol>\n<li>To use JUnit ParalelComputer class<\/li>\n<li>Use of surefire plugin of Maven<\/li>\n<\/ol>\n<p>In both cases, we have choices of running the test cases in parallel. You can go either way. If you love to code and want to everything on Java then go with the ParalelComputer else you can use the surefire plugin way. Either way is good and depends on the developer.<\/p>\n<h2>7. Download the Eclipse Project<\/h2>\n<p>This is an example of JUnit Parallel Tests.<\/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\/2017\/06\/junitparallel.zip\"><strong>JUnitParallelTest.zip<\/strong><\/a><\/div>\n<h2><a name=\"references\"><\/a>8. References<\/h2>\n<ol>\n<li><a href=\"http:\/\/junit.org\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><strong>JUnit Framework<\/strong><\/a><\/li>\n<li><a href=\"http:\/\/maven.apache.org\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\"><strong>Maven<\/strong><\/a><\/li>\n<li><a href=\"https:\/\/examples.javacodegeeks.com\/core-java\/junit\/junit-report-generation-example\/\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>JUnit Report Generation<\/strong><\/a> &#8211; for use of surefire plugin<\/li>\n<li><a href=\"https:\/\/examples.javacodegeeks.com\/category\/core-java\/junit\/\" target=\"_blank\" rel=\"noopener noreferrer\"><strong>Java Code Geeks JUnit Examples<\/strong><\/a><\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>In this example, we will show you the usage of JUnit while running test in parallel. We have seen lots of cases where we need to run our test cases in parallel. There might be multiple reasons for that like to run test cases in a small time or take advantage of the multi-core CPU &hellip;<\/p>\n","protected":false},"author":112,"featured_media":6678,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[1032],"class_list":["post-47972","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-junit","tag-junit"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.5 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JUnit Run Tests in Parallel - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"JUnit parallel test will show you the way to run your test cases in parallel. There are 2 ways to do that in Junit i.e. ParallelComputer and surefire plugin\" \/>\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-run-tests-in-parallel\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JUnit Run Tests in Parallel - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"JUnit parallel test will show you the way to run your test cases in parallel. There are 2 ways to do that in Junit i.e. ParallelComputer and surefire plugin\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/\" \/>\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=\"2017-06-26T08:00:47+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-20T11:48:45+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=\"Vinod Kumar Kashyap\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@vinodkashyap\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Vinod Kumar Kashyap\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 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-run-tests-in-parallel\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/\"},\"author\":{\"name\":\"Vinod Kumar Kashyap\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/1d6281e8235e49b5b8614621c2445d2c\"},\"headline\":\"JUnit Run Tests in Parallel\",\"datePublished\":\"2017-06-26T08:00:47+00:00\",\"dateModified\":\"2019-03-20T11:48:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/\"},\"wordCount\":983,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg\",\"keywords\":[\"junit\"],\"articleSection\":[\"junit\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/\",\"name\":\"JUnit Run Tests in Parallel - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg\",\"datePublished\":\"2017-06-26T08:00:47+00:00\",\"dateModified\":\"2019-03-20T11:48:45+00:00\",\"description\":\"JUnit parallel test will show you the way to run your test cases in parallel. There are 2 ways to do that in Junit i.e. ParallelComputer and surefire plugin\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/#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-run-tests-in-parallel\/#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 Run Tests in Parallel\"}]},{\"@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\/1d6281e8235e49b5b8614621c2445d2c\",\"name\":\"Vinod Kumar Kashyap\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/a11634ec460c849e8631b740af1b75cb68c9c58d5c2339c21bcd95f55b9af4f5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/a11634ec460c849e8631b740af1b75cb68c9c58d5c2339c21bcd95f55b9af4f5?s=96&d=mm&r=g\",\"caption\":\"Vinod Kumar Kashyap\"},\"description\":\"Vinod is Sun Certified and love to work in Java and related technologies. Having more than 13 years of experience, he had developed software's including technologies like Java, Hibernate, Struts, Spring, HTML 5, jQuery, CSS, Web Services, MongoDB, AngularJS, AWS. He is also a JUG Leader of Chandigarh Java User Group.\",\"sameAs\":[\"http:\/\/www.vinodkashyap.com\/\",\"https:\/\/www.instagram.com\/vinodkashyap\/\",\"https:\/\/in.linkedin.com\/in\/vinodkashyap\",\"https:\/\/in.pinterest.com\/vinodkashyap\/\",\"https:\/\/x.com\/vinodkashyap\"],\"url\":\"https:\/\/examples.javacodegeeks.com\/author\/vinod-kashyap\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"JUnit Run Tests in Parallel - Java Code Geeks","description":"JUnit parallel test will show you the way to run your test cases in parallel. There are 2 ways to do that in Junit i.e. ParallelComputer and surefire plugin","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-run-tests-in-parallel\/","og_locale":"en_US","og_type":"article","og_title":"JUnit Run Tests in Parallel - Java Code Geeks","og_description":"JUnit parallel test will show you the way to run your test cases in parallel. There are 2 ways to do that in Junit i.e. ParallelComputer and surefire plugin","og_url":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2017-06-26T08:00:47+00:00","article_modified_time":"2019-03-20T11:48:45+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":"Vinod Kumar Kashyap","twitter_card":"summary_large_image","twitter_creator":"@vinodkashyap","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Vinod Kumar Kashyap","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/"},"author":{"name":"Vinod Kumar Kashyap","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/1d6281e8235e49b5b8614621c2445d2c"},"headline":"JUnit Run Tests in Parallel","datePublished":"2017-06-26T08:00:47+00:00","dateModified":"2019-03-20T11:48:45+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/"},"wordCount":983,"commentCount":1,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg","keywords":["junit"],"articleSection":["junit"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/","url":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/","name":"JUnit Run Tests in Parallel - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg","datePublished":"2017-06-26T08:00:47+00:00","dateModified":"2019-03-20T11:48:45+00:00","description":"JUnit parallel test will show you the way to run your test cases in parallel. There are 2 ways to do that in Junit i.e. ParallelComputer and surefire plugin","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-run-tests-in-parallel\/#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-run-tests-in-parallel\/#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 Run Tests in Parallel"}]},{"@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\/1d6281e8235e49b5b8614621c2445d2c","name":"Vinod Kumar Kashyap","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/a11634ec460c849e8631b740af1b75cb68c9c58d5c2339c21bcd95f55b9af4f5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/a11634ec460c849e8631b740af1b75cb68c9c58d5c2339c21bcd95f55b9af4f5?s=96&d=mm&r=g","caption":"Vinod Kumar Kashyap"},"description":"Vinod is Sun Certified and love to work in Java and related technologies. Having more than 13 years of experience, he had developed software's including technologies like Java, Hibernate, Struts, Spring, HTML 5, jQuery, CSS, Web Services, MongoDB, AngularJS, AWS. He is also a JUG Leader of Chandigarh Java User Group.","sameAs":["http:\/\/www.vinodkashyap.com\/","https:\/\/www.instagram.com\/vinodkashyap\/","https:\/\/in.linkedin.com\/in\/vinodkashyap","https:\/\/in.pinterest.com\/vinodkashyap\/","https:\/\/x.com\/vinodkashyap"],"url":"https:\/\/examples.javacodegeeks.com\/author\/vinod-kashyap\/"}]}},"_links":{"self":[{"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/47972","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\/112"}],"replies":[{"embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=47972"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/47972\/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=47972"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=47972"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=47972"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}