Quantcast

Got 'initializationError' when run junit test class with maven.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Got 'initializationError' when run junit test class with maven.

Linghua Wang
Hi, all,

I am encounting with a fatal error while I try to run Junit by maven. I give
the information of my env as followings.

*Information of maven installed on my local host.*

Command :  mvn --version
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -
Java version: 1.6.0_03
Default locale: zh_CN, platform encoding: UTF-8
OS name: "linux" version: "2.6.27-10-generic" arch: "i386" family: "unix"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - - - - - -

*Junit Test Jar And Configration.*

junit-4.5.jar.  Currently, I am building the project C. Pro-C has a direct
parent Pro-B and Pro-B has a direct parent Pro-A. A and B were designed with
pom packaging.

Junit related dependence declaration in A.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
<dependencyManagement>
<dependencies>
<dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>4.5</version>
  </dependency>
</dependencies>
</dependencyManagement>

... in B
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    <project>...
     <dependencies>
    <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
     </dependency>
     </dependencies>
    ...</project>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

None in C.

*My Test Case Design*:

@RunWith(Parameterized.class)


*Result*:
I executed mvn:test to try get all my test classes run. Unfortunately, maven
reported a error to me and just showed the type of error

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Tests in error:
  initializationError(FULL_CLASS_NAME).
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

I can not address this issue only by this error.
Is there a switch in maven to let me get all the tracking stack? Or is it
result from the compatiblity issue among  maven, junit and JDK?  Any
suggestions would be welcome.

Thank you.

Linghua
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Got 'initializationError' when run junit test class with maven.

Wayne Fay
> I can not address this issue only by this error.

The people on this list probably can't address this issue only by the
info in the email. Can you package up a sample project that shows the
error, and attach it to a new JIRA issue?

> Is there a switch in maven to let me get all the tracking stack? Or is it
> result from the compatiblity issue among  maven, junit and JDK?  Any
> suggestions would be welcome.

Did you try "mvn -X test" and/or scanning the output provided by
Surefire (in target/surefire-reports)?

Wayne

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Got 'initializationError' when run junit test class with maven.

Linghua Wang
Hi, Wayne,

Thanks for your continuous attention to my question. Seem that I should dig
more before posting a question. :-)

I am just going to answer my questions by myself.

Q: Is there a switch in maven to let me get all the tracking stack?

A: - We can find out the exception track stack in the surefire report after
execution the command:
       mvn surefire-report:report
       surefire report with HTML format  file under
../target/site/surefire-report.html.

What I have done:

1. Execute *mvn -Dmaven.surefire.debug test*, and configure the default
listening port(5005) on your IDE.

2. I found out the root cause - Test classes can not load the xml files
which contain all test data  files properly... Let me ignore my mistake,
just give the final solution here.

 Maven Test ClassPath:    ..target/test-classes/
 XML input data file: ..target/test-classes/data/input.xml

My solution:
 InputStream inputStream = MyJunitTest.class.getResourceAsStream(
"/data/input.xml");


Thank you!


2008/12/15 Wayne Fay <[hidden email]>

> > I can not address this issue only by this error.
>
> The people on this list probably can't address this issue only by the
> info in the email. Can you package up a sample project that shows the
> error, and attach it to a new JIRA issue?
>
> > Is there a switch in maven to let me get all the tracking stack? Or is it
> > result from the compatiblity issue among  maven, junit and JDK?  Any
> > suggestions would be welcome.
>
> Did you try "mvn -X test" and/or scanning the output provided by
> Surefire (in target/surefire-reports)?
>
> Wayne
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Loading...