{"id":43676,"date":"2017-02-17T11:00:36","date_gmt":"2017-02-17T09:00:36","guid":{"rendered":"http:\/\/examples.javacodegeeks.com\/?p=43676"},"modified":"2019-03-21T11:07:40","modified_gmt":"2019-03-21T09:07:40","slug":"junit-group-tests-example","status":"publish","type":"post","link":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-example\/","title":{"rendered":"JUnit Group Tests Example"},"content":{"rendered":"<p>In this example we shall show users, how they can group and run their JUnit test cases. JUnit group tests example, will try to resolve issue of running multiple group tests all together. This is not a big deal in JUnit.<\/p>\n<p>This can be achieved in different ways in JUnit. It&#8217;s wide API, helps developers all around the world to achieve the flexibility to test their methods. Let&#8217;s start with the introduction of JUnit and what JUnit group tests example is all about.<\/p>\n<h2>1. Introduction<\/h2>\n<p><a href=\"http:\/\/junit.org\/junit4\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">JUnit<\/a> is very popular library among Java developers for testing the programs at unit level. JUnit provides many resources to test each and every type of method. You can test <a href=\"http:\/\/examples.javacodegeeks.com\/core-java\/junit\/junit-hello-world-example\/\" target=\"_blank\" rel=\"noopener noreferrer\">simple methods<\/a>, <a href=\"http:\/\/examples.javacodegeeks.com\/core-java\/junit\/junit-fixmethodorder-example\/\" target=\"_blank\" rel=\"noopener noreferrer\">in the order of the test cases<\/a>, <a href=\"http:\/\/examples.javacodegeeks.com\/core-java\/junit\/junit-keyboard-input-example\/\" target=\"_blank\" rel=\"noopener noreferrer\">through keyboard input<\/a> or <a href=\"http:\/\/examples.javacodegeeks.com\/core-java\/junit\/junit-multithreaded-test-example\/\" target=\"_blank\" rel=\"noopener noreferrer\">multithreaded applications<\/a><\/p>\n<p>This example will show the usage of different JUnit annotations that provides users with the ease of running the group test cases. We will be using the <a href=\"http:\/\/maven.apache.org\/\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Maven<\/a> as a dependency and build tool for this example.\n<\/p>\n<h2>2. Technologies Used<\/h2>\n<p>Following set of technologies are used for this example to work.<\/p>\n<ul>\n<li>Java<\/li>\n<li>Maven &#8211; It is used as a dependency and build tool.<\/li>\n<li>Eclipse &#8211; Users can use any IDE of their choice.<\/li>\n<li>JUnit 4.12<\/li>\n<\/ul>\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>IDE used for this example is Eclipse. Start by creating a new maven project.<br \/>\nSelect <code>File -&gt; New -&gt; Maven Project<\/code>.<br \/>\nYou will see following screen. Fill in the details as shown and click on Next button.<\/p>\n<p><figure id=\"attachment_43683\" aria-describedby=\"caption-attachment-43683\" style=\"width: 691px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/02\/junit-group-tests-1.jpg\"><img decoding=\"async\" class=\"size-full wp-image-43683\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/02\/junit-group-tests-1.jpg\" alt=\"JUnit Group Tests Example setup 1\" width=\"691\" height=\"597\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/02\/junit-group-tests-1.jpg 691w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/02\/junit-group-tests-1-300x259.jpg 300w\" sizes=\"(max-width: 691px) 100vw, 691px\" \/><\/a><figcaption id=\"caption-attachment-43683\" class=\"wp-caption-text\">Figure 1: JUnit Group Tests Example Setup 1<\/figcaption><\/figure><\/p>\n<p>On this screen, you will be asked to enter about the project. Fill all details as shown and click on Finish button.<\/p>\n<p><figure id=\"attachment_43684\" aria-describedby=\"caption-attachment-43684\" style=\"width: 730px\" class=\"wp-caption aligncenter\"><a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/02\/junit-group-tests-2.jpg\"><img decoding=\"async\" class=\"size-full wp-image-43684\" src=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/02\/junit-group-tests-2.jpg\" alt=\"JUnit Group Tests Example setup 2\" width=\"730\" height=\"666\" srcset=\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/02\/junit-group-tests-2.jpg 730w, https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/02\/junit-group-tests-2-300x274.jpg 300w\" sizes=\"(max-width: 730px) 100vw, 730px\" \/><\/a><figcaption id=\"caption-attachment-43684\" class=\"wp-caption-text\">Figure 2: JUnit Group Tests Example Setup 2<\/figcaption><\/figure><\/p>\n<p><span id=\"code\"><\/span><br \/>\nThat&#8217;s it. You are done with the project creation. We will start coding the example right away after this.<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 Group Tests Example<\/h2>\n<p>Now open <code>pom.xml<\/code> and add the following lines to it.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>pom.xml<\/em><\/span><\/p>\n<pre class=\"brush:xml\">&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<\/pre>\n<p>There are 2 approaches in JUnit to group test the methods. We will start with basic and then go with the more complicated one.<\/p>\n<p>&nbsp;<\/p>\n<ul>\n<li><a href=\"#suite\"><strong>@RunWith(Suite.class)<\/strong><\/a><\/li>\n<li><a href=\"#category\"><strong>@RunWith(Categories.class)<\/strong><\/a><\/li>\n<\/ul>\n<h3>4.1 @RunWith(Suite.class)<\/h3>\n<p>This annotation is helpful whenever we want to test multiple classes at once. In this case we do not need to run each individual class for testing. Simply run the class with <code>@RunWith(Suite.class)<\/code> annotation and it will take care of running all your test cases one by one.<br \/>\nSee the below example for more clarity.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>ClassATest.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package junitgrouptest;\n\nimport org.junit.Test;\n\npublic class ClassATest {\n\n\t@Test\n\tpublic void classA_Test1(){\n\t\tSystem.out.println(\"classA_Test1\");\n\t}\n\t\n\t@Test\n\tpublic void classA_Test2(){\n\t\tSystem.out.println(\"classA_Test2\");\n\t}\n\t\n}\n<\/pre>\n<p><span style=\"text-decoration: underline;\"><em>ClassBTest.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package junitgrouptest;\n\nimport org.junit.Test;\n\npublic class ClassBTest {\n\n\t@Test\n\tpublic void classB_Test1() {\n\t\tSystem.out.println(\"classB_Test1\");\n\t}\n\n\t@Test\n\tpublic void classB_Test2() {\n\t\tSystem.out.println(\"classB_Test2\");\n\t}\n}\n\n<\/pre>\n<p><span style=\"text-decoration: underline;\"><em>ClassCTest.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package junitgrouptest;\n\nimport org.junit.Test;\n\npublic class ClassCTest {\n\n\t@Test\n\tpublic void classC_Test1() {\n\t\tSystem.out.println(\"classC_Test1\");\n\t}\n\n\t@Test\n\tpublic void classC_Test2() {\n\t\tSystem.out.println(\"classC_Test2\");\n\t}\n}\n\n<\/pre>\n<h4>4.1.1 Test Suite<\/h4>\n<p>Now, we will create a class that will helps in running all our testcases at once.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>ClassTestSuite.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package junitgrouptest;\n\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Suite;\nimport org.junit.runners.Suite.SuiteClasses;\n\n@RunWith(Suite.class)\n@SuiteClasses({ ClassATest.class, ClassBTest.class, ClassCTest.class })\npublic class ClassTestSuite {\n\n}\n<\/pre>\n<p>When you run <code>ClassTestSuite<\/code> class, you will get the following output:<\/p>\n<pre class=\"brush:bash\">classA_Test1\nclassA_Test2\nclassB_Test1\nclassB_Test2\nclassC_Test1\nclassC_Test2\n<\/pre>\n<p>Since, we have included all our classes in <code>@SuiteClasses()<\/code> annotation, all test cases of every class runs. We can modify it to run our specific classes also.<\/p>\n<p><span id=\"category\"><\/span><br \/>\nIt is very convenient to run in these types of scenarios. But when you want more complicated test cases like some specific test cases to run from a class, or you want to run some type of test cases all together, then you need a more control over your test cases.<br \/>\nIn JUnit 4.8, the concept of <code>categories<\/code> is introduced. We will see the usage of <code>categories<\/code> in below example.[ulp id=&#8217;ODQaBEw1BIbHApZq&#8217;]<\/p>\n<h3>4.2 @RunWith(Categories.class)<\/h3>\n<p>Another way of running test suite is with <code>@RunWith(Categories.class)<\/code> annotation. This is more organized way of running your test cases. By this way, users have more control over test cases. <code>@Category<\/code> interface is used for this purpose. It works more like a marker interface, where we mark the test cases with it.<br \/>\nFor this to work, first of all we need to create interfaces according to our choices like slowTests. You can take any type of name of your choice. To understand how it works, let&#8217;s start by writing our example.<\/p>\n<p>Simple interface without any methods in it.<br \/>\n<span style=\"text-decoration: underline;\"><em>SlowTests.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package junitgrouptest;\n\npublic interface SlowTests {\n\n}\n<\/pre>\n<p><span style=\"text-decoration: underline;\"><em>PerfomanceTests.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package junitgrouptest;\n\npublic interface PerfomanceTests {\n\n}\n<\/pre>\n<p>And now make some changes in our previous classes by assigning them the category. <code>@Category<\/code> annotation can be used at both <code>method level<\/code> as well as at <code>class level<\/code>. Both cases are taken care in this example.<br \/>\nFor the sake of simplicity, we are going to show only changed code here. See the highlighted lines for changes.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>ClassATest.java<\/em><\/span><\/p>\n<pre class=\"brush:java; highlight:[3]\">...\n@Test\n@Category(PerformanceTests.class)\npublic void classA_Test1() {\n     System.out.println(\"classA_Test1\");\n}\n...\n<\/pre>\n<p><span style=\"text-decoration: underline;\"><em>ClassBTest.java<\/em><\/span><\/p>\n<pre class=\"brush:java; highlight:[3,9]\">...\n@Test\n@Category(PerformanceTests.class)\npublic void classB_Test1() {\n     System.out.println(\"classB_Test1\");\n}\n\n@Test\n@Category(SlowTests.class)\npublic void classB_Test2() {\n     System.out.println(\"classB_Test2\");\n}\n...     \n<\/pre>\n<p><span style=\"text-decoration: underline;\"><em>ClassCTest.java<\/em><\/span><\/p>\n<pre class=\"brush:java; highlight:[2]\">...\n@Category(SlowTests.class)\npublic class ClassCTest {\n...\n<\/pre>\n<h4>4.1.2 Test Suite<\/h4>\n<p>Finally, we will create Test Suites to run these test cases.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>PerformanceTestsSuite.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package junitgrouptest;\n\nimport org.junit.experimental.categories.Categories;\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Suite;\n\n@RunWith(Categories.class)\n@Categories.IncludeCategory(PerformanceTests.class)\n@Suite.SuiteClasses({ClassATest.class, ClassBTest.class, ClassCTest.class})\npublic class PerformanceTestsSuite {\n\n}\n<\/pre>\n<p>When we run this test suite, we will get the following output:<\/p>\n<pre class=\"brush:bash\">classA_Test1\nclassB_Test1\n<\/pre>\n<p>This output is self explainatory. It shows us that the test cases marked with <code>@Category(PerformanceTests.class)<\/code> annotations runs and others don&#8217;t.<\/p>\n<p><span style=\"text-decoration: underline;\"><em>SlowTestsSuite.java<\/em><\/span><\/p>\n<pre class=\"brush:java\">package junitgrouptest;\n\nimport org.junit.experimental.categories.Categories;\nimport org.junit.runner.RunWith;\nimport org.junit.runners.Suite;\n\n@RunWith(Categories.class)\n@Categories.IncludeCategory(SlowTests.class)\n@Suite.SuiteClasses({ClassATest.class, ClassBTest.class, ClassCTest.class})\npublic class SlowTestsSuite {\n\n}\n<\/pre>\n<p>When we run this test suite, we will get the following output:<\/p>\n<pre class=\"brush:bash\">classB_Test2\nclassC_Test1\nclassC_Test2\n<\/pre>\n<p>All test cases marked with <code>@Category(SlowTests.class)<\/code> annotation runs.<br \/>\nSimilarly, like <code>@Categories.IncludeCategory()<\/code> annotation, we can also exclude some test cases from running. For this we have to use <code>@Categories.ExcludeCategory()<\/code> annotation.<\/p>\n<h2>5. Conclusion<\/h2>\n<p>JUnit Group Tests example provides, the way to test the JUnit test cases in more organized way. Users have learnt how they can achieve this by using 2 scenarios.<br \/>\nFirstly, by using the <code>@RunWith(Suite.class)<\/code> annotation<br \/>\nSecondly, with the use of <code>@RunWith(Categories.class)<\/code> annotation<\/p>\n<h2>6. Download the Eclipse Project<\/h2>\n<p>This is an example of JUnit Group Tests.<\/p>\n<div class=\"download\"><strong>Download <\/strong><br \/>\nYou can download the full source code of JUnit Group Tests Example here: <a href=\"http:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2017\/02\/junitgrouptest.zip\"><strong>JunitGroupTests.zip<\/strong><\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this example we shall show users, how they can group and run their JUnit test cases. JUnit group tests example, will try to resolve issue of running multiple group tests all together. This is not a big deal in JUnit. This can be achieved in different ways in JUnit. It&#8217;s wide API, helps developers &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":[],"class_list":["post-43676","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 Group Tests Example - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"In this example we shall show users, how they can group and run their JUnit test cases. In JUnit group tests example, we will try to resolve issue of run\" \/>\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-group-tests-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"JUnit Group Tests Example - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"In this example we shall show users, how they can group and run their JUnit test cases. In JUnit group tests example, we will try to resolve issue of run\" \/>\n<meta property=\"og:url\" content=\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-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=\"2017-02-17T09:00:36+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-03-21T09:07:40+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=\"6 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-group-tests-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-example\/\"},\"author\":{\"name\":\"Vinod Kumar Kashyap\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/1d6281e8235e49b5b8614621c2445d2c\"},\"headline\":\"JUnit Group Tests Example\",\"datePublished\":\"2017-02-17T09:00:36+00:00\",\"dateModified\":\"2019-03-21T09:07:40+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-example\/\"},\"wordCount\":877,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-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-group-tests-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-example\/\",\"url\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-example\/\",\"name\":\"JUnit Group Tests Example - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg\",\"datePublished\":\"2017-02-17T09:00:36+00:00\",\"dateModified\":\"2019-03-21T09:07:40+00:00\",\"description\":\"In this example we shall show users, how they can group and run their JUnit test cases. In JUnit group tests example, we will try to resolve issue of run\",\"breadcrumb\":{\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-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-group-tests-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 Group Tests 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\/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 Group Tests Example - Java Code Geeks","description":"In this example we shall show users, how they can group and run their JUnit test cases. In JUnit group tests example, we will try to resolve issue of run","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-group-tests-example\/","og_locale":"en_US","og_type":"article","og_title":"JUnit Group Tests Example - Java Code Geeks","og_description":"In this example we shall show users, how they can group and run their JUnit test cases. In JUnit group tests example, we will try to resolve issue of run","og_url":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-example\/","og_site_name":"Examples Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2017-02-17T09:00:36+00:00","article_modified_time":"2019-03-21T09:07:40+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":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-example\/#article","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-example\/"},"author":{"name":"Vinod Kumar Kashyap","@id":"https:\/\/examples.javacodegeeks.com\/#\/schema\/person\/1d6281e8235e49b5b8614621c2445d2c"},"headline":"JUnit Group Tests Example","datePublished":"2017-02-17T09:00:36+00:00","dateModified":"2019-03-21T09:07:40+00:00","mainEntityOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-example\/"},"wordCount":877,"commentCount":0,"publisher":{"@id":"https:\/\/examples.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-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-group-tests-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-example\/","url":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-example\/","name":"JUnit Group Tests Example - Java Code Geeks","isPartOf":{"@id":"https:\/\/examples.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-example\/#primaryimage"},"image":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-example\/#primaryimage"},"thumbnailUrl":"https:\/\/examples.javacodegeeks.com\/wp-content\/uploads\/2013\/11\/junit-logo.jpg","datePublished":"2017-02-17T09:00:36+00:00","dateModified":"2019-03-21T09:07:40+00:00","description":"In this example we shall show users, how they can group and run their JUnit test cases. In JUnit group tests example, we will try to resolve issue of run","breadcrumb":{"@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/examples.javacodegeeks.com\/java-development\/core-java\/junit\/junit-group-tests-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-group-tests-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 Group Tests 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\/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\/43676","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=43676"}],"version-history":[{"count":0,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/43676\/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=43676"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=43676"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/examples.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=43676"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}