Discussion:
[tycho-user] Multiple testclass invocations per plugin
Ed Willink
2017-10-13 11:56:50 UTC
Permalink
Hi

I'm migrating from Buckminster where each "junit ..." line ran a test. I
can do similar things with SureFire, but I'm stuck when it comes to
running two test invocations for a plugin.

(Since EMF usage is very different standalone/headless and within
Eclipse, I run the same tests twice for the two environments.)

Surefire provides useUIThread to configure headless, but it does not
appear to be possible to have multiple executions with different
configurations; useUIThread = false, useUIThread = true.

Is there a way or do I have to create dummy 'wrapper' plugins so that I
can have different SureFire configurations in each wrapper?

    Regards

        Ed Willink


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
Bidon Gamelle
2017-10-13 13:12:49 UTC
Permalink
Hi Ed,

Think you can have several executions on surefire plugin.
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<executions>
<execution>
<id>headless</id>
<goals>
<goal>test</goal>
</goals>
<configuration>
...
<useUIHarness>false</useUIHarness>
</configuration>
</execution>
<execution>
<id>with-ui</id>
<goals>
<goal>test</goal>
</goals>
<configuration>
...
<useUIHarness>true</useUIHarness>
</configuration>
</execution>
</executions>
</plugin>


Note that the default execution will still be executed. Either you can use
the default execution and one specific execution, or set skipTests to true
to disable the default.

Regards,
franck
Post by Ed Willink
Hi
I'm migrating from Buckminster where each "junit ..." line ran a test. I
can do similar things with SureFire, but I'm stuck when it comes to running
two test invocations for a plugin.
(Since EMF usage is very different standalone/headless and within Eclipse,
I run the same tests twice for the two environments.)
Surefire provides useUIThread to configure headless, but it does not
appear to be possible to have multiple executions with different
configurations; useUIThread = false, useUIThread = true.
Is there a way or do I have to create dummy 'wrapper' plugins so that I
can have different SureFire configurations in each wrapper?
Regards
Ed Willink
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
_______________________________________________
tycho-user mailing list
To change your delivery options, retrieve your password, or unsubscribe
from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user
Ed Willink
2017-10-13 13:54:19 UTC
Permalink
Hi

Thanks. I was looking for "execution" but there is no mention on the
SureFile page or on Google. I need to read the documentation to
understand your comments about defaults and selective execution. I just
want them all to execute.

When I try it, I get a could not load ${tycho.testArgLine} just as I do
when I miss the surefile tests altogether. Seems that per-execution
argLine is ignored.

    Regards

        Ed Willink
Post by Bidon Gamelle
Hi Ed,
Think you can have several executions on surefire plugin.
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-surefire-plugin</artifactId>
        <version>${tycho-version}</version>
        <executions>
          <execution>
            <id>headless</id>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              ...
              <useUIHarness>false</useUIHarness>
            </configuration>
          </execution>
          <execution>
            <id>with-ui</id>
            <goals>
              <goal>test</goal>
            </goals>
            <configuration>
              ...
              <useUIHarness>true</useUIHarness>
            </configuration>
          </execution>
        </executions>
      </plugin>
Note that the default execution will still be executed. Either you can
use the default execution and one specific execution, or set skipTests
to true to disable the default.
Regards,
franck
Hi
I'm migrating from Buckminster where each "junit ..." line ran a
test. I can do similar things with SureFire, but I'm stuck when it
comes to running two test invocations for a plugin.
(Since EMF usage is very different standalone/headless and within
Eclipse, I run the same tests twice for the two environments.)
Surefire provides useUIThread to configure headless, but it does
not appear to be possible to have multiple executions with
different configurations; useUIThread = false, useUIThread = true.
Is there a way or do I have to create dummy 'wrapper' plugins so
that I can have different SureFire configurations in each wrapper?
    Regards
        Ed Willink
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus <https://www.avast.com/antivirus>
_______________________________________________
tycho-user mailing list
To change your delivery options, retrieve your password, or
unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user
<https://dev.eclipse.org/mailman/listinfo/tycho-user>
_______________________________________________
tycho-user mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user
Mickael Istria
2017-10-13 15:04:24 UTC
Permalink
Hi,

