maven-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tibor Digana (JIRA)" <j...@apache.org>
Subject [jira] [Closed] (SUREFIRE-1172) Incompatibility with MultipleFailureException
Date Tue, 18 Aug 2015 13:53:45 GMT

     [ https://issues.apache.org/jira/browse/SUREFIRE-1172?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Tibor Digana closed SUREFIRE-1172.
----------------------------------
    Resolution: Duplicate
      Assignee: Tibor Digana

Reported total #tests should not be duplicated with failures/errors.

> Incompatibility with MultipleFailureException
> ---------------------------------------------
>
>                 Key: SUREFIRE-1172
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1172
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: Junit 4.x support, Maven Surefire Plugin
>         Environment: junit 4.12
> maven-surefire-plugin 2.18.1
>            Reporter: Alberto Scotto
>            Assignee: Tibor Digana
>
> Given this test:
> {code}
> public class MyTest {
>     @Rule public ErrorCollector errorCollector = new ErrorCollector();
>     @Test
>     public void test() {
>         errorCollector.checkThat("asd", CoreMatchers.startsWith("B"));
>         errorCollector.checkThat("asd", CoreMatchers.startsWith("C"));
>     }
> }
> {code}
> mvn clean test will produce the following output:
> {code}
> -------------------------------------------------------
>  T E S T S
> -------------------------------------------------------
> Running MyTest
> Tests run: 2, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 0.089 sec <<<
FAILURE!
> test(MyTest)  Time elapsed: 0.019 sec  <<< FAILURE!
> java.lang.AssertionError:
> Expected: a string starting with "B"
>      but: was "asd"
> 	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
> 	at org.junit.Assert.assertThat(Assert.java:956)
> 	at org.junit.rules.ErrorCollector$1.call(ErrorCollector.java:65)
> 	at org.junit.rules.ErrorCollector.checkSucceeds(ErrorCollector.java:78)
> 	at org.junit.rules.ErrorCollector.checkThat(ErrorCollector.java:63)
> 	at org.junit.rules.ErrorCollector.checkThat(ErrorCollector.java:54)
> 	at MyTest.test(MyTest.java:19)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:497)
> 	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
> 	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
> 	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
> 	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
> 	at org.junit.rules.Verifier$1.evaluate(Verifier.java:35)
> 	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
> 	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
> 	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
> 	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
> 	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
> 	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
> 	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
> 	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
> 	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
> 	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
> 	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:497)
> 	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
> 	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
> 	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
> 	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
> 	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
> test(MyTest)  Time elapsed: 0.02 sec  <<< FAILURE!
> java.lang.AssertionError:
> Expected: a string starting with "C"
>      but: was "asd"
> 	at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
> 	at org.junit.Assert.assertThat(Assert.java:956)
> 	at org.junit.rules.ErrorCollector$1.call(ErrorCollector.java:65)
> 	at org.junit.rules.ErrorCollector.checkSucceeds(ErrorCollector.java:78)
> 	at org.junit.rules.ErrorCollector.checkThat(ErrorCollector.java:63)
> 	at org.junit.rules.ErrorCollector.checkThat(ErrorCollector.java:54)
> 	at MyTest.test(MyTest.java:20)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:497)
> 	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
> 	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
> 	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
> 	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
> 	at org.junit.rules.Verifier$1.evaluate(Verifier.java:35)
> 	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
> 	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
> 	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
> 	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
> 	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
> 	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
> 	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
> 	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
> 	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
> 	at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
> 	at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
> 	at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> 	at java.lang.reflect.Method.invoke(Method.java:497)
> 	at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
> 	at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
> 	at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
> 	at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
> 	at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
> Results :
> Failed tests:   test(MyTest): (..)
>   test(MyTest): (..)
> Tests run: 2, Failures: 2, Errors: 0, Skipped: 0
> {code}
> Actual: "Tests run: 2, Failures: 2, Errors: 0, Skipped: 0"
> Expected: "Test run: 1, Failures: 2"
> You may be interested in having a look at this snippet:
> https://github.com/junit-team/junit/blob/master/src/main/java/org/junit/internal/runners/model/EachTestNotifier.java#L21
> Thanks



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

Mime
View raw message