spock-reports icon indicating copy to clipboard operation
spock-reports copied to clipboard

Parameter value not showing in the step name

Open Sassan-SurePay opened this issue 2 years ago • 4 comments

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

Sassan-SurePay avatar Mar 07 '22 08:03 Sassan-SurePay

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

renatoathaydes avatar Mar 11 '22 09:03 renatoathaydes

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?

renatoathaydes avatar Mar 11 '22 09:03 renatoathaydes

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

Sassan-SurePay avatar Mar 11 '22 09:03 Sassan-SurePay

This scenario is included in the tests.

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

  • src/test/resources/com/athaydes/spockframework/report/internal/FakeTestReport.html
  • src/test/resources/FakeTest.md

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 avatar Aug 25 '22 17:08 renatoathaydes

Closing this due to lack of feedback.

renatoathaydes avatar Oct 30 '22 18:10 renatoathaydes