<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Prevent unit tests but allow integration tests in Maven in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Prevent-unit-tests-but-allow-integration-tests-in-Maven/m-p/84210#M53085</link>
    <description>&lt;P&gt;I found the simplest way to skip only surefire tests is to configure surefire (&lt;STRONG&gt;but not failsafe&lt;/STRONG&gt;) as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;&amp;lt;&lt;SPAN class=""&gt;plugin&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;&amp;lt;&lt;SPAN class=""&gt;artifactId&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;maven-surefire-plugin&lt;SPAN class=""&gt;&amp;lt;/&lt;SPAN class=""&gt;artifactId&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;&amp;lt;&lt;SPAN class=""&gt;version&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;2.14&lt;SPAN class=""&gt;&amp;lt;/&lt;SPAN class=""&gt;version&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;&amp;lt;&lt;SPAN class=""&gt;configuration&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;
        &lt;SPAN class=""&gt;&amp;lt;!-- skips surefire tests without skipping failsafe tests.
                 Property value seems to magically default to false --&amp;gt;&lt;/SPAN&gt;
        &lt;SPAN class=""&gt;&amp;lt;&lt;SPAN class=""&gt;skipTests&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;${skip.surefire.tests}&lt;SPAN class=""&gt;&amp;lt;/&lt;SPAN class=""&gt;skipTests&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;&amp;lt;/&lt;SPAN class=""&gt;configuration&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class=""&gt;&amp;lt;/&lt;SPAN class=""&gt;plugin&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;This allows you to run&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;mvn verify -Dskip.surefire.tests&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and only surefire, not failsafe, tests will be skipped; it will also run all other necessary phases including pre-integration and post-integration, and will also run the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;verify&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;goal which is required to actually&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;fail your maven build&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;if your integration tests fail.&lt;/P&gt;&lt;P&gt;Note that this redefines the property used to specify that tests should be skipped, so if you supply the canonical&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;-DskipTests=true, surefire will ignore it but failsafe will respect it, which may be unexpected, especially if you have existing builds/users specifying that flag already. A simple workaround seems to be to default&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;skip.surefire.tests&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to the value of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;skipTests&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;in your&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;lt;properties&amp;gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;section of the pom:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;&amp;lt;&lt;SPAN class=""&gt;properties&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;&amp;lt;&lt;SPAN class=""&gt;skip.surefire.tests&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;${skipTests}&lt;SPAN class=""&gt;&amp;lt;/&lt;SPAN class=""&gt;skip.surefire.tests&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class=""&gt;&amp;lt;/&lt;SPAN class=""&gt;properties&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;If you need to, you could provide an analagous parameter called&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;skip.failsafe.tests&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;for failsafe, however I haven't found it necessary - because unit tests usually run in an earlier phase, and if I want to run unit tests but not integration tests, I would run the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;test&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;phase instead of the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;verify&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;phase. Your experiences may vary!&lt;/P&gt;&lt;P&gt;These&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;skip.(surefire|failsafe).tests&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;properties should probably be integrated into surefire/failsafe code itself, but I'm not sure how much it would violate the "they're exactly the same plugin except for 1 tiny difference" ethos.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;my IDE is complaining about "cannot resolve symbol 'skipTests'" the solution was to add a line&amp;nbsp;&lt;/SPAN&gt;&amp;lt;skipTests&amp;gt;false&amp;lt;/skipTests&amp;gt;&lt;SPAN&gt;&amp;nbsp;still works with any combination of -DskipTests or -Dskip.surefire.tests as command line args seem to overwrite properties&amp;nbsp;&lt;/SPAN&gt;&lt;A title="how to get a command line property to overwrite a maven property" href="https://stackoverflow.com/questions/13708738/how-to-get-a-command-line-property-to-overwrite-a-maven-property" target="_blank" rel="noopener"&gt;stackoverflow.com/questions/13708738/…&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp; &lt;A href="https://omegle.love" target="_blank" rel="noopener"&gt;/ome&lt;/A&gt;&lt;A href="https://omglz.com" target="_blank" rel="noopener"&gt;glz&lt;/A&gt; &lt;A href="https://www.echat.date/omegle" target="_blank" rel="noopener"&gt;/echat&lt;/A&gt; you may want to add that to your solution&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Sep 2022 11:35:01 GMT</pubDate>
    <dc:creator>MatrickEganlan</dc:creator>
    <dc:date>2022-09-20T11:35:01Z</dc:date>
    <item>
      <title>Prevent unit tests but allow integration tests in Maven</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Prevent-unit-tests-but-allow-integration-tests-in-Maven/m-p/83390#M52599</link>
      <description>&lt;P&gt;I've a Maven build in which I use the SureFire plugin to run some unit tests, and the FailSafe plugin to run some integration tests. I would like a way to run just the FailSafe plugin's tests.&lt;/P&gt;&lt;P&gt;It's not a good solution for me to add different profiles or anything in the pom, because it's a multimodule build and I don't want to have to edit every module's pom.&lt;/P&gt;&lt;P&gt;There are&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;skip.tests&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;maven.test.skip&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;skipTests&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;which stop&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;all&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;tests, and&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="http://maven.apache.org/plugins/maven-failsafe-plugin/verify-mojo.html#skipITs" target="_blank" rel="noopener noreferrer"&gt;skipITs&lt;/A&gt;, which stops only the failsafe plugin.&lt;/P&gt;&lt;P&gt;So, is there a command-line flag for Maven like&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;skipITs, but instead with the functionality of "onlyITs"?&lt;/P&gt;</description>
      <pubDate>Wed, 13 Jul 2022 04:34:46 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Prevent-unit-tests-but-allow-integration-tests-in-Maven/m-p/83390#M52599</guid>
      <dc:creator>MatrickEganlan</dc:creator>
      <dc:date>2022-07-13T04:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent unit tests but allow integration tests in Maven</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Prevent-unit-tests-but-allow-integration-tests-in-Maven/m-p/83419#M52617</link>
      <description>&lt;P&gt;Skipping Tests&lt;BR /&gt;To skip running the tests for a particular project, set the skipITs property to true.&lt;/P&gt;
