Problem with running Spring Integration Tests with mvn verify

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

Problem with running Spring Integration Tests with mvn verify

Aleksandar Tokarev
I am having a Spring Boot application with around ~500 Tests (Unit and
mostly Integration).

When i start running the tests in IntelliJ with second click -> Run all
Tests - tests run in around 10-15mins.

When i try to run the tests with "mvn verify -P itest" in IntelliJ
terminal, the execution time is around an hour. This is because this
command starts and stops the Spring Test Runner Server on every class
(which is not my desired result).

The IntelliJ second click -> Run all Tests starts it only once. Our Jenkins
Job is running the tests with "mvn verify -P itest", so my question is how
can i change this behavior, to start and stop the Test Runner only once
(with this "mvn verify -P itest" command).

itest is the profile that we have in our pom.xml which includes the classes
that contain integration tests (using maven failsafe plugin)

Here are the annotations of our base abstract Integration Test class

@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = MainApplication.class, webEnvironment =
WebEnvironment.RANDOM_PORT)

I found this article which could by similar to my problem, but this does
not explain the behavior that IntelliJ gives me.

Reset Spring-Boot During Integration Tests
<https://stackoverflow.com/questions/44241936/reset-spring-boot-during-integration-tests>

Thanks a lot in advance
Reply | Threaded
Open this post in threaded view
|

Re: Problem with running Spring Integration Tests with mvn verify

Robert Kleinschmager-2
Hi Aleksandar,

Can you please show (attach|) your POM. Maybe your failsafe config is non-optimal.
In general: Intellij uses a different kind of junit execution, than failsafe/surefire

Kind regards
Robert

> Am 05.01.2019 um 12:20 schrieb Aleksandar Tokarev <[hidden email]>:
>
> I am having a Spring Boot application with around ~500 Tests (Unit and
> mostly Integration).
>
> When i start running the tests in IntelliJ with second click -> Run all
> Tests - tests run in around 10-15mins.
>
> When i try to run the tests with "mvn verify -P itest" in IntelliJ
> terminal, the execution time is around an hour. This is because this
> command starts and stops the Spring Test Runner Server on every class
> (which is not my desired result).
>
> The IntelliJ second click -> Run all Tests starts it only once. Our Jenkins
> Job is running the tests with "mvn verify -P itest", so my question is how
> can i change this behavior, to start and stop the Test Runner only once
> (with this "mvn verify -P itest" command).
>
> itest is the profile that we have in our pom.xml which includes the classes
> that contain integration tests (using maven failsafe plugin)
>
> Here are the annotations of our base abstract Integration Test class
>
> @RunWith(SpringJUnit4ClassRunner.class)
> @SpringBootTest(classes = MainApplication.class, webEnvironment =
> WebEnvironment.RANDOM_PORT)
>
> I found this article which could by similar to my problem, but this does
> not explain the behavior that IntelliJ gives me.
>
> Reset Spring-Boot During Integration Tests
> <https://stackoverflow.com/questions/44241936/reset-spring-boot-during-integration-tests>
>
> Thanks a lot in advance


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Problem with running Spring Integration Tests with mvn verify

Aleksandar Tokarev


On 2019/01/07 16:40:45, Robert Kleinschmager <[hidden email]> wrote:

