Hi, Firstly, I am pretty new to Eclipse RCP applications and Tycho, so please excuse my questions and lack of knowledge. I have also been reading some (indirect) discussions about this, but still couldn't get a firm understanding. I thought I would just post my questions here with the hope that someone could answer them.
I have been using Tycho for about a month now, and it works really great. I have successfully integrated it as a headless build tool for my RCP application by following some previous discussions floating around here (such as http://markmail.org/message/tzol62smonyqmag4). My problem now is how to best use Tycho with JUnit. 1. My understanding is that normally test clases for an Eclipse plugin should be separated into a separate test bundle. But why so? What are the advantages of this over just placing them into a separate directory/test package following the Maven convention? I read that the downside of following Maven convention is that you will then need to include your test code in your deployable plug-ins. But as I understand it, couldn't you just use 'mvn package assembly:assembly' to build it to filter out the test classes in the end? So it is not very clear to me as to why putting test classes into a separate fragment is more beneficial in this case. 2. If I want to follow the Maven convention (i.e. test classes under test package), could I simply declare junit library as a dependency in my pom.xml, as in the following? <dependencyManagement> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>eclipse.org</groupId> <artifactId>installation</artifactId> <version>0.0.0</version> <type>eclipse-installation</type> <scope>system</scope> <systemPath>${env.TYCHO_TARGET_PLATFORM}</systemPath> </dependency> <dependency> <groupId>group</groupId> <artifactId>artifact</artifactId> <version>1.0.0-SNAPSHOT</version> <type>eclipse-plugin</type> </dependency> </dependencyManagement> I tried this, and then ran 'mvn test', but Tycho/Maven does not seem to compile my test classes. It just ignores them. Perhaps there is a specific Tycho/Maven goal (that is, not 'mvn test') for this that I didn't know of? 3. If I want to follow the normal Eclipse convention (i.e. having a separate test bundle for test classes), are the following steps correct (I could not find any detailed step-by-step instructions to do this, so I came up with my own, so please clarify if they are wrong)? ~ Create a fragment with the host plugin being the Eclipse plugin I want to unit-test for. ~ Type the project name as "<eclipse-plugin-to-test>.tests" (good practice?). ~ Change the source folder to follow Maven convention "src/main/java". ~ Change the source folder to follow Maven convention "target/classes". ~ Create a pom.xml file: <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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>some-group-id</groupId> <artifactId>Bundle-SymbolicName</artifactId> <version>Bundle-Version</version> <packaging>eclipse-test-plugin</packaging> </project> ~ Declare a dependency to junit library. How do I do this? Is this a pom.xml dependency or is this a MANIFEST.MF dependency? Or both? ~ Create a junit test class. ~ Go to command prompt, go to the fragment Eclipse test directory, and then do 'mvn test' to run the test class created earlier. ~ Or go to the host Eclipse plugin directory, and then do 'mvn integration-test -DtestSuffix=.tests'. Thanks, Hansen -- View this message in context: http://www.nabble.com/Tycho-with-JUnit---How--tp22155897p22155897.html Sent from the Maven Eclipse - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email