Just to add, I am not sure if this is due to concurrent file access. Please check the attached screenshot of the console logs. There it is saying Test Run 5 but the AirInvoiceServiceTest contains only 1 test. And also the report shows random data. For example, sometimes it says Test Run 5 , sometimes it says Test Run 2, etc.
On Wed, Sep 13, 2023 at 12:11 PM Debraj Manna <[email protected]> wrote: > I am using a surefire dependency like below. Do I have to add anything in > the plugin dependency for running tests in parallel using Junit5? > > <plugin> > <groupId>org.apache.maven.plugins</groupId> > <artifactId>maven-surefire-plugin</artifactId> > <version>3.1.2</version> > </plugin> > > I will see if I can reproduce it in a small project. In the meantime, if I > can share some debug logs from surefire which can help in debugging the > issue let me know, and I can do that. > > Also, if there are any open issues related to this in Surefire, can you > please share its link so that I can track them on my end? > > On Wed, Sep 13, 2023 at 2:19 AM Olivier Lamy <[email protected]> wrote: > >> I'm using surefire 3.1.2 and junit 5.9.3 (Oh I have to upgrade :) ) >> If you have a simple reproducer project, this would help >> >> On Wed, 13 Sept 2023 at 04:07, Debraj Manna <[email protected]> >> wrote: >> > >> > I am still facing the issue with >> > junit.jupiter.execution.parallel.config.fixed.parallelism=3, JUnit5 >> Version >> > = 5.10.0 and surefire 3.1.2 >> > >> > On Tue, Sep 12, 2023 at 6:34 PM Debraj Manna <[email protected]> >> > wrote: >> > >> > > Olivier >> > > >> > > Can you please let me know what version of Surefire and JUnit5 you are >> > > using? >> > > >> > > Thanks >> > > >> > > On Tue, Sep 12, 2023 at 5:16 PM Olivier Lamy <[email protected]> >> wrote: >> > > >> > >> Maybe concurrent access to files in surefire >> > >> I'm using this extensively but only with 3 max parallel test. >> > >> Can you try >> > >> junit.jupiter.execution.parallel.config.fixed.parallelism=3 >> > >> And see if you still have the issues. >> > >> If not and if increasing this number is causing the issue. This sound >> > >> like a concurrent flle access issue with surefire. >> > >> >> > >> On Tue, 12 Sept 2023 at 18:02, Debraj Manna < >> [email protected]> >> > >> wrote: >> > >> > >> > >> > Hi >> > >> > >> > >> > I started using junit-platform.properties as suggested here. My >> > >> > configuration looks like below >> > >> > >> > >> > junit.jupiter.execution.parallel.enabled=true >> > >> > junit.jupiter.execution.parallel.config.strategy=fixed >> > >> > junit.jupiter.execution.parallel.config.fixed.parallelism=8 >> > >> > junit.jupiter.execution.parallel.mode.default=same_thread >> > >> > junit.jupiter.execution.parallel.mode.classes.default=concurrent >> > >> > >> > >> > I am observing the surefire reports that are getting generated are >> not >> > >> > correct >> > >> > >> > >> > I have a test class named >> > >> > >> com.spotnana.servicetests.backoffice.invoicing.AirInvoiceServiceTest >> > >> > contains just a single test, testAirTicketing(). >> > >> > >> > >> > But in the report file, >> > >> > >> > >> >> TEST-com.spotnana.servicetests.backoffice.invoicing.AirInvoiceServiceTest.xml >> > >> > I see like below >> > >> > >> > >> > <testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >> > >> > xsi:noNamespaceSchemaLocation=" >> > >> > >> > >> >> https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd >> > >> " >> > >> > version="3.0" >> > >> >> *name="com.spotnana.servicetests.backoffice.invoicing.AirInvoiceServiceTest" >> > >> > time="44.711" tests="2" errors="1" skipped="0" failures="0”>* >> > >> > >> > >> > … >> > >> > >> > >> > >> > >> > * <testcase name="testCrossPnrRefund" >> > >> > >> > >> >> classname="com.spotnana.servicetests.analytics.ingestion.pnr.AirServiceTest" >> > >> > time="5.789"/> <testcase name="testAirTicketing" >> > >> > >> > >> >> classname="com.spotnana.servicetests.backoffice.invoicing.AirInvoiceServiceTest" >> > >> > time="33.331”>* >> > >> > >> > >> > It seems to be picking tests from some other class like >> AirServiceTest >> > >> as >> > >> > in this case. >> > >> > >> > >> > Can someone let me know what is going wrong here? >> > >> > >> > >> > >> > >> > - Surefire Version - 3.0.0-M7 >> > >> > - JUnit Version - 5.9.3 >> > >> > >> > >> > Thanks, >> > >> > >> > >> > On 2023/05/30 06:53:21 Karl Heinz Marbaise wrote: >> > >> > > On 30.05.23 07:24, Debraj Manna wrote: >> > >> > > > Thanks, Nils for replying. >> > >> > > > >> > >> > > > In JUnit5 it looks like running tests in parallel is still an >> > >> > experimental >> > >> > > > feature. >> > >> > > >> > >> > > Technically you are correct... but it's already a long time >> there I >> > >> > > doubt that it will be removed..... >> > >> > > > So I was checking if it is possible to do the same via >> Surefire. >> > >> > > >> > >> > > I recommend to use JUnit Jupiter... >> > >> > > >> > >> > > Btw: JUnit Jupiter is available in version 5.9.3 and also >> 5.10.0-M1 is >> > >> > > available as milestone one... >> > >> > > >> > >> > > Furthermore the users guide of 5.10.0-M1 >> > >> > > ( >> > >> > >> > >> >> https://junit.org/junit5/docs/5.10.0-M1/user-guide/index.html#writing-tests-parallel-execution >> > >> > ) >> > >> > > shows that the WARNING about experimental feature has been >> removed... >> > >> > > >> > >> > > https://junit.org/junit5/docs/current/user-guide/ >> > >> > > >> > >> > > https://junit.org/junit5/ >> > >> > > >> > >> > > >> > >> > > > >> > >> > > > On Mon, May 29, 2023 at 9:05 PM Nils Breunese <[email protected]> >> > >> wrote: >> > >> > > > >> > >> > > >> I don’t have answers for your Surefire questions, but I >> wanted to >> > >> > mention >> > >> > > >> that you can also tell JUnit 5.9.2 to execute tests in >> parallel: >> > >> > > >> https://junit.org/junit5/docs/5.9.2/user-guide/index.html >> > >> > > >> >> > >> > > >> Nils. >> > >> > > >> >> > >> > > >>> Op 29 mei 2023 om 16:13 heeft Debraj Manna <[email protected]> >> > >> > > >> het volgende geschreven: >> > >> > > >>> >> > >> > > >>> I updated by command like below >> > >> > > >>> >> > >> > > >>> mvn test -Dorg.slf4j.simpleLogger.showThreadName=true >> > >> > > >>> >> > >> > > >>> But I am observing that all my test classes are being >> executed in >> > >> > > >>> ThreadStreamConsumer >> > >> > > >>> >> > >> > > >>> [ThreadedStreamConsumer] [INFO] Running >> > >> > > >>> >> com.spotnana.servicetests.profile.ProfileCreatePersonalUserTest >> > >> > > >>> ... >> > >> > > >>> [ThreadedStreamConsumer] [INFO] Running >> > >> > > >>> com.spotnana.servicetests.profile.PlanServiceTest >> > >> > > >>> >> > >> > > >>> So can someone let me know if this is the correct way of >> logging >> > >> the >> > >> > > >>> parallel execution identifier in maven output logs? If yes >> then >> > >> what >> > >> > am I >> > >> > > >>> doing wrong which is causing all test classes to execute in a >> > >> single >> > >> > > >> thread? >> > >> > > >>> >> > >> > > >>> Junit Version - 5.9.2 >> > >> > > >>> >> > >> > > >>> >> > >> > > >>>> On Mon, May 29, 2023 at 6:53 PM Debraj Manna < >> [email protected]> >> > >> > > >>>> wrote: >> > >> > > >>>> >> > >> > > >>>> I want to execute test classes concurrently in the same >> JVM. So >> > >> my >> > >> > > >>>> surefire-plugin config looks like below >> > >> > > >>>> >> > >> > > >>>> <plugin> >> > >> > > >>>> <groupId>org.apache.maven.plugins</groupId> >> > >> > > >>>> <artifactId>maven-surefire-plugin</artifactId> >> > >> > > >>>> <version>3.0.0-M7</version> >> > >> > > >>>> <configuration> >> > >> > > >>>> <systemPropertyVariables> >> > >> > > >>>> <ut.forkNumber>$${surefire.forkNumber}</ut.forkNumber> >> > >> > > >>>> </systemPropertyVariables> >> > >> > > >>>> <!--These values are chosen experimentally--> >> > >> > > >>>> <argLine> >> > >> > > >>>> -Xms512m -Xmx${surefire.max.heap} >> > >> > > >>>> -XX:MaxDirectMemorySize=${surefire.max.direct.memory} >> > >> > > >>>> -XX:MaxMetaspaceSize=${surefire.metaspace.size} >> > >> > > >>>> -XX:+HeapDumpOnOutOfMemoryError @{argLine} >> > >> > > >>>> </argLine> >> > >> > > >>>> <parallel>suitesAndClasses</parallel> >> > >> > > >>>> <perCoreThreadCount>false</perCoreThreadCount> >> > >> > > >>>> <threadCount>${surefire.threadCount}</threadCount> >> > >> > > >>>> <forkCount>1</forkCount> >> > >> > > >>>> <reuseForks>true</reuseForks> >> > >> > > >>>> </configuration> >> > >> > > >>>> </plugin> >> > >> > > >>>> >> > >> > > >>>> Can someone let me know if there is a way for me to know >> which >> > >> test >> > >> > > >>>> classes are being executed in which surefire thread? >> > >> > > >>>> >> > >> > > >> >> > >> > > > >> > >> > > >> > >> > > Mit freundlichem Gruß >> > >> > > Karl Heinz Marbaise >> > >> > > -- >> > >> > > SoftwareEntwicklung Beratung Schulung Tel.: +49 (0) 2405 / >> 415 >> > >> 893 >> > >> > > Inhaber Dipl.Ing.(FH) Karl Heinz Marbaise USt.IdNr: DE191347579 >> > >> > > Hauptstrasse 177 >> > >> > > 52146 Würselen https://www.soebes.de >> > >> > > >> > >> > > >> > >> > > >> --------------------------------------------------------------------- >> > >> > > To unsubscribe, e-mail: [email protected] >> > >> > > For additional commands, e-mail: [email protected] >> > >> > > >> > >> > > >> > >> >> > >> --------------------------------------------------------------------- >> > >> To unsubscribe, e-mail: [email protected] >> > >> For additional commands, e-mail: [email protected] >> > >> >> > >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [email protected] >> For additional commands, e-mail: [email protected] >> >>
--------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