&lt;P&gt;&amp;lt;project&amp;gt;&lt;BR /&gt;[...]&lt;BR /&gt;&amp;lt;build&amp;gt;&lt;BR /&gt;&amp;lt;plugins&amp;gt;&lt;BR /&gt;&amp;lt;plugin&amp;gt;&lt;BR /&gt;&amp;lt;groupId&amp;gt;org.apache.maven.plugins&amp;lt;/groupId&amp;gt;&lt;BR /&gt;&amp;lt;artifactId&amp;gt;maven-failsafe-plugin&amp;lt;/artifactId&amp;gt;&lt;BR /&gt;&amp;lt;version&amp;gt;3.0.0-M7&amp;lt;/version&amp;gt;&lt;BR /&gt;&amp;lt;configuration&amp;gt;&lt;BR /&gt;&amp;lt;skipITs&amp;gt;true&amp;lt;/skipITs&amp;gt;&lt;BR /&gt;&amp;lt;/configuration&amp;gt;&lt;BR /&gt;&amp;lt;/plugin&amp;gt;&lt;BR /&gt;&amp;lt;/plugins&amp;gt;&lt;BR /&gt;&amp;lt;/build&amp;gt;&lt;BR /&gt;[...]&lt;BR /&gt;&amp;lt;/project&amp;gt;&lt;BR /&gt;You can also skip the tests via the command line by executing the following command:&lt;/P&gt;
&lt;P&gt;mvn install -DskipTests&lt;BR /&gt;Since skipTests is also supported by the Surefire Plugin, this will have the effect of not running any tests. If, instead, you want to skip only the integration tests being run by the Failsafe Plugin, you would use the skipITs property instead:&lt;/P&gt;
&lt;P&gt;mvn install -DskipITs&lt;BR /&gt;If you absolutely must, you can also use the maven.test.skip property to skip compiling the tests. maven.test.skip is honored by Surefire, Failsafe and the Compiler Plugin.&lt;/P&gt;
&lt;P&gt;mvn install -Dmaven.test.skip=true&lt;BR /&gt;Skipping by Default&lt;BR /&gt;If you want to skip tests by default but want the ability to re-enable tests from the command line, you need to go via a properties section in the pom:&lt;/P&gt;
&lt;P&gt;&amp;lt;project&amp;gt;&lt;BR /&gt;[...]&lt;BR /&gt;&amp;lt;properties&amp;gt;&lt;BR /&gt;&amp;lt;skipTests&amp;gt;true&amp;lt;/skipTests&amp;gt;&lt;BR /&gt;&amp;lt;/properties&amp;gt;&lt;BR /&gt;[...]&lt;BR /&gt;&amp;lt;build&amp;gt;&lt;BR /&gt;&amp;lt;plugins&amp;gt;&lt;BR /&gt;&amp;lt;plugin&amp;gt;&lt;BR /&gt;&amp;lt;groupId&amp;gt;org.apache.maven.plugins&amp;lt;/groupId&amp;gt;&lt;BR /&gt;&amp;lt;artifactId&amp;gt;maven-failsafe-plugin&amp;lt;/artifactId&amp;gt;&lt;BR /&gt;&amp;lt;version&amp;gt;3.0.0-M7&amp;lt;/version&amp;gt;&lt;BR /&gt;&amp;lt;configuration&amp;gt;&lt;BR /&gt;&amp;lt;skipITs&amp;gt;${skipTests}&amp;lt;/skipITs&amp;gt;&lt;BR /&gt;&amp;lt;/configuration&amp;gt;&lt;BR /&gt;&amp;lt;/plugin&amp;gt;&lt;BR /&gt;&amp;lt;/plugins&amp;gt;&lt;BR /&gt;&amp;lt;/build&amp;gt;&lt;BR /&gt;[...]&lt;BR /&gt;&amp;lt;/project&amp;gt;&lt;BR /&gt;This will allow you to run with all tests disabled by default and to run them with this command:&lt;/P&gt;
&lt;P&gt;mvn install -DskipTests=false&lt;BR /&gt;The same can be done with the skip parameter and other boolean properties of the plugin.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jul 2022 14:44:39 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Prevent-unit-tests-but-allow-integration-tests-in-Maven/m-p/83419#M52617</guid>
      <dc:creator>milliron52401</dc:creator>
      <dc:date>2022-07-15T14:44:39Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent unit tests but allow integration tests in Maven</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Prevent-unit-tests-but-allow-integration-tests-in-Maven/m-p/84210#M53085</link>
      <description>&lt;P&gt;I found the simplest way to skip only surefire tests is to configure surefire (&lt;STRONG&gt;but not failsafe&lt;/STRONG&gt;) as follows:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;&amp;lt;&lt;SPAN class=""&gt;plugin&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;&amp;lt;&lt;SPAN class=""&gt;artifactId&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;maven-surefire-plugin&lt;SPAN class=""&gt;&amp;lt;/&lt;SPAN class=""&gt;artifactId&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;&amp;lt;&lt;SPAN class=""&gt;version&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;2.14&lt;SPAN class=""&gt;&amp;lt;/&lt;SPAN class=""&gt;version&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;&amp;lt;&lt;SPAN class=""&gt;configuration&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;
        &lt;SPAN class=""&gt;&amp;lt;!-- skips surefire tests without skipping failsafe tests.
                 Property value seems to magically default to false --&amp;gt;&lt;/SPAN&gt;
        &lt;SPAN class=""&gt;&amp;lt;&lt;SPAN class=""&gt;skipTests&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;${skip.surefire.tests}&lt;SPAN class=""&gt;&amp;lt;/&lt;SPAN class=""&gt;skipTests&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;&amp;lt;/&lt;SPAN class=""&gt;configuration&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class=""&gt;&amp;lt;/&lt;SPAN class=""&gt;plugin&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;This allows you to run&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;mvn verify -Dskip.surefire.tests&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;and only surefire, not failsafe, tests will be skipped; it will also run all other necessary phases including pre-integration and post-integration, and will also run the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;verify&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;goal which is required to actually&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;STRONG&gt;fail your maven build&lt;/STRONG&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;if your integration tests fail.&lt;/P&gt;&lt;P&gt;Note that this redefines the property used to specify that tests should be skipped, so if you supply the canonical&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;-DskipTests=true, surefire will ignore it but failsafe will respect it, which may be unexpected, especially if you have existing builds/users specifying that flag already. A simple workaround seems to be to default&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;skip.surefire.tests&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;to the value of&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;skipTests&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;in your&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&amp;lt;properties&amp;gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;section of the pom:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;&amp;lt;&lt;SPAN class=""&gt;properties&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;
    &lt;SPAN class=""&gt;&amp;lt;&lt;SPAN class=""&gt;skip.surefire.tests&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;${skipTests}&lt;SPAN class=""&gt;&amp;lt;/&lt;SPAN class=""&gt;skip.surefire.tests&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;
