- This topic has 4 replies, 3 voices, and was last updated 16 years ago by allenparslow.
-
AuthorPosts
-
allenparslowMemberIn MyEclipse 7.0M2 I’m getting JUnit/TestNG problems (running with the plugins), with the default maven build configuration and <packaging>war</packaging>.
Steps to recreate:
Start with clean pom (<packaging>jar</packaging>) with just JUnit /or TestNG dependencies and a simple test-class in src/test/java. Import as maven project.Run mvn clean, then from MyEclipse menu select Project/Clean.
Run JUnit/TestNG class. [executes sucessfully and the test class are output to target/test-classes] [also executes with mvn clean test].Remove project from MyEclipse. Delete all files in the project folder except /src and pom.xml, re-import maven project.
Run mvn clean, then from MyEclipse menu select Project/Clean.
Run JUnit/TestNG class which fails (ClassNotFoundException) and the test class are NOT output to target/test-classes (but still executes ok with mvn clean test).
Loyal WaterMemberallenparslow,
I have asked someone from the dev team to look into this issue. He will get back to you with an update asap. Thank you for your patience.
support-eugeneMemberallenparslow,
I can’t reproduce what you see. I did the following:
1. I created project using quickstart prototype.
2. I used m2eclipse “General/Maven Projects…” import wizard.
3. My workspace was set to Build Automatically but I tried removing that checkbox too.
allenparslowMemberStep #1: Create this project structure:
JUnitTest |-pom.xml |-src |-test |-java |-testing |-SimpleJUnitTest.java |-main |-java |-webapp |-WEB-INF |-web.xml
pom.xml contents:
<?xml version="1.0"?> <project> <modelVersion>4.0.0</modelVersion> <groupId>testing</groupId> <artifactId>Test</artifactId> <version>1.0.0-SNAPSHOT</version> <packaging>war</packaging> <repositories> <repository> <id>maven2</id> <name>maven2</name> <url>http://repo1.maven.org/maven2/</url> </repository> </repositories> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8</version> </dependency> </dependencies> </project>
SimpleJUnitTest.java contents:
package testing; import junit.framework.Assert; import junit.framework.TestCase; public class SimpleJUnitTest extends TestCase { public void testTest() { Assert.assertEquals(1, 1); } }
Step #2: Enable importing of existing maven project
MyEclipse menu Window/Preferences/”MyEclipse Enterprise Workbench”/Maven4MyEclipse/”Enable all m2eclipse features”=trueStep #3: Import project with:
MyEclilpse menu File/Import…/Maven Projects/Step #4: right click SimpleJUnitTest, choose run as…JUnit test
allenparslowMemberIf the class is put in src/main/java it runs just fine (it appears to be only test-cases in src/test/java).
-
AuthorPosts