Auf Thema antworten

Hi, ich habe ein ganz aehnliches Problem mit Maven und Junit. Auch ich bekomme bei meinem Test (in diesem Fall ein Test, der einfach Testdaten in die Datenbank einfuegt) folgende Meldung:


[CODE]mathias@id83:~/src/trainingbroker$ mvn -Dtest=InsertTestData test

[INFO] Scanning for projects...

[INFO]                                                                        

[INFO] ------------------------------------------------------------------------

[INFO] Building tbrest 1.0-SNAPSHOT

[INFO] ------------------------------------------------------------------------

[INFO]

[INFO] --- maven-resources-plugin:2.3:resources (default-resources) @ tbrest ---

[INFO] Using 'UTF-8' encoding to copy filtered resources.

[INFO] Copying 1 resource

[INFO]

[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ tbrest ---

[INFO] Nothing to compile - all classes are up to date

[INFO]

[INFO] --- maven-resources-plugin:2.3:testResources (default-testResources) @ tbrest ---

[INFO] Using 'UTF-8' encoding to copy filtered resources.

[INFO] Copying 1 resource

[INFO]

[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ tbrest ---

[INFO] Compiling 2 source files to /home/mathias/src/trainingbroker/target/test-classes

[INFO]

[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ tbrest ---

[INFO] Surefire report directory: /home/mathias/src/trainingbroker/target/surefire-reports


-------------------------------------------------------

 T E S T S

-------------------------------------------------------

Running net.vxpertise.tb.data.jpa.InsertTestData

May 16, 2014 11:36:39 AM org.hibernate.annotations.common.Version <clinit>

INFO: HCANN000001: Hibernate Commons Annotations {4.0.1.Final}

May 16, 2014 11:36:39 AM org.hibernate.Version logVersion

INFO: HHH000412: Hibernate Core {4.0.1.Final}

May 16, 2014 11:36:39 AM org.hibernate.cfg.Environment <clinit>

INFO: HHH000206: hibernate.properties not found

May 16, 2014 11:36:39 AM org.hibernate.cfg.Environment buildBytecodeProvider

INFO: HHH000021: Bytecode provider name : javassist

May 16, 2014 11:36:39 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

INFO: HHH000402: Using Hibernate built-in connection pool (not for production use!)

May 16, 2014 11:36:39 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

INFO: HHH000115: Hibernate connection pool size: 20

May 16, 2014 11:36:39 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

INFO: HHH000006: Autocommit mode: true

May 16, 2014 11:36:39 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

INFO: HHH000401: using driver [com.mysql.jdbc.Driver] at URL [jdbc:mysql://localhost:3306/trainingbroker]

May 16, 2014 11:36:39 AM org.hibernate.service.jdbc.connections.internal.DriverManagerConnectionProviderImpl configure

INFO: HHH000046: Connection properties: {user=trainingbroker, password=****, autocommit=true, release_mode=auto}

May 16, 2014 11:36:39 AM org.hibernate.dialect.Dialect <init>

INFO: HHH000400: Using dialect: org.hibernate.dialect.MySQLDialect

May 16, 2014 11:36:39 AM org.hibernate.engine.transaction.internal.TransactionFactoryInitiator initiateService

INFO: HHH000268: Transaction strategy: org.hibernate.engine.transaction.internal.jdbc.JdbcTransactionFactory

May 16, 2014 11:36:39 AM org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory <init>

INFO: HHH000397: Using ASTQueryTranslatorFactory

May 16, 2014 11:36:40 AM org.hibernate.validator.internal.util.Version <clinit>

INFO: HV000001: Hibernate Validator 5.1.1.Final

May 16, 2014 11:36:40 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute

INFO: HHH000228: Running hbm2ddl schema update

May 16, 2014 11:36:40 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute

INFO: HHH000102: Fetching database metadata

May 16, 2014 11:36:40 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute

INFO: HHH000396: Updating schema

May 16, 2014 11:36:40 AM org.hibernate.tool.hbm2ddl.SchemaUpdate execute

INFO: HHH000232: Schema update complete

Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.59 sec <<< FAILURE!


Results :


Tests in error:

  insert(net.vxpertise.tb.data.jpa.InsertTestData): Unknown entity: net.vxpertise.tb.data.model.tag.Tag


Tests run: 1, Failures: 0, Errors: 1, Skipped: 0


[INFO] ------------------------------------------------------------------------

[INFO] BUILD FAILURE

[INFO] ------------------------------------------------------------------------

[INFO] Total time: 6.027s

[INFO] Finished at: Fri May 16 11:36:40 CEST 2014

[INFO] Final Memory: 19M/169M

[INFO] ------------------------------------------------------------------------

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.10:test (default-test) on project tbrest: There are test failures.

[ERROR]

[ERROR] Please refer to /home/mathias/src/trainingbroker/target/surefire-reports for the individual test results.

[ERROR] -> [Help 1]

[ERROR]

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR]

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

mathias@id83:~/src/trainingbroker$[/CODE]


Im Target directory sieht es so aus:


[CODE]

mathias@id83:~/src/trainingbroker/target$ ls -l

total 28

drwxrwxr-x 4 mathias mathias 4096 Mai 16 11:35 classes

drwxrwxr-x 3 mathias mathias 4096 Mai 16 11:35 generated-sources

drwxrwxr-x 3 mathias mathias 4096 Mai 16 11:35 generated-test-sources

drwxrwxr-x 3 mathias mathias 4096 Mai 16 11:36 m2e-wtp

drwxrwxr-x 2 mathias mathias 4096 Mai 16 11:36 surefire

drwxrwxr-x 2 mathias mathias 4096 Mai 16 11:36 surefire-reports

drwxrwxr-x 4 mathias mathias 4096 Mai 16 11:35 test-classes

mathias@id83:~/src/trainingbroker/target$ find test-classes/

test-classes/

test-classes/META-INF

test-classes/META-INF/persistence.xml

test-classes/net

test-classes/net/vxpertise

test-classes/net/vxpertise/tb

test-classes/net/vxpertise/tb/data

test-classes/net/vxpertise/tb/data/jpa

test-classes/net/vxpertise/tb/data/jpa/InsertTestData.class

test-classes/net/vxpertise/tb/data/LinkFactoryTest.class

test-classes/net/vxpertise/tb/data/rest

test-classes/net/vxpertise/tb/data/rest/TrainingControllerTest.class

test-classes/net/vxpertise/tb/data/rest/TagControllerTest.class

mathias@id83:~/src/trainingbroker/target$ ls -l classes/

META-INF/ net/     

mathias@id83:~/src/trainingbroker/target$ ls -l classes/

META-INF/ net/     

mathias@id83:~/src/trainingbroker/target$ ls -l classes/net/vxpertise/tb/data/model/tag/

total 8

-rw-rw-r-- 1 mathias mathias 2655 Mai 16 11:35 Tag.class

-rw-rw-r-- 1 mathias mathias  326 Mai 16 11:35 Taggable.class

mathias@id83:~/src/trainingbroker/target$

[/CODE]


Also mein Tip ist, dass er beim compilieren der Tests die Files aus target/classes im Classpath hat, beim Ausfuehren dann aber nicht mehr ... Wie kann das sein?



Oben