I support Bidon's answer.
About the "execution" tag, it's not specific to Surefire but to the Maven
POM model, which allows multiple execution of any Maven plugin. So you'll
have to find plain Maven documentation for details about how parameters are
passed and/or overridden through the multiple "configuration" blocks.
A small tip I think is worth mentioning right away is to use `mvn
help:effective-pom` to see how the pom file is extended and see a "verbose"
view of your pom file which should help to disambiguate some settings.

HTH
Ed Willink
2017-10-13 15:36:34 UTC
Permalink
Hi

Thanks. Spot on tip. My root POM had a default surefire configuration
giving me a default test that did not co-exist well with the new
explicit tests.

Next challenge: how to stop the two sets of surefire-reports sharing the
same name. With JUnit I have a -DtestSuiteName but that gets lost. Is
there a better way than setting alternative reportsDirectory values to
separate them?

    Regards

        Ed Willink
Post by Mickael Istria
Hi,
I support Bidon's answer.
About the "execution" tag, it's not specific to Surefire but to the
Maven POM model, which allows multiple execution of any Maven plugin.
So you'll have to find plain Maven documentation for details about how
parameters are passed and/or overridden through the multiple
"configuration" blocks.
A small tip I think is worth mentioning right away is to use `mvn
help:effective-pom` to see how the pom file is extended and see a
"verbose" view of your pom file which should help to disambiguate some
settings.
HTH
_______________________________________________
tycho-user mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
Ed Willink
2017-10-15 14:51:06 UTC
Permalink
Hi

(The reportsDirectory provides separation of repeated names.)

But my original problem is not solved. I need multiple launches of one
testClass corresponding to a Buckminster launch of a JUnit launch
configuration and later of a JUnit Plugin launch configuration.

For a JUnit configuration, I do not want OSGI to start.
(useUIHarness=false still starts OSGI). I cannot see how to do this with
the tycho-surefire-plugin; seems contrary to its philosophy; providing
non-Eclipse functionality within an Eclipse added value.

So I presume I should revert to the maven-surefire-plugin, but it
appears that the tycho-surefire-plugin subverts its functionality. I
don't think I have succeeded in getting maven-surefire-plugin to run any
tests. I thought I had but that was just a mega-confusion caused by the
helpful "default-test"; the kind of help that I normally associate with
Microsoft tools.

Any clues on how to emulate a JUnit launch as well as a JUnit Plugin launch?

    Regards

        Ed Willink
Post by Ed Willink
Hi
Thanks. Spot on tip. My root POM had a default surefire configuration
giving me a default test that did not co-exist well with the new
explicit tests.
Next challenge: how to stop the two sets of surefire-reports sharing
the same name. With JUnit I have a -DtestSuiteName but that gets lost.
Is there a better way than setting alternative reportsDirectory values
to separate them?
    Regards
        Ed Willink
Post by Mickael Istria
Hi,
I support Bidon's answer.
About the "execution" tag, it's not specific to Surefire but to the
Maven POM model, which allows multiple execution of any Maven plugin.
So you'll have to find plain Maven documentation for details about
how parameters are passed and/or overridden through the multiple
"configuration" blocks.
A small tip I think is worth mentioning right away is to use `mvn
help:effective-pom` to see how the pom file is extended and see a
"verbose" view of your pom file which should help to disambiguate
some settings.
HTH
_______________________________________________
tycho-user mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
Virus-free. www.avast.com
<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
<#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
_______________________________________________
tycho-user mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
Andreas Sewe
2017-10-13 15:06:24 UTC
Permalink
Post by Bidon Gamelle
Note that the default execution will still be executed. Either you can
use the default execution and one specific execution, or set skipTests
to true to disable the default.
In case the question comes up how to use the "default execution", you
can change its <configuration> using an <execution> with
<id><default-test</id>.

Hope that helps.

Andreas
--
Codetrails GmbH
The best code possible

Robert-Bosch-Str. 7, 64293 Darmstadt
Phone: +49-6151-276-7092
Mobile: +49-170-811-3791
http://www.codetrails.com/

