@RunWith(Feeder.class) can't work

All questions and comments around Feed4JUnit

@RunWith(Feeder.class) can't work

Postby alice29fun » Wed Jan 11, 2012 4:38 am

I refer this web site http://databene.org/feed4junit.html to write a simple testcase
I have already attach the Junit-4.10.jar,feed4junit-1.1.2 jar
My code is below

package com.bbsSeleniumtest;
import org.databene.benerator.anno.Source;
import org.databene.feed4junit.Feeder;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;

@RunWith(Feeder.class)
public class LoginTest {

@Before
public void setUp() throws Exception {
}

@After
public void tearDown() throws Exception {
}

@Test
@Source("resource\\compute.csv")
public void testLogin(int x,int y,int result)
{
System.out.println("name:"+ x +" Password:" + y +" Result" + result);
}

}

But when I run the junit test case,it happen errors:initializationError
java.lang.NoClassDefFoundError:org/databene/commons/Context
at java.lang.Class.getDeclaredConstructors0(Native Method)
java.lang.NoClassDefFoundError: org/databene/commons/Context
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.getConstructor(Unknown Source)
at org.junit.internal.builders.AnnotatedBuilder.buildRunner(AnnotatedBuilder.java:31)
at org.junit.internal.builders.AnnotatedBuilder.runnerForClass(AnnotatedBuilder.java:24)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.builders.AllDefaultPossibilitiesBuilder.runnerForClass(AllDefaultPossibilitiesBuilder.java:29)
at org.junit.runners.model.RunnerBuilder.safeRunnerForClass(RunnerBuilder.java:57)
at org.junit.internal.requests.ClassRequest.getRunner(ClassRequest.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.<init>(JUnit4TestReference.java:26)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestClassReference.<init>(JUnit4TestClassReference.java:24)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.createTest(JUnit4TestLoader.java:40)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestLoader.loadTests(JUnit4TestLoader.java:30)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

The Jave environmental run other simple java programe is OK,but use abrove method will occur error.Can you help me to solve this problem?
Thank you very much!
alice29fun
 
Posts: 2
Joined: Wed Jan 11, 2012 3:23 am

Re: @RunWith(Feeder.class) can't work

Postby Volker Bergmann » Wed Jan 11, 2012 7:43 am

Hi alice29fun,

Feed4JUnit depends on several other jars. Have a look at the lib directory contained in feed4junit-dist-*.zip and include all of them in the classpath.

After verifying that Feed4JUnit runs as expected, you can then remove the database driver libraries which you do not want to use.

Regards,
Volker 'databene' Bergmann

Need faster response times? phone support? onsite support? training? custom extensions? immediate bug fixes? Support Benerator evolution by buying services from Volker Bergmann!
User avatar
Volker Bergmann
 
Posts: 654
Joined: Sat Nov 10, 2007 2:40 pm

Re: @RunWith(Feeder.class) can't work

Postby alice29fun » Wed Jan 11, 2012 9:38 am

Volker Bergmann wrote:Hi alice29fun,

Feed4JUnit depends on several other jars. Have a look at the lib directory contained in feed4junit-dist-*.zip and include all of them in the classpath.

After verifying that Feed4JUnit runs as expected, you can then remove the database driver libraries which you do not want to use.

Regards,




Thank you very much for your answer
The problem is resolved
1.Must use jdk1.6,
jdk1.5 is not work.
2.need add the jars below
databene-benerator-0.7.4.jar
databene-commons-0.5.13.jar
databene-script-0.7.4.jar
databene-webdecs-0.6.5.jar
feed4junit-1.1.2.jar
hamcrest-core-1.1.jar
hsqldb-1.8.0.7.jar
junit-4.10.jar
log4j-1.2.13.jar
selenium-java-client-driver.jar
selenium-java-client-driver-sources.jar
selenium-java-client-driver-tests.jar
selenium-java-client-driver-test-sources.jar
selenium-server.jar
slf4j-api-1.5.11.jar
slf4j-log4j12-1.5.8.jar
validation-api-1.0.0.GA.jar

Thank you very much and have a nice day
alice29fun
 
Posts: 2
Joined: Wed Jan 11, 2012 3:23 am


Return to Feed4JUnit

Who is online

Users browsing this forum: No registered users and 1 guest

cron