[ 
https://jira.codehaus.org/browse/SUREFIRE-1096?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=353223#comment-353223
 ] 

Andreas Gudian commented on SUREFIRE-1096:
------------------------------------------

That exception is really emberrasing and we should deal with that case 
properly. But: forkCount=3 and reuseForks=true won't have much effect when 
using a suite.xml anyway. Surefire creates the forked JVMs, but TestNG is 
responsible for executing the units of work that we feed in. Typically, we feed 
in the test classes, which we would do indiviually in case of reuseForks=true 
and forkCount>1. In this case, we only have one unit of work that Surefire 
understands: that suite.xml. 
What we could (and should) support is to correctly feed in the suite.xml, and 
if there is more than one specified, feed them in separately in the different 
JVM forks.

I'll set the issue to fixVersion 2.18, but it's more likely that it won't make 
it into this one. I would then push it to the next release. In the meantime, it 
should work for you with forkCount=1.

Is that OK?

> ClassCastException: Fork test for TestNG with xmlsuite
> ------------------------------------------------------
>
>                 Key: SUREFIRE-1096
>                 URL: https://jira.codehaus.org/browse/SUREFIRE-1096
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: TestNG support
>    Affects Versions: 2.14, 2.15, 2.16, 2.17
>            Reporter: Michal Bocek
>            Assignee: Andreas Gudian
>             Fix For: 2.18
>
>
> When i setup surefire for forking tests via:
> <forkCount>3</forkCount>
> <reuseForks>true</reuseForks>
> <parallel>false</parallel>
> And i'm using TestNG provider with xml suite definition:
> <suiteXmlFiles>
> <suiteXmlFile>suite.xml</suiteXmlFile>
> </suiteXmlFiles>
> I'm getting exception:
> Caused by: java.lang.ClassCastException: java.io.File cannot be cast to 
> java.lang.Class
>       at 
> org.apache.maven.plugin.surefire.booterclient.ForkStarter.runSuitesForkOnceMultiple(ForkStarter.java:201)
>       at 
> org.apache.maven.plugin.surefire.booterclient.ForkStarter.run(ForkStarter.java:160)
>       at 
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeProvider(AbstractSurefireMojo.java:806)
>       at 
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked(AbstractSurefireMojo.java:701)
>       at 
> org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute(AbstractSurefireMojo.java:629)
>       at 
> org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:132)



--
This message was sent by Atlassian JIRA
(v6.1.6#6162)

Reply via email to