Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ArrayIndexOutOfBoundsException at method featureNameFrom #73

Closed
tilmanginzel opened this issue Jun 13, 2016 · 4 comments
Closed

ArrayIndexOutOfBoundsException at method featureNameFrom #73

tilmanginzel opened this issue Jun 13, 2016 · 4 comments
Labels

Comments

@tilmanginzel
Copy link
Contributor

I came across the following stacktrace, probably as a result of the fix for #70. I omitted most of it due to its length of 212 rows. The important part seems to be the call of the method com.athaydes.spockframework.report.internal.HtmlReportCreator.featureNameFrom

I still need to figure out why this occurred and hopefully can come up with a minimal specification producing this.

18:10:25.539 [Test worker] WARN  c.a.s.r.internal.HtmlReportCreator - Failed to create report for MySpec
java.lang.ArrayIndexOutOfBoundsException: 0
    at org.spockframework.runtime.extension.builtin.UnrollNameProvider.evaluateExpression(UnrollNameProvider.java:74) ~[spock-core-1.0-groovy-2.4.jar:na]
    at org.spockframework.runtime.extension.builtin.UnrollNameProvider.nameFor(UnrollNameProvider.java:53) ~[spock-core-1.0-groovy-2.4.jar:na]
    at org.spockframework.runtime.extension.builtin.UnrollNameProvider.getName(UnrollNameProvider.java:44) ~[spock-core-1.0-groovy-2.4.jar:na]
    at org.spockframework.runtime.extension.builtin.UnrollNameProvider$getName.call(Unknown Source) ~[na:na]
    at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48) ~[groovy-all-2.4.5.jar:2.4.5]
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113) ~[groovy-all-2.4.5.jar:2.4.5]
    at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:125) ~[groovy-all-2.4.5.jar:2.4.5]
    at com.athaydes.spockframework.report.internal.HtmlReportCreator.featureNameFrom(HtmlReportCreator.groovy:212) ~[spock-reports-1.2.12.jar:1.2.12]
    [...]
@renatoathaydes
Copy link
Owner

After merging your PR and pulling from master, I think this issue comes from this line: org.spockframework.runtime.model.FeatureInfo:136#getIterationNameProvider, after being called from com/athaydes/spockframework/report/internal/HtmlReportCreator.groovy:156.

By the way, there's a branch called next which is supposed to be target for pull requests (so unreleased features do not show up in master). Please use that if possible.

@tilmanginzel
Copy link
Contributor Author

tilmanginzel commented Jun 14, 2016

Yeah sorry, I will use the next branch in the future.

Here is an example specification which produces the error.

class BrokenSpec extends Specification {
    @Shared def x = 1/0

    @Unroll()
    def "broken feature with #x"() {
        expect:
        x == 1

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

So, if an initialization error is thrown and you try to use the #variable syntax in the description, it fails. Most probably because the data provider is still empty at that point. The fix is quite simple, I will provide a pull request soon.

@renatoathaydes
Copy link
Owner

This bug is already fixed, right @tilmanginzel ? Pretty sure I released the fix?!

@tilmanginzel
Copy link
Contributor Author

tilmanginzel commented Nov 21, 2016

Yes, it was fixed on master in June, so it definitely should be in the latest release 1.2.13.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants