Giter VIP home page Giter VIP logo

Comments (5)

renatoathaydes avatar renatoathaydes commented on August 14, 2024 2

Hope you guys saw that now it's possible to write to the reports from any Specification by just using the reportHeader and reportInfo methods, see the README for details.

from spock-reports.

renatoathaydes avatar renatoathaydes commented on August 14, 2024

Hi @djocal sorry for the delay to answer...

I don't think it's possible to achieve this with spock-reports alone... I would think that Spock itself would need to support this first.

However, because of the dynamic features of Groovy, it may be possible to implement some hook in the report generator code which can be provided by your specification to add extra information to the report. Can you give me a realistic example of a situation where Spock String interpolation will not work and that would be useful to you?

Regards.

from spock-reports.

djocal avatar djocal commented on August 14, 2024

Hi Renato, even more sorry for the even bigger delay, here is a spec:

@Stepwise
class WritingInTheReportSpec extends Specification {
    String aFunction() {
        return "a function result"
    }

    def "spock capture string literals, and spock-reports write them in the report"() {
        expect: "this text is written in the report"
        4 == 2 + 2
    }

    def "spock do not capture a function result because considered part of the specification"() {
        expect: "this expression with ${aFunction()} does not appear in the report" // when you reformat the code with intellij => this goes to the line.
        6 == 3 + 3
    }

    @Unroll
    def "a Workaround is to put the function result in a where variable, and include the variable in string literal the spock way, with Unroll"() {
        expect: "here we retrieve #result and it appears in the report"
        8 == 4 + 4
        where:
        result      || _
        aFunction() || _
    }
}

We think an helper function in order to make work the second test here, without the workaround indicated in the third one.
Thank you for your opinion.
(notice that here the function is local, in reality we call external static code)

from spock-reports.

renatoathaydes avatar renatoathaydes commented on August 14, 2024

This should be a feature request to the spockframework project... I could make the html report resolve this string, but anywhere else you would see the unresolved String. Not as good as if Spock supported this.

from spock-reports.

kovax avatar kovax commented on August 14, 2024

I am looking for the same functionality.

@djocal It would be great to know if you have requested this feature from spockframework

from spock-reports.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.