Re: Running ActiveTestSuite from command line

"Kevin Cooney ☕ [email protected] [junit]" <[email protected]> Tue, 2 May 2017 13:12:22 -0700
Newsgroups gmane.comp.java.junit.user
Message-ID <CADW0UySjwyEqNPLaW2YSpESTL6XifaNibOqeJLTNcLJeeo17sA@mail.gmail.com>
--001a113f1eae8b29bf054e902990
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

You might want to ask on a Gradle forum.

Note that there were some thread-safety issues fixed in JUnit 4.12, so if
you are using an earlier version you may want to upgrade.

-- Kevin

On Mon, May 1, 2017 at 11:50 PM, [email protected] [junit] <
[email protected]> wrote:

>
>
> Hi all,
>
>
> I have a requirement to run the same set of tests concurrently(in separat=
e
> threads), after doing some digging about I came across ActiveTestSuite.
> I've seen some posts re an equivalent mechanism in JUnit 4, as of yet I'v=
e
> not seen a suggested out of the box supported mechanism for JUnit 4. So
> I've continued down the path of ActiveTestSuite, I'm happy to be told the=
re
> is a different mechanism now.
>
>
> So to the issues I'm having, I eventually got my test suite running, our
> custom base test classes need so updates to be thread safe. So I have two
> identical test suites added to the ActiveTestSuite and its running in 350=
0
> tests successfully in Eclipse. The issue arrises when I try to execute th=
e
> test suite on the command line. Unfortunately(for me) the test execution
> must be done via Gradle, I'm relatively new to Gradle, so I'm not sure if
> the issue I'm having is solely a Gradle JUnit integration issue or if the=
re
> is a general issue with running the test suite from the command line. I
> haven't came across any real examples of it being used from the command
> line.
>
>
> So the types of errors I'm getting seem to be unexpected JUnit lifecycle
> errors:
>
>
>
>     java.lang.AssertionError: Unexpected start event for
> test_insert_positiveFlow_allFields(my.test.MemberTest)
>
>     at org.gradle.api.internal.tasks.testing.junit.JUnitTestEventAdapter.
> testStarted(JUnitTestEventAdapter.java:56)
>
>     at org.junit.runner.notification.RunNotifier$3.notifyListener(
> RunNotifier.java:87)
>
>
>
> and
>
>
>     java.lang.AssertionError
>
>     at org.gradle.api.internal.tasks.testing.processors.
> TestOutputRedirector.setOutputOwner(TestOutputRedirector.java:49)
>
>     at org.gradle.api.internal.tasks.testing.processors.
> CaptureTestOutputTestResultProcessor.completed(
> CaptureTestOutputTestResultProcessor.java:80)
>
>     at org.gradle.api.internal.tasks.testing.results.
> AttachParentTestResultProcessor.completed(AttachParentTestResultProcesso
> r.java:56)
>
>     at org.gradle.api.internal.tasks.testing.results.
> AttachParentTestResultProcessor.completed(AttachParentTestResultProcesso
> r.java:56)
>
>     at org.gradle.api.internal.tasks.testing.junit.
> TestClassExecutionEventGenerator.completed(TestClassExecutionEventGenerat
> or.java:83)
>
>
> There are other similar unexpected event assertions thrown during the tes=
t
> execution. I've dug about a bit and can't see any examples of the
> ActiveTestSuite and Gradle(or Ant etc....) with respect to this type of
> issue.
>
>
> The task I've declared is:
>
>
>     task parallelTestSuite(type: Test){
>
>
>         //gradle.startParameter.continueOnFailure =3D true
>
>         scanForTestClasses =3D false
>
>         includes =3D ['**/*MyActiveTestSuite.class']
>
>
>
>     environment "SERVER_DIR", "."
>
>     maxHeapSize =3D "1024m"
>
>
>     workingDir "../../"
>
>     afterTest { desc, result ->
>
>     println "Executing test ${desc.name} [${desc.className}] with result:
> ${result.resultType}"
>
>     }
>
>
>     }
>
>
> I've tried setting the fork behaviour but to be honest the default
> configuration is what I want, i.e. parallel threads in the same JVM. Any
> help much appreciated
>
>
> Thanks.
>
>
>=20
>

