renatoathaydes / spock-reports

This project creates a global extension to Spock to create test reports.
Apache License 2.0
273 stars 68 forks source link

Parameter value not showing in the step name #226

Closed Sassan-SurePay closed 1 year ago

Sassan-SurePay commented 2 years ago

Hi there,

I'm trying to refer to parameter name in my step definition e.g. when: "I need to see this parameter value #parameterName"

But the parameter value doesn't show in the final report. Please see the screenshots below:

Screenshot 2022-03-07 at 09 10 34

Screenshot 2022-03-07 at 09 11 10

renatoathaydes commented 2 years ago

This was working fine in Spock 1, but seems to have stopped working in certain cases in Spock 2.

renatoathaydes commented 2 years ago

I think this has to do with @Unroll being now the default... did you mark your test with whatever the NOT-unrolled annotation is or it's unrolled?

Sassan-SurePay commented 2 years ago

Hi, I have tried with both unrolled and regular versions of the report. The result is the same.

renatoathaydes commented 2 years ago

This scenario is included in the tests.

See com.athaydes.spockframework.report.FakeTest and the expected reports using in the assertions:

Only the unrolled case is checked because there is no way to resolve the parameter otherwise, as the block shows up only once and there are potentially many values the block variable could have, so which one should we use?

I tried this spec for manual tests:

import spock.lang.Specification
import spock.lang.Unroll

class MySpec extends Specification {

    @Unroll
    def 'check values'( ){
        expect: 'parameter has value #value'
        true

        where:
        value << [1, 2, 3]
    }
}

Result:

Screen Shot 2022-08-25 at 19 23 42

As the tests are passing, there must be something in your environment or tests that is different than the tests are checking.

Can you provide a specification that presents this problem even with an unrolled annotation?

renatoathaydes commented 1 year ago

Closing this due to lack of feedback.