Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tycho-user] tycho-surefire and testng

Thanks for taking the time.  I've attached a few pom files:  the parent, the test fragment and the target platform pom.   It's not a tiny example, but it's still pretty general.

Thanks in advance!
Ben


________________________________________
From: tycho-user-bounces@xxxxxxxxxxx [tycho-user-bounces@xxxxxxxxxxx] on behalf of Igor Fedorenko [igor@xxxxxxxxxxxxxx]
Sent: Thursday, January 23, 2014 9:57 AM
To: tycho-user@xxxxxxxxxxx
Subject: Re: [tycho-user] tycho-surefire and testng

Tycho is supposed to map OSGi dependencies back to pom.xml model, so at
least theoretically is should be possible to use "plain"
maven-surefire-plugin for Tycho projects. Whether this will work in
practice depends on your project structure and dependencies your project
uses. If you can provide a small standalone example that shows your
setup I may be able to provide more specific recommendation.

--
Regards,
Igor

On 1/23/2014, 9:48, Tracy, Benjamin J wrote:
>> Are you sure you get up to the correct lifecycle phase? Running mvn test
>> will not do, as the tycho surefire plugin hooks into the
>> integration-test phase by default:
>>http://www.eclipse.org/tycho/sitedocs/tycho-surefire/tycho-surefire-plugin/test-mojo.html
>
> Thanks for your quick response!
>
> I noticed that the tycho-surefire runs at integration test.  I had given
> up on that plugin because there was no provider hint for TestNG (which
> led me to believe what I had read that TestNG was not supported) and
> when I give the JUnit 4.7 provider hint, I get an exception
> (ClassNotFound on OsgiEnabledJUintCoreProvider).  So I had added
> "<skip>true</skip>" to the tycho-surefire so that I could try to get
> TestNG working the regular way and that isn't working for me either.
>
> What am I supposed to do to get TestNG to work?
>
> Ben
>
>
> _______________________________________________
> tycho-user mailing list
> tycho-user@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/tycho-user
>
_______________________________________________
tycho-user mailing list
tycho-user@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/tycho-user
<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";>
	<modelVersion>4.0.0</modelVersion>
	<artifactId>foobar-common.bundle.tests</artifactId>
	<packaging>eclipse-test-plugin</packaging>
	<parent>
		<groupId>org.foobar</groupId>
		<artifactId>foobar-parent.bundle</artifactId>
		<version>1.0.0-SNAPSHOT</version>
	</parent>
 	<build>
	<pluginManagement>
		<plugins>
			<plugin>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>2.16</version>
				<executions>
					<execution>
						<phase>test</phase>
						<goals>
							<goal>test</goal>
						</goals>
					</execution>
				</executions>
				<dependencies>
					<dependency>
						<groupId>org.apache.maven.surefire</groupId>
						<artifactId>surefire-testng</artifactId>
						<version>2.16</version>
						<scope>test</scope>
					</dependency>
				</dependencies>
				<configuration>
					<testSourceDirectory>src/</testSourceDirectory>
					<testClassesDirectory>target/classes/</testClassesDirectory>
				</configuration>
			</plugin>
 			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-surefire-plugin</artifactId>
				<version>${tycho-version}</version>
				<configuration>
					<providerHint>junit47</providerHint>
					<useSystemClassLoader>false</useSystemClassLoader>
					<dependencies>
						<dependency>
							<type>eclipse-plugin</type>
							<artifactId>foobar-common.bundle</artifactId>
							<version>0.0.0</version>
						</dependency>
					</dependencies>

				</configuration>
				<executions>
					<execution>
						<id>JUnitTest</id>
						<goals>
							<goal>test</goal>
						</goals>
						<phase>install</phase>
						<configuration>

						</configuration>
					</execution>
				</executions>
			</plugin>
 		</plugins>
	</pluginManagement>
</build> 
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";>
	<modelVersion>4.0.0</modelVersion>
	<artifactId>foobar-dependencies.bundle</artifactId>
	<version>1.0.0.qualifier</version>
	<packaging>eclipse-target-definition</packaging>

	<build>
		<plugins>
			<plugin>
				<groupId>org.reficio</groupId>
				<artifactId>p2-maven-plugin</artifactId>
				<version>1.1.1-SNAPSHOT</version>
				<executions>
					<execution>
						<id>default-cli</id>
						<configuration>
							<artifacts>
								<!-- specify your dependencies here -->
								<!-- groupId:artifactId:version -->
								<artifact>
									<id>com.eaio.uuid:uuid:3.3</id>
								</artifact>
								<artifact>
									<id>net.jcip:jcip-annotations:1.0</id>
								</artifact>
								<artifiact>
									<id>org.apache.maven.surefire:surefire-junit47:2.16</id>
								</artifiact>
								<artifact>
									<id>org.testng:testng:6.8.7</id>
								</artifact>
								<artifact>
									<id>com.beust:jcommander:1.27</id>
								</artifact>
							</artifacts>
						</configuration>
					</execution>
<!-- 					<execution>
						PHASE EXAMPLE
						This example presents how to bind the invocation of the plugin
							to the maven 'compile' phase. To run the example please invoke: mvn compile
						<id>generate-p2-site</id>
						<phase>compile</phase>
						<goals>
							<goal>site</goal>
						</goals>
					</execution> -->
				</executions>
			</plugin>
		</plugins>
	</build>

	<repositories>
		<repository>
			<id>eaio.com</id>
			<url>http://eaio.com/maven2</url>
		</repository>
	</repositories>

	<pluginRepositories>
		<pluginRepository>
			<id>reficio</id>
			<url>http://repo.reficio.org/maven/</url>
		</pluginRepository>
	</pluginRepositories>

	<parent>
		<groupId>org.foobar</groupId>
		<artifactId>foobar-parent.bundle</artifactId>
		<version>1.0.0-SNAPSHOT</version>
		<relativePath>../foobar-parent.bundle</relativePath>
	</parent>
</project>
<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd";>
	<modelVersion>4.0.0</modelVersion>
	<groupId>org.foobar</groupId>
	<artifactId>foobar-parent.bundle</artifactId>
	<version>1.0.0-SNAPSHOT</version>
	<packaging>pom</packaging>
	<modules>
		<module>../foobar-dependencies.bundle</module>
		<module>../foobar-common.bundle</module>
		<module>../foobar-common.bundle.tests</module>
	</modules>
	<properties>
		<tycho-version>0.19.0</tycho-version>
	</properties>
	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.testng</groupId>
				<artifactId>testng</artifactId>
				<version>6.8.9</version>
				<scope>test</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>
	<build>
		<plugins>
			<plugin>
				<groupId>org.mortbay.jetty</groupId>
				<artifactId>jetty-maven-plugin</artifactId>
				<version>8.1.14.v20131031</version>
			</plugin>
			<plugin>
				<!-- enable the Tycho build extension -->
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>tycho-maven-plugin</artifactId>
				<version>${tycho-version}</version>
				<extensions>true</extensions>
			</plugin>
			<plugin>
				<groupId>org.eclipse.tycho</groupId>
				<artifactId>target-platform-configuration</artifactId>
				<version>${tycho-version}</version>
				<configuration>
					<!-- <pomDependencies>consider</pomDependencies> -->
					<!-- <resolver>p2</resolver> -->
					<target>
						<artifact>
							<groupId>org.foobar</groupId>
							<artifactId>foobar-dependencies.bundle</artifactId>
							<version>1.0.0.qualifier</version>
						</artifact>
					</target>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

Back to the top