--001a113f1eae8b29bf054e902990
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable





<head>

<style type=3D"text/css">
<!--

/* start of attachment style */
       .ygrp-photo-title{
         clear: both;
         font-size: smaller;
         height: 15px;
         overflow: hidden;
         text-align: center;
         width: 75px;
       }
       div.ygrp-photo{
         background-position: center;
         background-repeat: no-repeat;
         background-color: white;
         border: 1px solid black;
         height: 62px;
         width: 62px;
       }

       div.photo-title=20
         a,
         div.photo-title a:active,
         div.photo-title a:hover,
         div.photo-title a:visited {
           text-decoration: none;=20
       }

       div.attach-table div.attach-row {
         clear: both;
       }

       div.attach-table div.attach-row div {
         float: left;
         /* margin: 2px;*/
       }

       p {
         clear: both;
         padding: 15px 0 3px 0;
	 overflow: hidden;
       }

       div.ygrp-file {
         width: 30px;
         valign: middle;
       }
       div.attach-table div.attach-row div div a {
         text-decoration: none;
       }

       div.attach-table div.attach-row div div span {
         font-weight: normal;
       }

       div.ygrp-file-title {
         font-weight: bold;
       }
 /* end of attachment style */
        -->
        </style>
        </head>
<html>
<head>
<style type=3D"text/css">
<!--
#ygrp-mkp {
  border: 1px solid #d8d8d8;
  font-family: Arial;
  margin: 10px 0;
  padding: 0 10px;
}

#ygrp-mkp hr {
  border: 1px solid #d8d8d8;
}

#ygrp-mkp #hd {
  color: #628c2a;
  font-size: 85%;
  font-weight: 700;
  line-height: 122%;
  margin: 10px 0;
}

#ygrp-mkp #ads {
  margin-bottom: 10px;
}

#ygrp-mkp .ad {
  padding: 0 0;
}

#ygrp-mkp .ad p {
  margin: 0;
}

#ygrp-mkp .ad a {
  color: #0000ff;
  text-decoration: none;
}
-->
</style>
</head>
<body>



<!-- |**|begin egp html banner|**| -->

<br><br>

<!-- |**|end egp html banner|**| -->


<div dir=3D"ltr">You might want to ask on a Gradle forum.<div><br></div><di=
v>Note that there were some thread-safety issues fixed in JUnit 4.12, so if=
 you are using an earlier version you may want to upgrade.</div><div class=
=3D"gmail_extra"><div><div class=3D"gmail_signature" data-smartmail=3D"gmai=
l_signature"><br>-- Kevin<br></div></div>
<br><div class=3D"gmail_quote">On Mon, May 1, 2017 at 11:50 PM, <a href=3D"=
mailto:[email protected]">[email protected]</a> [junit] <=
span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]" target=3D"_bl=
ank">[email protected]</a>&gt;</span> wrote:<br><blockquote class=3D"gm=
ail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-le=
ft:1ex">


<u></u>









=20
<div style=3D"background-color:#fff">
<span style=3D"display:none">=C2=A0</span>


<div id=3D"m_5805016091483623086ygrp-mlmsg">
  <div id=3D"m_5805016091483623086ygrp-msg">


    <div id=3D"m_5805016091483623086ygrp-text">
=20=20=20=20=20=20
=20=20=20=20=20=20
      <p></p><p>Hi all,</p><p><br></p><p>I have a requirement to run the sa=
me set of tests concurrently(in separate threads), after doing some digging=
 about I came across ActiveTestSuite. I&#39;ve seen some posts re an equiva=
lent mechanism in JUnit 4, as of yet I&#39;ve not seen a suggested out of t=
he box supported mechanism for JUnit 4. So I&#39;ve continued down the path=
 of ActiveTestSuite, I&#39;m happy to be told there is a different mechanis=
m now.</p><p><br></p><p>So to the issues I&#39;m having, I eventually got m=
y test suite running, our custom base test classes need so updates to be th=
read safe. So I have two identical test suites added to the ActiveTestSuite=
 and its running in 3500 tests successfully in Eclipse. The issue arrises w=
