Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "Tycho/Release Notes/0.26"

Line 25: Line 25:
  
 
[https://bugs.eclipse.org/bugs/buglist.cgi?classification=Technology&product=Tycho&query_format=advanced&resolution=FIXED&target_milestone=0.26.0&order=bug_id&query_based_on= Complete list of bug fixes and enhancements in 0.26.0]
 
[https://bugs.eclipse.org/bugs/buglist.cgi?classification=Technology&product=Tycho&query_format=advanced&resolution=FIXED&target_milestone=0.26.0&order=bug_id&query_based_on= Complete list of bug fixes and enhancements in 0.26.0]
 +
 +
 +
=== TestNG support ===
 +
The Tycho Surefire Plug-in does now support running tests with the [http://testng.org TestNG] framework. In order to use TestNG you have to:
 +
 +
==== Provide TestNG as OSGi Bundle ====
 +
Because TestNG is not an OSGi Bundle, you have to provide the TestNG classes and it's dependencies (currently only com.beust.jcommander) as OSGi bundles by either include the jars into your test plugin and export the TestNG java packages so that the Tycho Surefire Plugin can see them or create a separate Eclipse Plug-in ("Plug-in from Existing JAR Archives" Wizard) that contains the jars. Make sure the TestNG java packages are exported. Add this newly created Plug-in as a dependency to all your Test Plug-ins /Fragments.
 +
 +
==== Configure Tycho Surefire Plug-in====
 +
The TestNG framework provider has to be enabled by setting the <providerHint> configuration value to "testng". Within TestNG tests it is common to use java assertions, so you might also have to enable assertions. Example configuration:
 +
 +
      <build>
 +
            <plugin>
 +
                <groupId>org.eclipse.tycho</groupId>
 +
                <artifactId>tycho-surefire-plugin</artifactId>
 +
                <version>${tycho.version}</version>
 +
                <configuration>
 +
                    <providerHint>testng</providerHint>
 +
                    <argLine>-ea</argLine>
 +
                </configuration>
 +
            </plugin>
 +
      </build>
 +
 +
==== Using Test Suites ====
 +
If you want to use test suites you could configure the suite files you want to execute by specifing the suite xml files within the configuration:
 +
 +
      <build>
 +
            <plugin>
 +
                <groupId>org.eclipse.tycho</groupId>
 +
                <artifactId>tycho-surefire-plugin</artifactId>
 +
                <version>${tycho.version}</version>
 +
                <configuration>
 +
                    <providerHint>testng</providerHint>
 +
                    <argLine>-ea</argLine>
 +
                    <suiteXmlFiles>
 +
                        <suiteXmlFile>mysuite1.xml</suiteXmlFile>
 +
                        <suiteXmlFile>mysuite2.xml</suiteXmlFile>
 +
                    </suiteXmlFiles>
 +
                </configuration>
 +
            </plugin>
 +
      </build>
 +
 +
==== Using Groups ====
 +
If you want to use groups within your TestNG tests, you have to configure one additional thing. Because of the way TestNG and the Surefire TestNG Plug-in do select the test groups that should be executed, the Plug-in that exports the <tt>org.testng</tt> packages must be able to load a class from the Surefire TestNG Plug-in. With the OSGi Classloader this is only possible if you dynamically import that package in the plugin you export the TestNG packages. Within the MANIFEST.MF file of that Plug-in add
 +
 +
  DynamicImport-Package: org.apache.maven.surefire.testng.utils
 +
 +
To execute specific groups you could add the group names within the plugin configuration
 +
 +
      <build>
 +
            <plugin>
 +
                <groupId>org.eclipse.tycho</groupId>
 +
                <artifactId>tycho-surefire-plugin</artifactId>
 +
                <version>${tycho.version}</version>
 +
                <configuration>
 +
                    <providerHint>testng</providerHint>
 +
                    <argLine>-ea</argLine>
 +
                    <groups>myGroup1,myGroup2</groups>
 +
                </configuration>
 +
            </plugin>
 +
      </build>
  
 
[[Category:Tycho|Release Notes/0.26]]
 
[[Category:Tycho|Release Notes/0.26]]

Revision as of 10:25, 31 May 2016

< Previous Version | Next Version >

SNAPSHOT builds

Tycho 0.26.0 is currently in development. To try out the most recent snapshot build of 0.26.0, simply add the following snippet to your (parent) pom.xml or settings.xml, and set the property for the Tycho version (e.g. tycho-version) to 0.26.0-SNAPSHOT.

<pluginRepositories>
   <pluginRepository>
     <id>tycho-snapshots</id>
     <url>https://repo.eclipse.org/content/repositories/tycho-snapshots/</url>
   </pluginRepository>
</pluginRepositories>

SNAPSHOT site docs

Refer to the latest SNAPSHOT site docs for Tycho and Tycho Extras.

New and Noteworthy

Complete list of bug fixes and enhancements in 0.26.0


TestNG support

The Tycho Surefire Plug-in does now support running tests with the TestNG framework. In order to use TestNG you have to:

Provide TestNG as OSGi Bundle

Because TestNG is not an OSGi Bundle, you have to provide the TestNG classes and it's dependencies (currently only com.beust.jcommander) as OSGi bundles by either include the jars into your test plugin and export the TestNG java packages so that the Tycho Surefire Plugin can see them or create a separate Eclipse Plug-in ("Plug-in from Existing JAR Archives" Wizard) that contains the jars. Make sure the TestNG java packages are exported. Add this newly created Plug-in as a dependency to all your Test Plug-ins /Fragments.

Configure Tycho Surefire Plug-in

The TestNG framework provider has to be enabled by setting the <providerHint> configuration value to "testng". Within TestNG tests it is common to use java assertions, so you might also have to enable assertions. Example configuration:

      <build>
           <plugin>
               <groupId>org.eclipse.tycho</groupId>
               <artifactId>tycho-surefire-plugin</artifactId>
               <version>${tycho.version}</version>
               <configuration>
                   <providerHint>testng</providerHint>
                   <argLine>-ea</argLine>
               </configuration>
           </plugin>
      </build>

Using Test Suites

If you want to use test suites you could configure the suite files you want to execute by specifing the suite xml files within the configuration:

      <build>
           <plugin>
               <groupId>org.eclipse.tycho</groupId>
               <artifactId>tycho-surefire-plugin</artifactId>
               <version>${tycho.version}</version>
               <configuration>
                   <providerHint>testng</providerHint>
                   <argLine>-ea</argLine>
                   <suiteXmlFiles>
                       <suiteXmlFile>mysuite1.xml</suiteXmlFile>
                       <suiteXmlFile>mysuite2.xml</suiteXmlFile>
                   </suiteXmlFiles>
               </configuration>
           </plugin>
      </build>

Using Groups

If you want to use groups within your TestNG tests, you have to configure one additional thing. Because of the way TestNG and the Surefire TestNG Plug-in do select the test groups that should be executed, the Plug-in that exports the org.testng packages must be able to load a class from the Surefire TestNG Plug-in. With the OSGi Classloader this is only possible if you dynamically import that package in the plugin you export the TestNG packages. Within the MANIFEST.MF file of that Plug-in add

  DynamicImport-Package: org.apache.maven.surefire.testng.utils

To execute specific groups you could add the group names within the plugin configuration

      <build>
           <plugin>
               <groupId>org.eclipse.tycho</groupId>
               <artifactId>tycho-surefire-plugin</artifactId>
               <version>${tycho.version}</version>
               <configuration>
                   <providerHint>testng</providerHint>
                   <argLine>-ea</argLine>
                   <groups>myGroup1,myGroup2</groups>
               </configuration>
           </plugin>
      </build>

Back to the top