[ 
https://issues.apache.org/jira/browse/SUREFIRE-1073?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15020803#comment-15020803
 ] 

Julien Herr commented on SUREFIRE-1073:
---------------------------------------

It seems a simple listener could help:

{code:java}
public class IgnoreMissingDependencies implements IAnnotationTransformer {
    @Override
    public void transform(ITestAnnotation annotation, Class testClass, 
Constructor testConstructor, Method testMethod) {
        annotation.setIgnoreMissingDependencies(true);
    }
}
{code}

From: https://youtrack.jetbrains.com/issue/IDEA-141621

> method depends on nonexistent group, but group exists
> -----------------------------------------------------
>
>                 Key: SUREFIRE-1073
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1073
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: TestNG support
>    Affects Versions: 2.17
>         Environment: Mac OS X 10.9, TestNG 6.8.8
>            Reporter: Brandon Heller
>
> When running a whole project's tests from the command-line via 'mvn test', 
> test-ng test dependencies are correctly resolved, and all tests pass.  When 
> trying to run a single test from the command line that depends on another 
> test, I get a 'method depends on nonexistent group' error, with this output:
> {code}
> ....
> objc[24281]: Class JavaLaunchHelper is implemented in both 
> /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/bin/java 
> and 
> /Library/Java/JavaVirtualMachines/jdk1.7.0_51.jdk/Contents/Home/jre/lib/libinstrument.dylib.
>  One of the two will be used. Which one is undefined.
> Running com.fourwardnetworks.com.testngtest.TestNext
> Configuring TestNG with: TestNG652Configurator
> Results :
> Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] BUILD FAILURE
> [INFO] 
> ------------------------------------------------------------------------
> [INFO] Total time: 5.328s
> [INFO] Finished at: Sat Apr 05 15:34:03 PDT 2014
> [INFO] Final Memory: 27M/439M
> [INFO] 
> ------------------------------------------------------------------------
> [ERROR] Failed to execute goal 
> org.apache.maven.plugins:maven-surefire-plugin:2.17:test (default-test) on 
> project core: Execution default-test of goal 
> org.apache.maven.plugins:maven-surefire-plugin:2.17:test failed: There was an 
> error in the forked process
> [ERROR] org.testng.TestNGException:
> [ERROR] DependencyMap::Method "TestNext.runMeNext()[pri:0, 
> instance:com.fourwardnetworks.com.testngtest.TestNext@6625abb1]" depends on 
> nonexistent group "MyGroup"
> [ERROR] at 
> org.testng.DependencyMap.getMethodsThatBelongTo(DependencyMap.java:46)
> [ERROR] at org.testng.TestRunner.createDynamicGraph(TestRunner.java:1074)
> [ERROR] at org.testng.TestRunner.privateRun(TestRunner.java:734)
> [ERROR] at org.testng.TestRunner.run(TestRunner.java:617)
> [ERROR] at org.testng.SuiteRunner.runTest(SuiteRunner.java:348)
> [ERROR] at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:343)
> [ERROR] at org.testng.SuiteRunner.privateRun(SuiteRunner.java:305)
> [ERROR] at org.testng.SuiteRunner.run(SuiteRunner.java:254)
> [ERROR] at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
> [ERROR] at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
> [ERROR] at org.testng.TestNG.runSuitesSequentially(TestNG.java:1224)
> [ERROR] at org.testng.TestNG.runSuitesLocally(TestNG.java:1149)
> [ERROR] at org.testng.TestNG.run(TestNG.java:1057)
> [ERROR] at 
> org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:115)
> [ERROR] at 
> org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.executeSingleClass(TestNGDirectoryTestSuite.java:128)
> [ERROR] at 
> org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:112)
> [ERROR] at 
> org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:112)
> [ERROR] at 
> org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:200)
> [ERROR] at 
> org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:153)
> [ERROR] at 
> org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
> {code}
> To replicate this, two files are sufficient:
> TestNext.java
> {code}
> package com.fourwardnetworks.com.testngtest;
> import org.testng.annotations.Test;
> public class TestNext {
>     @Test(dependsOnGroups = { "MyGroup" })
>     public void runMeNext() { }
> }
> {code}
> and TestFirst.java:
> {code}
> package com.fourwardnetworks.com.testngtest;
> import org.testng.annotations.Test;
> public class TestFirst {
>     @Test(groups = { "MyGroup" })
>     public void runMeFirst() { }
> }
> {code}
> And then run from the cmd line:
> {code}
>  mvn -Dtest=TestNext test
> {code}
> ... you get the error above.  When run from within Eclipse, by right-clicking 
> on function testNext, then going to Debug As -> TestNG Test, the dependent 
> test runs correctly for this test case, but not for the bug "in the wild" - 
> no idea why.
> Putting the two functions into one file, running from the command line, works 
> as well. I have to assume it's some issue with generated config.
> Any pointers to help fix this?  Thanks.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to