hen I try to execute the test suite on the command line. Unfortunately(for =
me) the test execution must be done via Gradle, I&#39;m relatively new to G=
radle, so I&#39;m not sure if the issue I&#39;m having is solely a Gradle J=
Unit integration issue or if there is a general issue with running the test=
 suite from the command line. I haven&#39;t came across any real examples o=
f it being used from the command line.</p><p><br></p><p>So the types of err=
ors I&#39;m getting seem to be unexpected JUnit lifecycle errors:</p><p><br=
></p><p><br></p><p><span style=3D"font-style:italic">=C2=A0 =C2=A0 java.lan=
g.AssertionError: Unexpected start event for test_insert_positiveFlow_<wbr>=
allFields(my.test.MemberTest)</span></p><p><span style=3D"font-style:italic=
">=C2=A0 =C2=A0 <span class=3D"m_5805016091483623086Apple-tab-span" style=
=3D"white-space:pre-wrap">	</span>at org.gradle.api.internal.tasks.<wbr>tes=
ting.junit.<wbr>JUnitTestEventAdapter.<wbr>testStarted(<wbr>JUnitTestEventA=
dapter.java:56)</span></p><p><span style=3D"font-style:italic">=C2=A0 =C2=
=A0 <span class=3D"m_5805016091483623086Apple-tab-span" style=3D"white-spac=
e:pre-wrap">	</span>at org.junit.runner.notification.<wbr>RunNotifier$3.not=
ifyListener(<wbr>RunNotifier.java:87</span>)</p><p><br></p><p><br></p><p>an=
d=C2=A0</p><p><br></p><p><span style=3D"font-style:italic">=C2=A0 =C2=A0 ja=
va.lang.AssertionError</span></p><p><span style=3D"font-style:italic">=C2=
=A0 =C2=A0 <span class=3D"m_5805016091483623086Apple-tab-span" style=3D"whi=
te-space:pre-wrap">	</span>at org.gradle.api.internal.tasks.<wbr>testing.pr=
ocessors.<wbr>TestOutputRedirector.<wbr>setOutputOwner(<wbr>TestOutputRedir=
ector.java:49)</span></p><p><span style=3D"font-style:italic">=C2=A0 =C2=A0=
 <span class=3D"m_5805016091483623086Apple-tab-span" style=3D"white-space:p=
re-wrap">	</span>at org.gradle.api.internal.tasks.<wbr>testing.processors.<=
wbr>CaptureTestOutputTestResultPro<wbr>cessor.completed(<wbr>CaptureTestOut=
putTestResultPro<wbr>cessor.java:80)</span></p><p><span style=3D"font-style=
:italic">=C2=A0 =C2=A0 <span class=3D"m_5805016091483623086Apple-tab-span" =
style=3D"white-space:pre-wrap">	</span>at org.gradle.api.internal.tasks.<wb=
r>testing.results.<wbr>AttachParentTestResultProcesso<wbr>r.completed(<wbr>=
AttachParentTestResultProcesso<wbr>r.java:56)</span></p><p><span style=3D"f=
ont-style:italic">=C2=A0 =C2=A0 <span class=3D"m_5805016091483623086Apple-t=
ab-span" style=3D"white-space:pre-wrap">	</span>at org.gradle.api.internal.=
tasks.<wbr>testing.results.<wbr>AttachParentTestResultProcesso<wbr>r.comple=
ted(<wbr>AttachParentTestResultProcesso<wbr>r.java:56)</span></p><p><span s=
tyle=3D"font-style:italic">=C2=A0 =C2=A0 <span class=3D"m_58050160914836230=
86Apple-tab-span" style=3D"white-space:pre-wrap">	</span>at org.gradle.api.=
internal.tasks.<wbr>testing.junit.<wbr>TestClassExecutionEventGenerat<wbr>o=
r.completed(<wbr>TestClassExecutionEventGenerat<wbr>or.java:83)</span></p><=
p><br></p><p>There are other similar unexpected event assertions thrown dur=
ing the test execution. I&#39;ve dug about a bit and can&#39;t see any exam=
ples of the ActiveTestSuite and Gradle(or Ant etc....) with respect to this=
 type of issue.=C2=A0</p><p><br></p><p>The task I&#39;ve declared is:</p><p=
