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

maven-surefire-plugin must be listed under build/plugins pom.xml
section. Attached is a fixed pom.xml file, which does run
maven-surefire-plugin. Tests fail with classnotfound exception but I
assume the project dependencies are not fully configured.

--
Regards,
Igor

On 1/23/2014, 14:51, Tracy, Benjamin J wrote:
I further apologize for forgetting the attachment.. Sheesh.  Not a good day.
________________________________________
From: Tracy, Benjamin J
Sent: Thursday, January 23, 2014 2:50 PM
To: Tycho user list
Subject: RE: [tycho-user] tycho-surefire and testng

I apologize.  Please find attached a tgz with everything you need to replicate what I'm seeing.   What you need to do is:

cd foobar-dependencies.bundle
mvn p2:site install
cd ../foobar-common.bundle
mvn install
cd ../foobar-common.bundle.tests
mvn install

When I do that last install on the test fragment, I see two problems.  One is that the tycho-surefire plugin gets a class not found error related to TestNG.  I'm less concerned about that.  I can skip that at least for now because we don't need the whole OSGi framework to run the tests I care about.

The real problem is that the maven-surefire-plugin that I'm trying to invoke in the test fragment pom never runs.  Even if I do mvn test directly it doesn't run.

Again, I'm sorry for the misunderstanding about what you were looking for.  Thanks for your help.

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

"small complete standalone example" == a zip or tgz file that includes
pom.xml and all sources necessary to demonstrate the problem. I want to
be able to unpack the archive, run "mvn test" (or some other build phase
you specify) and see the problem for myself. I am not good at guessing
what other configuration elements you pom files have and what happens
when maven interprets those poms.

--
Regards,
Igor

On 1/23/2014, 14:09, Tracy, Benjamin J wrote:
Oops I forgot to mention that what I see when I run with this is that the maven surefire never runs.
________________________________________
From: Tracy, Benjamin J
Sent: Thursday, January 23, 2014 2:08 PM
To: Tycho user list
Subject: RE: [tycho-user] tycho-surefire and testng

OK here's a smaller example:

I believe that the following snippet should cause the maven-surefire plugin to run at the test phase and the tycho surefire plugin to run later.  Am I right about that?

          <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>apm-common.bundle</artifactId>
                                                          <version>0.0.0</version>
                                                  </dependency>
                                          </dependencies>

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

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

Please provide small complete standalone example I can "mvn test" and
see the exact failure you get? Also explain what you believe should
happen to make the error go away.

--
Regards,
Igor

On 1/23/2014, 10:12, Tracy, Benjamin J wrote:
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



_______________________________________________
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
_______________________________________________
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



_______________________________________________
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>
		<relativePath>../foobar-parent.bundle</relativePath>
	</parent>
	<build>
		<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>
					</dependency>
				</dependencies>
				<configuration>
					<testSourceDirectory>src/</testSourceDirectory>
					<testClassesDirectory>target/classes/</testClassesDirectory>
				</configuration>
			</plugin>
		</plugins>
	<pluginManagement>
		<plugins>
 			<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>

Back to the top