Running ActiveTestSuite from command line

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Running ActiveTestSuite from command line

JUnit - User mailing list
Hi all,
 

 I have a requirement to run the same set of tests concurrently(in separate 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've 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 there 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 3500 tests successfully in Eclipse. The issue arrises when I try to execute the 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 there 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(AttachParentTestResultProcessor.java:56)
     at org.gradle.api.internal.tasks.testing.results.AttachParentTestResultProcessor.completed(AttachParentTestResultProcessor.java:56)
     at org.gradle.api.internal.tasks.testing.junit.TestClassExecutionEventGenerator.completed(TestClassExecutionEventGenerator.java:83)
 

 There are other similar unexpected event assertions thrown during the test 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 = true
         scanForTestClasses = false
         includes = ['**/*MyActiveTestSuite.class']
       
     environment "SERVER_DIR", "."
     maxHeapSize = "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.
 

Reply | Threaded
Open this post in threaded view
|

Re: Running ActiveTestSuite from command line

JUnit - User mailing list
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, [hidden email] [junit] <
[hidden email]> wrote:

>
>
> Hi all,
>
>
> I have a requirement to run the same set of tests concurrently(in separate
> 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've
> 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 there
> 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 3500
> tests successfully in Eclipse. The issue arrises when I try to execute the
> 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 there
> 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 test
> 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 = true
>
>         scanForTestClasses = false
>
>         includes = ['**/*MyActiveTestSuite.class']
>
>
>
>     environment "SERVER_DIR", "."
>
>     maxHeapSize = "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.
>
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Running ActiveTestSuite from command line

JUnit - User mailing list
Thanks for the response, I did ask there also, no response :(
Reply | Threaded
Open this post in threaded view
|

Re: Running ActiveTestSuite from command line

JUnit - User mailing list
In reply to this post by JUnit - User mailing list
Thanks Kevin, I posted on the gradle forum before posting here, its been a few days and not responses yet!

 Is anyone aware of any ActiveTestSuite running on a command line regardless of the software invoking it, i.e. gradle/ant/etc...
Reply | Threaded
Open this post in threaded view
|

Re: Running ActiveTestSuite from command line

JUnit - User mailing list
In reply to this post by JUnit - User mailing list
Thanks Kevin,

 I posted on the Gradle forum before I posted here, its nearly been a week and no response, I don't hold out much hope :(.
 

 Is anyone aware of an ActiveTestSuite running on the command line regardless of the mechanism used to invoke it, i.e. Gradle/Ant/Etc....
Reply | Threaded
Open this post in threaded view
|

Re: Running ActiveTestSuite from command line

JUnit - User mailing list
Sorry to hear there was no response on the Gradle forum. If you can trigger
this with a simplified class and Gradle config, you can try
stackoverflow.com.

On May 3, 2017 5:38 AM, "[hidden email] [junit]" <
[hidden email]> wrote:



Thanks Kevin,

I posted on the Gradle forum before I posted here, its nearly been a week
and no response, I don't hold out much hope :(.

Is anyone aware of an ActiveTestSuite running on the command line
regardless of the mechanism used to invoke it, i.e. Gradle/Ant/Etc....