><br></p><p><span style=3D"font-style:italic">=C2=A0 =C2=A0 task parallelTe=
stSuite(type: Test){</span></p><p><span style=3D"font-style:italic"><br></s=
pan></p><p><span style=3D"font-style:italic">=C2=A0 =C2=A0 =C2=A0 =C2=A0 //=
gradle.startParameter.<wbr>continueOnFailure =3D true</span></p><p><span st=
yle=3D"font-style:italic">=C2=A0 =C2=A0 =C2=A0 =C2=A0 scanForTestClasses =
=3D false</span></p><p><span style=3D"font-style:italic">=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 includes =3D [&#39;**/*MyActiveTestSuite.class&#39;<wbr>]</span>=
</p><p><span style=3D"font-style:italic">=C2=A0 =C2=A0 =C2=A0 <span class=
=3D"m_5805016091483623086Apple-tab-span" style=3D"white-space:pre-wrap">	</=
span></span></p><p><span style=3D"font-style:italic">=C2=A0 =C2=A0 <span cl=
ass=3D"m_5805016091483623086Apple-tab-span" style=3D"white-space:pre-wrap">=
	</span>environment &quot;SERVER_DIR&quot;, &quot;.&quot;</span></p><p><spa=
n style=3D"font-style:italic">=C2=A0 =C2=A0 <span class=3D"m_58050160914836=
23086Apple-tab-span" style=3D"white-space:pre-wrap">	</span>maxHeapSize =3D=
 &quot;1024m&quot;</span></p><p><span style=3D"font-style:italic"><br></spa=
n></p><p><span style=3D"font-style:italic">=C2=A0 =C2=A0 <span class=3D"m_5=
805016091483623086Apple-tab-span" style=3D"white-space:pre-wrap">	</span>wo=
rkingDir &quot;../../&quot;</span></p><p><span style=3D"font-style:italic">=
=C2=A0 =C2=A0 <span class=3D"m_5805016091483623086Apple-tab-span" style=3D"=
white-space:pre-wrap">	</span>afterTest { desc, result -&gt;</span></p><p><=
span style=3D"font-style:italic">=C2=A0 =C2=A0 <span class=3D"m_58050160914=
83623086Apple-tab-span" style=3D"white-space:pre-wrap">		</span>println &qu=
ot;Executing test ${<a href=3D"http://desc.name" target=3D"_blank">desc.nam=
e</a>} [${desc.className}] with result: ${result.resultType}&quot;</span></=
p><p><span style=3D"font-style:italic">=C2=A0 =C2=A0 <span class=3D"m_58050=
16091483623086Apple-tab-span" style=3D"white-space:pre-wrap">	</span>}</spa=
n></p><p><span style=3D"font-style:italic"><br></span></p><p><span style=3D=
"font-style:italic">=C2=A0 =C2=A0 }</span></p><p><br></p><p>I&#39;ve tried =
setting the fork behaviour but to be honest the default configuration is wh=
at I want, i.e. parallel threads in the same JVM. Any help much appreciated=
</p><p><br></p><p><span></span></p><p>Thanks.</p><p><span><br class=3D"m_58=
05016091483623086yui-cursor"></span></p><p></p>

    </div>
=20=20=20=20=20

=20=20=20=20
    <div style=3D"color:#fff;height:0"></div>


</div>



=20=20






</blockquote></div><br></div></div>




<!-- |**|begin egp html banner|**| -->

<br>


<br>

<!-- |**|end egp html banner|**| -->


<div width=3D"1" style=3D"color: white; clear: both;"/>__._,_.___</div>

=20=20=20=20=20=20
=20=20

=20=20=20=20
    <div id=3D"fromDMARC" style=3D"clear:both; margin-top: 10px;">
         <hr style=3D"height:2px ; border-width:0; color:#E3E3E3; backgroun=
d-color:#E3E3E3;">
         Posted by: =3D?UTF-8?Q?Kevin_Cooney_=3DE2=3D98=3D95?=3D &lt;kcoone=
[email protected]&gt;         <hr style=3D"height:2px ; border-width:0; color:#E3=
E3E3; background-color:#E3E3E3;">
    </div>
<!-- Start Recommendations -->
<!-- End Recommendations -->



<!-- |**|begin egp html banner|**| -->

  <img src=3D"http://geo.yahoo.com/serv?s=3D97476590/grpId=3D2423328/grpspI=
d=3D1705006905/msgId=3D24766/stime=3D1493756792" width=3D"1" height=3D"1"> =
<br>

<!-- |**|end egp html banner|**| -->

=20=20
<!-- |**|begin egp html banner|**| -->

<br>



=20=20=20
=20=20=20=20=20
=20
        <!-- |**|begin egp html banner|**| -->
        <div id=3D"ygrp-vital" style=3D"background-color: #f2f2f2; font-fam=
ily: Verdana; font-size: 10px; margin-bottom: 10px; padding: 10px;">

        <span id=3D"vithd" style=3D"font-weight: bold; color: #333; text-tr=
ansform: uppercase; "><a href=3D"https://groups.yahoo.com/neo/groups/junit/=
info;_ylc=3DX3oDMTJlbmxnN3ExBF9TAzk3MzU5NzE0BGdycElkAzI0MjMzMjgEZ3Jwc3BJZAM=
xNzA1MDA2OTA1BHNlYwN2dGwEc2xrA3ZnaHAEc3RpbWUDMTQ5Mzc1Njc5Mg--" style=3D"tex=
t-decoration: none;">Visit Your Group</a></span>

     <ul style=3D"list-style-type: none; margin: 0; padding: 0; display: in=
line;">
            <li style=3D"border-right: 1px solid #000; font-weight: 700; di=
splay: inline; padding: 0 5px; margin-left: 0;">
      <span class=3D"cat"><a href=3D"https://groups.yahoo.com/neo/groups/ju=
nit/members/all;_ylc=3DX3oDMTJmZnI4djg5BF9TAzk3MzU5NzE0BGdycElkAzI0MjMzMjgE=
Z3Jwc3BJZAMxNzA1MDA2OTA1BHNlYwN2dGwEc2xrA3ZtYnJzBHN0aW1lAzE0OTM3NTY3OTI-" s=
tyle=3D"text-decoration: none;">New Members</a></span>
      <span class=3D"ct" style=3D"color: #ff7900;">3</span>
    </li>
                                              </ul>
  </div>


<div id=3D"ft" style=3D"font-family: Arial; font-size: 11px; margin-top: 5p=
x; padding: 0 2px 0 0; clear: both;">
  <a href=3D"https://groups.yahoo.com/neo;_ylc=3DX3oDMTJkMWJka2thBF9TAzk3ND=
c2NTkwBGdycElkAzI0MjMzMjgEZ3Jwc3BJZAMxNzA1MDA2OTA1BHNlYwNmdHIEc2xrA2dmcARzd=
GltZQMxNDkzNzU2Nzky" style=3D"float: left;"><img src=3D"http://l.yimg.com/r=
u/static/images/yg/img/email/new_logo/logo-groups-137x15.png" height=3D"15"=
 width=3D"137" alt=3D"Yahoo! Groups" style=3D"border: 0;"/></a>
  <div style=3D"color: #747575; float: right;"> &bull; <a href=3D"https://i=
nfo.yahoo.com/privacy/us/yahoo/groups/details.html" style=3D"text-decoratio=
n: none;">Privacy</a> &bull; <a href=3D"mailto:junit-unsubscribe@yahoogroup=
s.com?subject=3DUnsubscribe" style=3D"text-decoration: none;">Unsubscribe</=
a> &bull; <a href=3D"https://info.yahoo.com/legal/us/yahoo/utos/terms/" sty=
le=3D"text-decoration: none;">Terms of Use</a> </div>
</div>

<!-- |**|end egp html banner|**| -->

  </div> <!-- ygrp-msg -->

=20=20=20


  <br>

<!-- |**|end egp html banner|**| -->


<div style=3D"color: white; clear: both;"/>__,_._,___</div>
</body>

</html>

--001a113f1eae8b29bf054e902990--