Managing Director: Dr. Marcel Bruch
Handelsregister: Darmstadt HRB 91940
Aurélien Pupier
2017-10-16 08:10:02 UTC
Permalink
Hi,

Mickaël Istria pointed me to this thread mail
https://dev.eclipse.org/mhonarc/lists/tycho-user/msg07794.html I just
registered to the mailing-list and so not sure that this mail will be added
to the current thread.

I can give some hints for one of the issue mentioned:

*"For a JUnit configuration, I do not want OSGI to start.
(useUIHarness=false still starts OSGI). I cannot see how to do this with
the tycho-surefire-plugin; seems contrary to its philosophy; providing
non-Eclipse functionality within an Eclipse added value.*

*So I presume I should revert to the maven-surefire-plugin, but it appears
that the tycho-surefire-plugin subverts its functionality. I don't think I
have succeeded in getting maven-surefire-plugin to run any tests. I thought
I had but that was just a mega-confusion caused by the helpful
"default-test"; the kind of help that I normally associate with Microsoft
tools."*

To be able to launch the tests without OSGi, you need to go back to
maven-surefire-plugin. You can have a look to this plugin
https://github.com/jbosstools/jbosstools-fuse/tree/master/core/tests/org.fusesource.ide.camel.model.service.core.tests
and these places in the parent pom:
https://github.com/jbosstools/jbosstools-fuse/blob/master/pom.xml#L221 and
https://github.com/jbosstools/jbosstools-fuse/blob/master/pom.xml#L265