&lt;SPAN class=""&gt;&amp;lt;/&lt;SPAN class=""&gt;properties&lt;/SPAN&gt;&amp;gt;&lt;/SPAN&gt;
&lt;/PRE&gt;&lt;P&gt;If you need to, you could provide an analagous parameter called&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;skip.failsafe.tests&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;for failsafe, however I haven't found it necessary - because unit tests usually run in an earlier phase, and if I want to run unit tests but not integration tests, I would run the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;test&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;phase instead of the&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;verify&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;phase. Your experiences may vary!&lt;/P&gt;&lt;P&gt;These&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;skip.(surefire|failsafe).tests&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;properties should probably be integrated into surefire/failsafe code itself, but I'm not sure how much it would violate the "they're exactly the same plugin except for 1 tiny difference" ethos.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;my IDE is complaining about "cannot resolve symbol 'skipTests'" the solution was to add a line&amp;nbsp;&lt;/SPAN&gt;&amp;lt;skipTests&amp;gt;false&amp;lt;/skipTests&amp;gt;&lt;SPAN&gt;&amp;nbsp;still works with any combination of -DskipTests or -Dskip.surefire.tests as command line args seem to overwrite properties&amp;nbsp;&lt;/SPAN&gt;&lt;A title="how to get a command line property to overwrite a maven property" href="https://stackoverflow.com/questions/13708738/how-to-get-a-command-line-property-to-overwrite-a-maven-property" target="_blank" rel="noopener"&gt;stackoverflow.com/questions/13708738/…&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp; &lt;A href="https://omegle.love" target="_blank" rel="noopener"&gt;/ome&lt;/A&gt;&lt;A href="https://omglz.com" target="_blank" rel="noopener"&gt;glz&lt;/A&gt; &lt;A href="https://www.echat.date/omegle" target="_blank" rel="noopener"&gt;/echat&lt;/A&gt; you may want to add that to your solution&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Sep 2022 11:35:01 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Prevent-unit-tests-but-allow-integration-tests-in-Maven/m-p/84210#M53085</guid>
      <dc:creator>MatrickEganlan</dc:creator>
      <dc:date>2022-09-20T11:35:01Z</dc:date>
    </item>
  </channel>
</rss>