> Hi Aleksandar,
>
> Can you please show (attach|) your POM. Maybe your failsafe config is non-optimal.
> In general: Intellij uses a different kind of junit execution, than failsafe/surefire
>
> Kind regards
> Robert
>
> > Am 05.01.2019 um 12:20 schrieb Aleksandar Tokarev <[hidden email]>:
> >
> > I am having a Spring Boot application with around ~500 Tests (Unit and
> > mostly Integration).
> >
> > When i start running the tests in IntelliJ with second click -> Run all
> > Tests - tests run in around 10-15mins.
> >
> > When i try to run the tests with "mvn verify -P itest" in IntelliJ
> > terminal, the execution time is around an hour. This is because this
> > command starts and stops the Spring Test Runner Server on every class
> > (which is not my desired result).
> >
> > The IntelliJ second click -> Run all Tests starts it only once. Our Jenkins
> > Job is running the tests with "mvn verify -P itest", so my question is how
> > can i change this behavior, to start and stop the Test Runner only once
> > (with this "mvn verify -P itest" command).
> >
> > itest is the profile that we have in our pom.xml which includes the classes
> > that contain integration tests (using maven failsafe plugin)
> >
> > Here are the annotations of our base abstract Integration Test class
> >
> > @RunWith(SpringJUnit4ClassRunner.class)
> > @SpringBootTest(classes = MainApplication.class, webEnvironment =
> > WebEnvironment.RANDOM_PORT)
> >
> > I found this article which could by similar to my problem, but this does
> > not explain the behavior that IntelliJ gives me.
> >
> > Reset Spring-Boot During Integration Tests
> > <https://stackoverflow.com/questions/44241936/reset-spring-boot-during-integration-tests>
> >
> > Thanks a lot in advance
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
> <profiles>
        <profile>
            <id>itest</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <configuration>
                            <forkCount>1</forkCount>
                            <reuseForks>false</reuseForks>
                            <argLine>${args}</argLine>
                            <testNGArtifactName>none:none</testNGArtifactName>
                            <includes>
                                <include>**/*ITests.java</include>
                                <include>**/*IntegrationTests.java</include>
                                <testFailureIgnore>true</testFailureIgnore>
                            </includes>
                            <environmentVariables>
                                <HOME>${basedir}/target/test-classes</HOME>
                                <SERVER_HOSTNAME>localhost</SERVER_HOSTNAME>
                            </environmentVariables>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

Here is the config for my Failsafe plugin.

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Problem with running Spring Integration Tests with mvn verify

Robert Kleinschmager-2
Your configuration looks fine for your task, but I’m sorry - I have no hint, why IntelliJ is faster.

At first: it depends on, how your 500 Tests are organised. How many test-classes, how many methods do they have?
Are you running JUnit4 or already Junit5? Are you using Parallel-Mode in IntelliJ?
Can you see in the logs, how many times the spring-context is created & destroyed?

Looking at the code of the Unit-Execution on Intellij [1] and surefire [2] may bring some more insights, but I’m not familiar with both of them - it would really help to debug them.

[1] https://github.com/JetBrains/intellij-community/tree/master/plugins/junit_rt <https://github.com/JetBrains/intellij-community/tree/master/plugins/junit_rt>
[2] https://github.com/apache/maven-surefire <https://github.com/apache/maven-surefire>