I take the opportunity of this discussion to point to a presentation (video
slides
<https://www.slideshare.net/AurelienPupier/fast-unit-tests-for-eclipse-plugins>)
I provided at an EclipseCon explaining why using tests without launching
OSGi is really a good thing for some unit tests, you will also see some
alternatives to use maven-surefire-plugin for Eclipse tests.

Regards,
--
AURÉLIEN PUPIER

SENIOR SOFTWARE ENGINEER, FUSE TOOLING

Red Hat France <https://www.redhat.com/>

***@redhat.com IM: apupier
<https://red.ht/sig>
Ed Willink
2017-10-24 09:45:35 UTC
Permalink
Hi

After considerable pain attempting to empathize with magic nothing
happenings, I can now be quite confident that while the correct answer
is indeed use maven-surefire-plugin to run standalone tests, a further
correct answer is that it is not possible to run both
maven-surefire-plugin and tycho-surefire-plugin together.
tycho-surefire-plugin won't run for a "jar" packaging and an
"eclipse-test-plugin" packaging for tycho-surefire-plugin disrupts the
maven functionality.

Repro on: https://bugs.eclipse.org/bugs/show_bug.cgi?id=526404

Regards

Ed Willink
Post by Aurélien Pupier
Hi,
Mickaël Istria pointed me to this thread mail
https://dev.eclipse.org/mhonarc/lists/tycho-user/msg07794.html I just
registered to the mailing-list and so not sure that this mail will be
added to the current thread.
/"For a JUnit configuration, I do not want OSGI to start.
(useUIHarness=false still starts OSGI). I cannot see how to do this
with the tycho-surefire-plugin; seems contrary to its philosophy;
providing non-Eclipse functionality within an Eclipse added value./
/
/
/So I presume I should revert to the maven-surefire-plugin, but it
appears that the tycho-surefire-plugin subverts its functionality. I
don't think I have succeeded in getting maven-surefire-plugin to run
any tests. I thought I had but that was just a mega-confusion caused
by the helpful "default-test"; the kind of help that I normally
associate with Microsoft tools."/
/
/
To be able to launch the tests without OSGi, you need to go back to
maven-surefire-plugin. You can have a look to this plugin
https://github.com/jbosstools/jbosstools-fuse/tree/master/core/tests/org.fusesource.ide.camel.model.service.core.tests
https://github.com/jbosstools/jbosstools-fuse/blob/master/pom.xml#L221
and https://github.com/jbosstools/jbosstools-fuse/blob/master/pom.xml#L265
I take the opportunity of this discussion to point to a presentation
(video http://youtu.be/IGkFy2H-d60 slides
<https://www.slideshare.net/AurelienPupier/fast-unit-tests-for-eclipse-plugins>)
I provided at an EclipseCon explaining why using tests without
launching OSGi is really a good thing for some unit tests, you will
also see some alternatives to use maven-surefire-plugin for Eclipse tests.
Regards,
--
AURÉLIEN PUPIER
SENIOR SOFTWARE ENGINEER, FUSE TOOLING
Red Hat France <https://www.redhat.com/>
<https://red.ht/sig>
_______________________________________________
tycho-user mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
Sievers, Jan
2017-10-25 13:11:49 UTC
Permalink
it turns out you can run both maven-surefire-plugin and tycho-surefire-plugin together.
I added an FAQ https://wiki.eclipse.org/Tycho/FAQ#Can_I_run_eclipse-plugin_tests_also_outside_an_OSGi_container.3F

Regards,
Jan


On 24.10.17, 12:05, "tycho-user-***@eclipse.org on behalf of Ed Willink" <tycho-user-***@eclipse.org on behalf of ***@willink.me.uk> wrote:

Hi
After considerable pain attempting to empathize with magic nothing happenings, I can now be quite confident that while the correct answer is indeed use maven-surefire-plugin to run standalone tests, a further correct answer is that it is not possible to
run both maven-surefire-plugin and tycho-surefire-plugin together. tycho-surefire-plugin won't run for a "jar" packaging and an "eclipse-test-plugin" packaging for tycho-surefire-plugin disrupts the maven functionality.
Repro on:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=526404 <https://bugs.eclipse.org/bugs/show_bug.cgi?id=526404>
Regards
Ed Willink


On 16/10/2017 09:10, Aurélien Pupier wrote:


Hi,


Mickaël Istria pointed me to this thread mail https://dev.eclipse.org/mhonarc/lists/tycho-user/msg07794.html I just registered to the mailing-list and so
not sure that this mail will be added to the current thread.


I can give some hints for one of the issue mentioned:


"For a JUnit configuration, I do not want OSGI to start. (useUIHarness=false still starts OSGI). I cannot see how to do this with the tycho-surefire-plugin; seems contrary to its philosophy; providing non-Eclipse functionality within an Eclipse added
value.


So I presume I should revert to the maven-surefire-plugin, but it appears that the tycho-surefire-plugin subverts its functionality. I don't think I have succeeded in getting maven-surefire-plugin to run any tests. I thought I had but that was just
a mega-confusion caused by the helpful "default-test"; the kind of help that I normally associate with Microsoft tools."


To be able to launch the tests without OSGi, you need to go back to maven-surefire-plugin. You can have a look to this plugin https://github.com/jbosstools/jbosstools-fuse/tree/master/core/tests/org.fusesource.ide.camel.model.service.core.tests
and these places in the parent pom:
https://github.com/jbosstools/jbosstools-fuse/blob/master/pom.xml#L221 <https://github.com/jbosstools/jbosstools-fuse/blob/master/pom.xml#L221> and
https://github.com/jbosstools/jbosstools-fuse/blob/master/pom.xml#L265 <https://github.com/jbosstools/jbosstools-fuse/blob/master/pom.xml#L265>


I take the opportunity of this discussion to point to a presentation (video http://youtu.be/IGkFy2H-d60

slides <https://www.slideshare.net/AurelienPupier/fast-unit-tests-for-eclipse-plugins>) I provided at an EclipseCon explaining why using tests without launching OSGi is really a good thing for some unit tests, you will also see some alternatives to use maven-surefire-plugin for Eclipse tests.


Regards,




--
AURÉLIEN PUPIER
SENIOR SOFTWARE ENGINEER, FUSE TOOLING
Red Hat France <https://www.redhat.com/>
***@redhat.com IM: apupier
<https://red.ht/sig>







_______________________________________________
tycho-user mailing list
tycho-***@eclipse.org
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/tycho-user



<https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient>
Virus-free.
www.avast.com <https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2>
Loading...