Reputation: 135
I'm running in eclipse juno with get 1.7.5 trying to set up junit testing. I added the junit jar from the juno plugin folder. I've set the option for junit 4.
I created a new get project 'MyJunitProject' and with one class under client 'MyFirstGWTTestCase.' Here is the code.
package com.client;
import org.junit.Test;
import com.google.gwt.junit.client.GWTTestCase;
public class MyFirstGWTTestCase extends GWTTestCase {
@Override
public String getModuleName() {
return "com.MyJunitProject";
}
@Test
public void myFirstTest() {
assertTrue(true);
}
}
I get the following error:
junit.framework.AssertionFailedError: No tests found in com.client.MyFirstGWTTestCase
at junit.framework.Assert.fail(Assert.java:50)
at junit.framework.TestSuite$1.runTest(TestSuite.java:97)
at junit.framework.TestCase.runBare(TestCase.java:134)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:243)
at junit.framework.TestSuite.run(TestSuite.java:238)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Upvotes: 1
Views: 1713
Reputation: 1160
If you are using log4j / slf4j, check whether you have log4j properties in test/resources folder
Upvotes: 0
Reputation: 18331
Unfortunatly, GWT test cases are all running using the JUnit 3 model, not JUnit 4. This means that the @Test
annotation doesn't mean anything, and that your methods must start with the word test. So instead of
//wrong! at least as of GWT 2.5 in a GWTTestCase
@Test
public void myFirstTest() {
assertTrue(true);
}
you should write
public void testMyFirstTestCase() {
assertTrue(true);
}
It doesn't matter what the rest of the method name is, as long as it begins with 'test'.
Upvotes: 8
Reputation: 895
Here is an example of GWTTestCase.
http://www.tutorialspoint.com/gwt/gwt_junit_integration.htm
Follow the steps given in above link.
Upvotes: 0