> Am 08.01.2019 um 14:12 schrieb [hidden email]:
>
>
>
> On 2019/01/07 16:40:45, Robert Kleinschmager <[hidden email]> wrote:
>> Hi Aleksandar,
>>
>> Can you please show (attach|) your POM. Maybe your failsafe config is non-optimal.
>> In general: Intellij uses a different kind of junit execution, than failsafe/surefire
>>
>> Kind regards
>> Robert
>>
>>> Am 05.01.2019 um 12:20 schrieb Aleksandar Tokarev <[hidden email]>:
>>>
>>> I am having a Spring Boot application with around ~500 Tests (Unit and
>>> mostly Integration).
>>>
>>> When i start running the tests in IntelliJ with second click -> Run all
>>> Tests - tests run in around 10-15mins.
>>>
>>> When i try to run the tests with "mvn verify -P itest" in IntelliJ
>>> terminal, the execution time is around an hour. This is because this
>>> command starts and stops the Spring Test Runner Server on every class
>>> (which is not my desired result).
>>>
>>> The IntelliJ second click -> Run all Tests starts it only once. Our Jenkins
>>> Job is running the tests with "mvn verify -P itest", so my question is how
>>> can i change this behavior, to start and stop the Test Runner only once
>>> (with this "mvn verify -P itest" command).
>>>
>>> itest is the profile that we have in our pom.xml which includes the classes
>>> that contain integration tests (using maven failsafe plugin)
>>>
>>> Here are the annotations of our base abstract Integration Test class
>>>
>>> @RunWith(SpringJUnit4ClassRunner.class)
>>> @SpringBootTest(classes = MainApplication.class, webEnvironment =
>>> WebEnvironment.RANDOM_PORT)
>>>
>>> I found this article which could by similar to my problem, but this does
>>> not explain the behavior that IntelliJ gives me.
>>>
>>> Reset Spring-Boot During Integration Tests
>>> <https://stackoverflow.com/questions/44241936/reset-spring-boot-during-integration-tests>
>>>
>>> Thanks a lot in advance
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>> <profiles>
>        <profile>
>            <id>itest</id>
>            <activation>
>                <activeByDefault>false</activeByDefault>
>            </activation>
>            <build>
>                <plugins>
>                    <plugin>
>                        <artifactId>maven-failsafe-plugin</artifactId>
>                        <configuration>
>                            <forkCount>1</forkCount>
>                            <reuseForks>false</reuseForks>
>                            <argLine>${args}</argLine>
>                            <testNGArtifactName>none:none</testNGArtifactName>
>                            <includes>
>                                <include>**/*ITests.java</include>
>                                <include>**/*IntegrationTests.java</include>
>                                <testFailureIgnore>true</testFailureIgnore>
>                            </includes>
>                            <environmentVariables>
>                                <HOME>${basedir}/target/test-classes</HOME>
>                                <SERVER_HOSTNAME>localhost</SERVER_HOSTNAME>
>                            </environmentVariables>
>                        </configuration>
>                        <executions>
>                            <execution>
>                                <goals>
>                                    <goal>integration-test</goal>
>                                    <goal>verify</goal>
>                                </goals>
>                            </execution>
>                        </executions>
>                    </plugin>
>                </plugins>
>            </build>
>        </profile>
>    </profiles>
>
> Here is the config for my Failsafe plugin.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

Reply | Threaded
Open this post in threaded view
|

Re: Problem with running Spring Integration Tests with mvn verify

Aleksandar Tokarev


On 2019/01/13 12:17:14, Robert Kleinschmager <[hidden email]> wrote:

> Your configuration looks fine for your task, but I’m sorry - I have no hint, why IntelliJ is faster.
>
> At first: it depends on, how your 500 Tests are organised. How many test-classes, how many methods do they have?
> Are you running JUnit4 or already Junit5? Are you using Parallel-Mode in IntelliJ?
> Can you see in the logs, how many times the spring-context is created & destroyed?
>
> Looking at the code of the Unit-Execution on Intellij [1] and surefire [2] may bring some more insights, but I’m not familiar with both of them - it would really help to debug them.
>
> [1] https://github.com/JetBrains/intellij-community/tree/master/plugins/junit_rt <https://github.com/JetBrains/intellij-community/tree/master/plugins/junit_rt>
> [2] https://github.com/apache/maven-surefire <https://github.com/apache/maven-surefire>
>
> > Am 08.01.2019 um 14:12 schrieb [hidden email]:
> >
> >
> >
> > On 2019/01/07 16:40:45, Robert Kleinschmager <[hidden email]> wrote:
> >> Hi Aleksandar,
> >>
> >> Can you please show (attach|) your POM. Maybe your failsafe config is non-optimal.
> >> In general: Intellij uses a different kind of junit execution, than failsafe/surefire
> >>
> >> Kind regards
> >> Robert
> >>
> >>> Am 05.01.2019 um 12:20 schrieb Aleksandar Tokarev <[hidden email]>:
> >>>
> >>> I am having a Spring Boot application with around ~500 Tests (Unit and
> >>> mostly Integration).
> >>>
> >>> When i start running the tests in IntelliJ with second click -> Run all
> >>> Tests - tests run in around 10-15mins.
> >>>
> >>> When i try to run the tests with "mvn verify -P itest" in IntelliJ
> >>> terminal, the execution time is around an hour. This is because this
> >>> command starts and stops the Spring Test Runner Server on every class
> >>> (which is not my desired result).
> >>>
> >>> The IntelliJ second click -> Run all Tests starts it only once. Our Jenkins
> >>> Job is running the tests with "mvn verify -P itest", so my question is how
> >>> can i change this behavior, to start and stop the Test Runner only once
> >>> (with this "mvn verify -P itest" command).
> >>>
> >>> itest is the profile that we have in our pom.xml which includes the classes
> >>> that contain integration tests (using maven failsafe plugin)
> >>>
> >>> Here are the annotations of our base abstract Integration Test class
> >>>
> >>> @RunWith(SpringJUnit4ClassRunner.class)
> >>> @SpringBootTest(classes = MainApplication.class, webEnvironment =
> >>> WebEnvironment.RANDOM_PORT)
> >>>
> >>> I found this article which could by similar to my problem, but this does
> >>> not explain the behavior that IntelliJ gives me.
> >>>
> >>> Reset Spring-Boot During Integration Tests
> >>> <https://stackoverflow.com/questions/44241936/reset-spring-boot-during-integration-tests>
> >>>
> >>> Thanks a lot in advance
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [hidden email]
> >> For additional commands, e-mail: [hidden email]
> >>
> >> <profiles>
> >        <profile>
> >            <id>itest</id>
> >            <activation>
> >                <activeByDefault>false</activeByDefault>
> >            </activation>
> >            <build>
> >                <plugins>
> >                    <plugin>
> >                        <artifactId>maven-failsafe-plugin</artifactId>
> >                        <configuration>
> >                            <forkCount>1</forkCount>
> >                            <reuseForks>false</reuseForks>
> >                            <argLine>${args}</argLine>
> >                            <testNGArtifactName>none:none</testNGArtifactName>
> >                            <includes>
> >                                <include>**/*ITests.java</include>
> >                                <include>**/*IntegrationTests.java</include>
> >                                <testFailureIgnore>true</testFailureIgnore>
> >                            </includes>
> >                            <environmentVariables>
> >                                <HOME>${basedir}/target/test-classes</HOME>
> >                                <SERVER_HOSTNAME>localhost</SERVER_HOSTNAME>
> >                            </environmentVariables>
> >                        </configuration>
> >                        <executions>
> >                            <execution>
> >                                <goals>
> >                                    <goal>integration-test</goal>
> >                                    <goal>verify</goal>
> >                                </goals>
> >                            </execution>
> >                        </executions>
> >                    </plugin>
> >                </plugins>
> >            </build>
> >        </profile>
> >    </profiles>
> >
> > Here is the config for my Failsafe plugin.
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
>
I am having like like ~40 Classes with ~10-15 methods in each.
I am running JUnit 4, and no i am not using Parallel Mode in Intellij.
In the logs i see the spring context being created & destroyed for each test class (when running it with mvn verify)


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Problem with running Spring Integration Tests with mvn verify

Mikael Åsberg
Is your surefire set up to a fork a new VM for each testclass whereas
intellij reuses?

On Tue, Jan 15, 2019, 07:56 [hidden email] <[hidden email]
wrote:

