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

Tibor Digana edited comment on SUREFIRE-1553 at 5/4/20, 11:01 PM:
------------------------------------------------------------------

[~skrser]
[~clarkperkins]
You said that the method is empty:
{code:xml}
<testcase name="" classname="com.skrser.surefire.test.CalculatorSpockTest" 
time="0.078"/>
{code}

My problem is that {{TestIdentifier}} is {{ClassSource}} instead of 
{{MethodSource}}, even if the {{TestIdentifier#isTest()}} returns {{true}}.
My question is. How should I extract the method name if the test is class 
source?
Obviously it does not make logical sense. I can see in the debugger that the 
JUnit5 is running your method but the TestIdentifier says that it is a class. 
The class has the display name {{"Multiply: #a * #b = #expectedResult"}} but it 
should be understood as the displayname of the class and not the method. In 
order to extract the real method name, the TestIdentifier should be 
MethodSource and I will have an access to both the method and class name as 
well as their real display names by the annotation @DisplayName.
So from my point of view you should report a bug in 
[Spock|https://github.com/spockframework/spock/tree/master/spock-core] and 
provide a link to my comment. Provide the Spock team with [your first test 
project|https://github.com/skrser/maven-surefire-unroll].


was (Author: tibor17):
[~skrser]
[~clarkperkins]
You said that the method is empty:
{code:xml}
<testcase name="" classname="com.skrser.surefire.test.CalculatorSpockTest" 
time="0.078"/>
{code}

My problem is that {{TestIdentifier}} is {{ClassSource}} instead of 
{{MethodSource}}, even if the {{TestIdentifier#isTest()}} returns {{true}}.
My question is. How should I extract the method name if the test is class 
source?
Obviously it does not make logical sense. I can see in the debugger that the 
JUnit5 is running your method but the TestIdentifier says that it is a class. 
The class has the display name {{"Multiply: #a * #b = #expectedResult"}} but it 
should be understood as the displayname of the class and not the method. In 
order to extract the real method name, the TestIdentifier should be 
MethodSource and I will have an access to the method and name as well as their 
real display names by the annotation @DisplayName.
So from my point of view you should report a bug in 
[Spock|https://github.com/spockframework/spock/tree/master/spock-core] and 
provide a link to my comment. Provide the Spock team with [your first test 
project|https://github.com/skrser/maven-surefire-unroll].

> @Unroll forces usage of JUnit Vintage
> -------------------------------------
>
>                 Key: SUREFIRE-1553
>                 URL: https://issues.apache.org/jira/browse/SUREFIRE-1553
>             Project: Maven Surefire
>          Issue Type: Bug
>          Components: JUnit 5.x support, Maven Surefire Plugin
>    Affects Versions: 2.22.0, 3.0.0-M4
>            Reporter: Sergey Skryabin
>            Assignee: Tibor Digana
>            Priority: Major
>
> If run
> {code}mvn clean test{code}
> JUnit4 tests and Spock tests (which not contain @Unroll) are executed 
> normally. Once Spock test with @Unroll annotation appears, then Surefire 
> execute
> {code}[INFO] Running JUnit Vintage{code}
>  and all other JUnit4 tests and Spock tests are wrapped with this runner. 
> In surefire-reports I see _TEST-<all tests executed before meeting 
> @Unroll>.xml_ s and than
> _TEST-JUnit Vintage.xml_
> Though it could be done by intention, behaviour is different from 2.21.0 (no 
> wrapping with Vintage). Also it much more visible to have separate reports 
> per test class (both in console output and surefire-reports folder).
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to