spock: `setupSpec()` execution order is incorrect.
Describe the bug
DerivedSpec in examples.
I rewrite the derivedSpecMethod method.
def derivedSpecMethod() {
setup:
println 'UT setup'
expect:
xx == yy
cleanup:
println 'UT cleanup'
where:
xx | yy
0 | 0
1 | 1
}
Then, stdout like this.
The setupSpec() execution order is incorrect.
To Reproduce
DerivedSpec in examples.
I rewrite the derivedSpecMethod method.
def derivedSpecMethod() {
setup:
println 'UT setup'
expect:
xx == yy
cleanup:
println 'UT cleanup'
where:
xx | yy
0 | 0
1 | 1
}
Then, stdout like this.
The setupSpec() execution order is incorrect.
Expected behavior
base setupSpec()
derived setupSpec()
base field initializer derived field initializer base setup() derived setup() UT setup UT cleanup derived cleanup() base cleanup() base field initializer derived field initializer base setup() derived setup() UT setup UT cleanup derived cleanup() base cleanup()
~base setupSpec()~ ~derived setupSpec()~
derived cleanupSpec() base cleanupSpec()
Actual behavior
base field initializer
derived field initializer
base setup()
derived setup()
UT setup
UT cleanup
derived cleanup()
base cleanup()
base field initializer
derived field initializer
base setup()
derived setup()
UT setup
UT cleanup
derived cleanup()
base cleanup()
base setupSpec()
derived setupSpec()
derived cleanupSpec()
base cleanupSpec()
Java version
oracle jdk1.8.0_371
Buildtool version
oracle jdk1.8.0_371 Maven 3.9.4 (dfbb324ad4a7c8fb0bf182e6d91b0ae20e3d2dd9)
What operating system are you using
Mac
Dependencies
me.fizz:spock-ut:jar:1.0.0-SNAPSHOT ± me.fizz:the-jar:jar:0.0.1-SNAPSHOT:test | ± org.springframework.boot:spring-boot-starter-web:jar:2.3.12.RELEASE:test | | ± org.springframework.boot:spring-boot-starter-json:jar:2.3.12.RELEASE:test | | | ± com.fasterxml.jackson.core:jackson-databind:jar:2.11.4:test | | | | ± com.fasterxml.jackson.core:jackson-annotations:jar:2.11.4:test | | | | - com.fasterxml.jackson.core:jackson-core:jar:2.11.4:test | | | ± com.fasterxml.jackson.datatype:jackson-datatype-jdk8:jar:2.11.4:test | | | ± com.fasterxml.jackson.datatype:jackson-datatype-jsr310:jar:2.11.4:test | | | - com.fasterxml.jackson.module:jackson-module-parameter-names:jar:2.11.4:test | | ± org.springframework.boot:spring-boot-starter-tomcat:jar:2.3.12.RELEASE:test | | | ± org.apache.tomcat.embed:tomcat-embed-core:jar:9.0.46:test | | | ± org.glassfish:jakarta.el:jar:3.0.3:test | | | - org.apache.tomcat.embed:tomcat-embed-websocket:jar:9.0.46:test | | ± org.springframework:spring-web:jar:5.2.15.RELEASE:test | | | - org.springframework:spring-beans:jar:5.2.15.RELEASE:test | | - org.springframework:spring-webmvc:jar:5.2.15.RELEASE:test | | ± org.springframework:spring-aop:jar:5.2.15.RELEASE:test | | ± org.springframework:spring-context:jar:5.2.15.RELEASE:test | | - org.springframework:spring-expression:jar:5.2.15.RELEASE:test | ± com.baomidou:mybatis-plus-boot-starter:jar:3.3.2:test | | ± com.baomidou:mybatis-plus:jar:3.3.2:test | | | - com.baomidou:mybatis-plus-extension:jar:3.3.2:test | | | ± com.baomidou:mybatis-plus-core:jar:3.3.2:test | | | | ± com.baomidou:mybatis-plus-annotation:jar:3.3.2:test | | | | ± com.github.jsqlparser:jsqlparser:jar:3.1:test | | | | - org.mybatis:mybatis:jar:3.5.4:test | | | - org.mybatis:mybatis-spring:jar:2.0.4:test | | ± org.springframework.boot:spring-boot-autoconfigure:jar:2.3.12.RELEASE:test | | - org.springframework.boot:spring-boot-starter-jdbc:jar:2.3.12.RELEASE:test | | ± com.zaxxer:HikariCP:jar:3.4.5:test | | - org.springframework:spring-jdbc:jar:5.2.15.RELEASE:test | | - org.springframework:spring-tx:jar:5.2.15.RELEASE:test | ± com.alibaba:druid-spring-boot-starter:jar:1.2.16:test | | ± com.alibaba:druid:jar:1.2.16:test | | - org.slf4j:slf4j-api:jar:1.7.30:test | ± mysql:mysql-connector-java:jar:8.0.25:test | ± org.apache.shardingsphere:sharding-jdbc-spring-boot-starter:jar:4.0.0-RC1:test | | ± org.apache.shardingsphere:sharding-jdbc-core:jar:4.0.0-RC1:test | | | ± org.apache.shardingsphere:sharding-core-entry:jar:4.0.0-RC1:test | | | | ± org.apache.shardingsphere:sharding-core-parse-common:jar:4.0.0-RC1:test | | | | | ± org.apache.shardingsphere:sharding-core-parse-spi:jar:4.0.0-RC1:test | | | | | ± org.apache.commons:commons-collections4:jar:4.2:test | | | | | - org.antlr:antlr4-runtime:jar:4.7.1:test | | | | ± org.apache.shardingsphere:sharding-core-parse-mysql:jar:4.0.0-RC1:test | | | | ± org.apache.shardingsphere:sharding-core-parse-postgresql:jar:4.0.0-RC1:test | | | | ± org.apache.shardingsphere:sharding-core-parse-oracle:jar:4.0.0-RC1:test | | | | ± org.apache.shardingsphere:sharding-core-parse-sqlserver:jar:4.0.0-RC1:test | | | | ± org.apache.shardingsphere:sharding-core-optimize:jar:4.0.0-RC1:test | | | | ± org.apache.shardingsphere:sharding-core-route:jar:4.0.0-RC1:test | | | | ± org.apache.shardingsphere:sharding-core-rewrite:jar:4.0.0-RC1:test | | | | ± org.apache.shardingsphere:sharding-core-execute:jar:4.0.0-RC1:test | | | | - org.apache.shardingsphere:sharding-core-merge:jar:4.0.0-RC1:test | | | - org.apache.shardingsphere:sharding-transaction-core:jar:4.0.0-RC1:test | | ± com.google.guava:guava:jar:18.0:test | | - org.slf4j:jcl-over-slf4j:jar:1.7.30:test | - org.apache.shardingsphere:sharding-core-common:jar:4.0.0-RC1:test | ± org.apache.shardingsphere:sharding-core-api:jar:4.0.0-RC1:test | ± org.yaml:snakeyaml:jar:1.26:test | - commons-codec:commons-codec:jar:1.14:test ± org.springframework.boot:spring-boot-starter-test:jar:2.3.12.RELEASE:test | ± org.springframework.boot:spring-boot-starter:jar:2.3.12.RELEASE:test | | ± org.springframework.boot:spring-boot:jar:2.3.12.RELEASE:test | | ± org.springframework.boot:spring-boot-starter-logging:jar:2.3.12.RELEASE:test | | | ± ch.qos.logback:logback-classic:jar:1.2.3:test | | | | - ch.qos.logback:logback-core:jar:1.2.3:test | | | ± org.apache.logging.log4j:log4j-to-slf4j:jar:2.13.3:test | | | | - org.apache.logging.log4j:log4j-api:jar:2.13.3:test | | | - org.slf4j:jul-to-slf4j:jar:1.7.30:test | | - jakarta.annotation:jakarta.annotation-api:jar:1.3.5:test | ± org.springframework.boot:spring-boot-test:jar:2.3.12.RELEASE:test | ± org.springframework.boot:spring-boot-test-autoconfigure:jar:2.3.12.RELEASE:test | ± com.jayway.jsonpath:json-path:jar:2.4.0:test | | - net.minidev:json-smart:jar:2.3.1:test | | - net.minidev:accessors-smart:jar:2.3.1:test | | - org.ow2.asm:asm:jar:5.0.4:test | ± jakarta.xml.bind:jakarta.xml.bind-api:jar:2.3.3:test | | - jakarta.activation:jakarta.activation-api:jar:1.2.2:test | ± org.assertj:assertj-core:jar:3.16.1:test | ± org.hamcrest:hamcrest:jar:2.2:test | ± org.junit.jupiter:junit-jupiter:jar:5.6.3:test | | ± org.junit.jupiter:junit-jupiter-api:jar:5.6.3:test | | ± org.junit.jupiter:junit-jupiter-params:jar:5.6.3:test | | - org.junit.jupiter:junit-jupiter-engine:jar:5.6.3:test | ± org.junit.vintage:junit-vintage-engine:jar:5.6.3:test | ± org.mockito:mockito-core:jar:3.3.3:test | | - net.bytebuddy:byte-buddy-agent:jar:1.10.22:test | ± org.mockito:mockito-junit-jupiter:jar:3.3.3:test | ± org.skyscreamer:jsonassert:jar:1.5.0:test | | - com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test | ± org.springframework:spring-core:jar:5.2.15.RELEASE:test | | - org.springframework:spring-jcl:jar:5.2.15.RELEASE:test | ± org.springframework:spring-test:jar:5.2.15.RELEASE:test | - org.xmlunit:xmlunit-core:jar:2.7.0:test ± org.junit.platform:junit-platform-launcher:jar:1.9.0:test | ± org.junit.platform:junit-platform-engine:jar:1.9.0:test | | ± org.opentest4j:opentest4j:jar:1.2.0:test | | - org.junit.platform:junit-platform-commons:jar:1.9.0:test | - org.apiguardian:apiguardian-api:jar:1.1.2:test ± org.spockframework:spock-core:jar:2.3-groovy-3.0:test | - org.codehaus.groovy:groovy:jar:3.0.19:test ± org.spockframework:spock-junit4:jar:2.3-groovy-3.0:test | - junit:junit:jar:4.13.2:test | - org.hamcrest:hamcrest-core:jar:2.2:test ± net.bytebuddy:byte-buddy:jar:1.14.8:test - org.objenesis:objenesis:jar:3.3:test
Additional context
nothing
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 31 (15 by maintainers)
I already told you, I ran the tests locally. But I only have a Windows box, so I ran it on Linux and MacOS on GitHub for your sake (because you are a Mac user), not mine.
This conversation ends here, if you cannot provide a reproducible sample. BTW, please do not think I am a Spock team member. I have no commit rights here. I am just a user, like you, albeit a somewhat experienced one. I do not speak for the Spock team, just trying to unburden them of some of their support work.