>
>
> On 2019/01/13 12:17:14, Robert Kleinschmager <[hidden email]>
> wrote:
> > Your configuration looks fine for your task, but I’m sorry - I have no
> hint, why IntelliJ is faster.
> >
> > At first: it depends on, how your 500 Tests are organised. How many
> test-classes, how many methods do they have?
> > Are you running JUnit4 or already Junit5? Are you using Parallel-Mode in
> IntelliJ?
> > Can you see in the logs, how many times the spring-context is created &
> destroyed?
> >
> > Looking at the code of the Unit-Execution on Intellij [1] and surefire
> [2] may bring some more insights, but I’m not familiar with both of them -
> it would really help to debug them.
> >
> > [1]
> https://github.com/JetBrains/intellij-community/tree/master/plugins/junit_rt
> <
> https://github.com/JetBrains/intellij-community/tree/master/plugins/junit_rt
> >
> > [2] https://github.com/apache/maven-surefire <
> https://github.com/apache/maven-surefire>
> >
> > > Am 08.01.2019 um 14:12 schrieb [hidden email]:
> > >
> > >
> > >
> > > On 2019/01/07 16:40:45, Robert Kleinschmager <[hidden email]>
> wrote:
> > >> Hi Aleksandar,
> > >>
> > >> Can you please show (attach|) your POM. Maybe your failsafe config is
> non-optimal.
> > >> In general: Intellij uses a different kind of junit execution, than
> failsafe/surefire
> > >>
> > >> Kind regards
> > >> Robert
> > >>
> > >>> Am 05.01.2019 um 12:20 schrieb Aleksandar Tokarev <
> [hidden email]>:
> > >>>
> > >>> I am having a Spring Boot application with around ~500 Tests (Unit
> and
> > >>> mostly Integration).
> > >>>
> > >>> When i start running the tests in IntelliJ with second click -> Run
> all
> > >>> Tests - tests run in around 10-15mins.
> > >>>
> > >>> When i try to run the tests with "mvn verify -P itest" in IntelliJ
> > >>> terminal, the execution time is around an hour. This is because this
> > >>> command starts and stops the Spring Test Runner Server on every class
> > >>> (which is not my desired result).
> > >>>
> > >>> The IntelliJ second click -> Run all Tests starts it only once. Our
> Jenkins
> > >>> Job is running the tests with "mvn verify -P itest", so my question
> is how
> > >>> can i change this behavior, to start and stop the Test Runner only
> once
> > >>> (with this "mvn verify -P itest" command).
> > >>>
> > >>> itest is the profile that we have in our pom.xml which includes the
> classes
> > >>> that contain integration tests (using maven failsafe plugin)
> > >>>
> > >>> Here are the annotations of our base abstract Integration Test class
> > >>>
> > >>> @RunWith(SpringJUnit4ClassRunner.class)
> > >>> @SpringBootTest(classes = MainApplication.class, webEnvironment =
> > >>> WebEnvironment.RANDOM_PORT)
> > >>>
> > >>> I found this article which could by similar to my problem, but this
> does
> > >>> not explain the behavior that IntelliJ gives me.
> > >>>
> > >>> Reset Spring-Boot During Integration Tests
> > >>> <
> https://stackoverflow.com/questions/44241936/reset-spring-boot-during-integration-tests
> >
> > >>>
> > >>> Thanks a lot in advance
> > >>
> > >>
> > >> ---------------------------------------------------------------------
> > >> To unsubscribe, e-mail: [hidden email]
> > >> For additional commands, e-mail: [hidden email]
> > >>
> > >> <profiles>
> > >        <profile>
> > >            <id>itest</id>
> > >            <activation>
> > >                <activeByDefault>false</activeByDefault>
> > >            </activation>
> > >            <build>
> > >                <plugins>
> > >                    <plugin>
> > >                        <artifactId>maven-failsafe-plugin</artifactId>
> > >                        <configuration>
> > >                            <forkCount>1</forkCount>
> > >                            <reuseForks>false</reuseForks>
> > >                            <argLine>${args}</argLine>
> > >
> <testNGArtifactName>none:none</testNGArtifactName>
> > >                            <includes>
> > >                                <include>**/*ITests.java</include>
> > >
> <include>**/*IntegrationTests.java</include>
> > >
> <testFailureIgnore>true</testFailureIgnore>
> > >                            </includes>
> > >                            <environmentVariables>
> > >
> <HOME>${basedir}/target/test-classes</HOME>
> > >
> <SERVER_HOSTNAME>localhost</SERVER_HOSTNAME>
> > >                            </environmentVariables>
> > >                        </configuration>
> > >                        <executions>
> > >                            <execution>
> > >                                <goals>
> > >                                    <goal>integration-test</goal>
> > >                                    <goal>verify</goal>
> > >                                </goals>
> > >                            </execution>
> > >                        </executions>
> > >                    </plugin>
> > >                </plugins>
> > >            </build>
> > >        </profile>
> > >    </profiles>
> > >
> > > Here is the config for my Failsafe plugin.
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: [hidden email]
> > > For additional commands, e-mail: [hidden email]
> > >
> >
> I am having like like ~40 Classes with ~10-15 methods in each.
> I am running JUnit 4, and no i am not using Parallel Mode in Intellij.
> In the logs i see the spring context being created & destroyed for each
> test class (when running it with mvn verify)
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Problem with running Spring Integration Tests with mvn verify

Robert Kleinschmager-2
In reply to this post by Robert Kleinschmager-2
I was wrong with this - as Mikael stated, try

<forkCount>1</forkCount>
<reuseForks>true</reuseForks>

or even

<forkCount>0</forkCount>
<reuseForks>true</reuseForks>

> Am 13.01.2019 um 13:17 schrieb Robert Kleinschmager <[hidden email]>:
>
> Your configuration looks fine for your task, but I’m sorry - I have no hint, why IntelliJ is faster.
>
> At first: it depends on, how your 500 Tests are organised. How many test-classes, how many methods do they have?
> Are you running JUnit4 or already Junit5? Are you using Parallel-Mode in IntelliJ?
> Can you see in the logs, how many times the spring-context is created & destroyed?
>
> Looking at the code of the Unit-Execution on Intellij [1] and surefire [2] may bring some more insights, but I’m not familiar with both of them - it would really help to debug them.
>
> [1] https://github.com/JetBrains/intellij-community/tree/master/plugins/junit_rt <https://github.com/JetBrains/intellij-community/tree/master/plugins/junit_rt>
> [2] https://github.com/apache/maven-surefire <https://github.com/apache/maven-surefire>
>
>> Am 08.01.2019 um 14:12 schrieb [hidden email] <mailto:[hidden email]>:
>>
>>
>>
>> On 2019/01/07 16:40:45, Robert Kleinschmager <[hidden email] <mailto:[hidden email]>> wrote:
>>> Hi Aleksandar,
>>>
>>> Can you please show (attach|) your POM. Maybe your failsafe config is non-optimal.
>>> In general: Intellij uses a different kind of junit execution, than failsafe/surefire
>>>
>>> Kind regards
>>> Robert
>>>
>>>> Am 05.01.2019 um 12:20 schrieb Aleksandar Tokarev <[hidden email] <mailto:[hidden email]>>:
>>>>
>>>> I am having a Spring Boot application with around ~500 Tests (Unit and
>>>> mostly Integration).
>>>>
>>>> When i start running the tests in IntelliJ with second click -> Run all
>>>> Tests - tests run in around 10-15mins.
>>>>
>>>> When i try to run the tests with "mvn verify -P itest" in IntelliJ
>>>> terminal, the execution time is around an hour. This is because this
>>>> command starts and stops the Spring Test Runner Server on every class
>>>> (which is not my desired result).
>>>>
>>>> The IntelliJ second click -> Run all Tests starts it only once. Our Jenkins
>>>> Job is running the tests with "mvn verify -P itest", so my question is how
>>>> can i change this behavior, to start and stop the Test Runner only once
>>>> (with this "mvn verify -P itest" command).
>>>>
>>>> itest is the profile that we have in our pom.xml which includes the classes
>>>> that contain integration tests (using maven failsafe plugin)
>>>>
>>>> Here are the annotations of our base abstract Integration Test class
>>>>
>>>> @RunWith(SpringJUnit4ClassRunner.class)
>>>> @SpringBootTest(classes = MainApplication.class, webEnvironment =
>>>> WebEnvironment.RANDOM_PORT)
>>>>
>>>> I found this article which could by similar to my problem, but this does
>>>> not explain the behavior that IntelliJ gives me.
>>>>
>>>> Reset Spring-Boot During Integration Tests
>>>> <https://stackoverflow.com/questions/44241936/reset-spring-boot-during-integration-tests <https://stackoverflow.com/questions/44241936/reset-spring-boot-during-integration-tests>>
>>>>
>>>> Thanks a lot in advance
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email] <mailto:[hidden email]>
>>> For additional commands, e-mail: [hidden email] <mailto:[hidden email]>
>>>
>>> <profiles>
>>        <profile>
>>            <id>itest</id>
>>            <activation>
>>                <activeByDefault>false</activeByDefault>
>>            </activation>
>>            <build>
>>                <plugins>
>>                    <plugin>
>>                        <artifactId>maven-failsafe-plugin</artifactId>
>>                        <configuration>
>>                            <forkCount>1</forkCount>
>>                            <reuseForks>false</reuseForks>
>>                            <argLine>${args}</argLine>
>>                            <testNGArtifactName>none:none</testNGArtifactName>
>>                            <includes>
>>                                <include>**/*ITests.java</include>
>>                                <include>**/*IntegrationTests.java</include>
>>                                <testFailureIgnore>true</testFailureIgnore>
>>                            </includes>
>>                            <environmentVariables>
>>                                <HOME>${basedir}/target/test-classes</HOME>
>>                                <SERVER_HOSTNAME>localhost</SERVER_HOSTNAME>
>>                            </environmentVariables>
>>                        </configuration>
>>                        <executions>
>>                            <execution>
>>                                <goals>
>>                                    <goal>integration-test</goal>
>>                                    <goal>verify</goal>
>>                                </goals>
>>                            </execution>
>>                        </executions>
>>                    </plugin>
>>                </plugins>
>>            </build>
>>        </profile>
>>    </profiles>
>>
>> Here is the config for my Failsafe plugin.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email] <mailto:[hidden email]>
>> For additional commands, e-mail: [hidden email] <mailto:[hidden email]>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Problem with running Spring Integration Tests with mvn verify

Guang Chao
In reply to this post by Aleksandar Tokarev
On Sun, Jan 6, 2019 at 11:36 PM Aleksandar Tokarev <[hidden email]>
wrote:

> I am having a Spring Boot application with around ~500 Tests (Unit and
> mostly Integration).
>
> When i start running the tests in IntelliJ with second click -> Run all
> Tests - tests run in around 10-15mins.
>
> When i try to run the tests with "mvn verify -P itest" in IntelliJ
>

Is it possible to check which profile IntelliJ is using when it is fast?
Or the default values when run with no profile?


> terminal, the execution time is around an hour. This is because this
> command starts and stops the Spring Test Runner Server on every class
> (which is not my desired result).
>
> The IntelliJ second click -> Run all Tests starts it only once. Our Jenkins
> Job is running the tests with "mvn verify -P itest", so my question is how
> can i change this behavior, to start and stop the Test Runner only once
> (with this "mvn verify -P itest" command).
>
> itest is the profile that we have in our pom.xml which includes the classes
> that contain integration tests (using maven failsafe plugin)
>
> Here are the annotations of our base abstract Integration Test class
>
> @RunWith(SpringJUnit4ClassRunner.class)
> @SpringBootTest(classes = MainApplication.class, webEnvironment =
> WebEnvironment.RANDOM_PORT)
>
> I found this article which could by similar to my problem, but this does
> not explain the behavior that IntelliJ gives me.
>
> Reset Spring-Boot During Integration Tests
> <
> https://stackoverflow.com/questions/44241936/reset-spring-boot-during-integration-tests
> >
>
> Thanks a lot in advance
>


--
Guang <http://javadevnotes.com/java-string-split-tutorial-and-examples>