From 0b8acddff541b20712da48b7adc5f5952e4e0d17 Mon Sep 17 00:00:00 2001 From: Brian Koehmstedt <1261658+bkoehm@users.noreply.github.com> Date: Fri, 20 Dec 2024 14:48:26 -0800 Subject: [PATCH] Grails 7: add Stepwise to tests --- .../integration-test/groovy/spec/AclClassSpec.groovy | 2 ++ .../integration-test/groovy/spec/AclEntrySpec.groovy | 2 ++ .../groovy/spec/AclObjectIdentitySpec.groovy | 2 ++ .../src/integration-test/groovy/spec/AclSidSpec.groovy | 2 ++ .../groovy/spec/ExtendedMenuSpec.groovy | 2 ++ .../groovy/spec/ExtendedSecurityInfoSpec.groovy | 2 ++ .../groovy/spec/PersistentLoginSpec.groovy | 2 ++ .../integration-test/groovy/spec/RegisterSpec.groovy | 2 ++ .../groovy/spec/RegistrationCodeSpec.groovy | 2 ++ .../integration-test/groovy/spec/RequestmapSpec.groovy | 2 ++ .../src/integration-test/groovy/spec/RoleSpec.groovy | 2 ++ .../src/integration-test/groovy/spec/UserSpec.groovy | 10 ++++++++++ .../groovy/test/ProfileServiceSpec.groovy | 3 ++- .../groovy/spec/DefaultMenuSpec.groovy | 2 ++ .../groovy/spec/DefaultSecurityInfoSpec.groovy | 2 ++ .../groovy/spec/RegistrationCodeSpec.groovy | 2 ++ .../integration-test/groovy/spec/RequestmapSpec.groovy | 2 ++ .../src/integration-test/groovy/spec/RoleSpec.groovy | 2 ++ .../integration-test/groovy/spec/UserSimpleSpec.groovy | 10 ++++++++++ 19 files changed, 54 insertions(+), 1 deletion(-) diff --git a/examples/extended/src/integration-test/groovy/spec/AclClassSpec.groovy b/examples/extended/src/integration-test/groovy/spec/AclClassSpec.groovy index 327a80c1..70d90a25 100644 --- a/examples/extended/src/integration-test/groovy/spec/AclClassSpec.groovy +++ b/examples/extended/src/integration-test/groovy/spec/AclClassSpec.groovy @@ -4,7 +4,9 @@ import grails.testing.mixin.integration.Integration import page.aclClass.AclClassCreatePage import page.aclClass.AclClassEditPage import page.aclClass.AclClassSearchPage +import spock.lang.Stepwise +@Stepwise @Integration class AclClassSpec extends AbstractSecuritySpec { diff --git a/examples/extended/src/integration-test/groovy/spec/AclEntrySpec.groovy b/examples/extended/src/integration-test/groovy/spec/AclEntrySpec.groovy index 68f8da8d..afa8ab1b 100644 --- a/examples/extended/src/integration-test/groovy/spec/AclEntrySpec.groovy +++ b/examples/extended/src/integration-test/groovy/spec/AclEntrySpec.groovy @@ -4,7 +4,9 @@ import grails.testing.mixin.integration.Integration import page.aclEntry.AclEntryCreatePage import page.aclEntry.AclEntryEditPage import page.aclEntry.AclEntrySearchPage +import spock.lang.Stepwise +@Stepwise @Integration class AclEntrySpec extends AbstractSecuritySpec { diff --git a/examples/extended/src/integration-test/groovy/spec/AclObjectIdentitySpec.groovy b/examples/extended/src/integration-test/groovy/spec/AclObjectIdentitySpec.groovy index 38e38b53..c96f74db 100644 --- a/examples/extended/src/integration-test/groovy/spec/AclObjectIdentitySpec.groovy +++ b/examples/extended/src/integration-test/groovy/spec/AclObjectIdentitySpec.groovy @@ -4,7 +4,9 @@ import grails.testing.mixin.integration.Integration import page.aclObjectIdentity.AclObjectIdentityCreatePage import page.aclObjectIdentity.AclObjectIdentityEditPage import page.aclObjectIdentity.AclObjectIdentitySearchPage +import spock.lang.Stepwise +@Stepwise @Integration class AclObjectIdentitySpec extends AbstractSecuritySpec { diff --git a/examples/extended/src/integration-test/groovy/spec/AclSidSpec.groovy b/examples/extended/src/integration-test/groovy/spec/AclSidSpec.groovy index d97f1ed8..ce240454 100644 --- a/examples/extended/src/integration-test/groovy/spec/AclSidSpec.groovy +++ b/examples/extended/src/integration-test/groovy/spec/AclSidSpec.groovy @@ -4,7 +4,9 @@ import grails.testing.mixin.integration.Integration import page.aclSid.AclSidCreatePage import page.aclSid.AclSidEditPage import page.aclSid.AclSidSearchPage +import spock.lang.Stepwise +@Stepwise @Integration class AclSidSpec extends AbstractSecuritySpec { diff --git a/examples/extended/src/integration-test/groovy/spec/ExtendedMenuSpec.groovy b/examples/extended/src/integration-test/groovy/spec/ExtendedMenuSpec.groovy index 47d6e97c..12a78faf 100644 --- a/examples/extended/src/integration-test/groovy/spec/ExtendedMenuSpec.groovy +++ b/examples/extended/src/integration-test/groovy/spec/ExtendedMenuSpec.groovy @@ -1,7 +1,9 @@ package spec import grails.testing.mixin.integration.Integration +import spock.lang.Stepwise +@Stepwise @Integration class ExtendedMenuSpec extends AbstractSecuritySpec { diff --git a/examples/extended/src/integration-test/groovy/spec/ExtendedSecurityInfoSpec.groovy b/examples/extended/src/integration-test/groovy/spec/ExtendedSecurityInfoSpec.groovy index dda5936c..d56c0bc9 100644 --- a/examples/extended/src/integration-test/groovy/spec/ExtendedSecurityInfoSpec.groovy +++ b/examples/extended/src/integration-test/groovy/spec/ExtendedSecurityInfoSpec.groovy @@ -3,7 +3,9 @@ package spec import grails.testing.mixin.integration.Integration import org.springframework.security.core.userdetails.User import org.springframework.security.core.userdetails.UserCache +import spock.lang.Stepwise +@Stepwise @Integration class ExtendedSecurityInfoSpec extends AbstractSecuritySpec { diff --git a/examples/extended/src/integration-test/groovy/spec/PersistentLoginSpec.groovy b/examples/extended/src/integration-test/groovy/spec/PersistentLoginSpec.groovy index d962ab74..939bc10d 100644 --- a/examples/extended/src/integration-test/groovy/spec/PersistentLoginSpec.groovy +++ b/examples/extended/src/integration-test/groovy/spec/PersistentLoginSpec.groovy @@ -2,7 +2,9 @@ package spec import grails.testing.mixin.integration.Integration import page.persistentLogin.PersistentLoginSearchPage +import spock.lang.Stepwise +@Stepwise @Integration class PersistentLoginSpec extends AbstractSecuritySpec { diff --git a/examples/extended/src/integration-test/groovy/spec/RegisterSpec.groovy b/examples/extended/src/integration-test/groovy/spec/RegisterSpec.groovy index 77afd3cf..75e5c87f 100644 --- a/examples/extended/src/integration-test/groovy/spec/RegisterSpec.groovy +++ b/examples/extended/src/integration-test/groovy/spec/RegisterSpec.groovy @@ -13,7 +13,9 @@ import page.user.UserEditPage import page.user.UserSearchPage import page.register.ResetPasswordPage import spock.lang.Ignore +import spock.lang.Stepwise +@Stepwise @Integration class RegisterSpec extends AbstractSecuritySpec { diff --git a/examples/extended/src/integration-test/groovy/spec/RegistrationCodeSpec.groovy b/examples/extended/src/integration-test/groovy/spec/RegistrationCodeSpec.groovy index 4a99b4c5..f6e4a26f 100644 --- a/examples/extended/src/integration-test/groovy/spec/RegistrationCodeSpec.groovy +++ b/examples/extended/src/integration-test/groovy/spec/RegistrationCodeSpec.groovy @@ -3,7 +3,9 @@ package spec import grails.testing.mixin.integration.Integration import page.registrationCode.RegistrationCodeEditPage import page.registrationCode.RegistrationCodeSearchPage +import spock.lang.Stepwise +@Stepwise @Integration class RegistrationCodeSpec extends AbstractSecuritySpec { diff --git a/examples/extended/src/integration-test/groovy/spec/RequestmapSpec.groovy b/examples/extended/src/integration-test/groovy/spec/RequestmapSpec.groovy index 68325929..1d745abd 100644 --- a/examples/extended/src/integration-test/groovy/spec/RequestmapSpec.groovy +++ b/examples/extended/src/integration-test/groovy/spec/RequestmapSpec.groovy @@ -4,7 +4,9 @@ import grails.testing.mixin.integration.Integration import page.requestmap.RequestmapCreatePage import page.requestmap.RequestmapEditPage import page.requestmap.RequestmapSearchPage +import spock.lang.Stepwise +@Stepwise @Integration class RequestmapSpec extends AbstractSecuritySpec { diff --git a/examples/extended/src/integration-test/groovy/spec/RoleSpec.groovy b/examples/extended/src/integration-test/groovy/spec/RoleSpec.groovy index ca6a3f75..18074c65 100644 --- a/examples/extended/src/integration-test/groovy/spec/RoleSpec.groovy +++ b/examples/extended/src/integration-test/groovy/spec/RoleSpec.groovy @@ -4,7 +4,9 @@ import grails.testing.mixin.integration.Integration import page.role.RoleCreatePage import page.role.RoleEditPage import page.role.RoleSearchPage +import spock.lang.Stepwise +@Stepwise @Integration class RoleSpec extends AbstractSecuritySpec { diff --git a/examples/extended/src/integration-test/groovy/spec/UserSpec.groovy b/examples/extended/src/integration-test/groovy/spec/UserSpec.groovy index 1035371c..51a94710 100644 --- a/examples/extended/src/integration-test/groovy/spec/UserSpec.groovy +++ b/examples/extended/src/integration-test/groovy/spec/UserSpec.groovy @@ -4,7 +4,10 @@ import grails.testing.mixin.integration.Integration import page.user.UserCreatePage import page.user.UserEditPage import page.user.UserSearchPage +import spock.lang.Stepwise +import test.User +@Stepwise @Integration class UserSpec extends AbstractSecuritySpec { @@ -12,6 +15,13 @@ class UserSpec extends AbstractSecuritySpec { when: to UserSearchPage + and: + User.withNewSession { + User.findAll().sort { it.username }.eachWithIndex { u, i -> + println "$i: ${u.username}" + } + } + then: assertNotSearched() diff --git a/examples/extended/src/integration-test/groovy/test/ProfileServiceSpec.groovy b/examples/extended/src/integration-test/groovy/test/ProfileServiceSpec.groovy index 874bec2c..c0e784b3 100644 --- a/examples/extended/src/integration-test/groovy/test/ProfileServiceSpec.groovy +++ b/examples/extended/src/integration-test/groovy/test/ProfileServiceSpec.groovy @@ -1,13 +1,14 @@ package test - import grails.gorm.transactions.Rollback import grails.testing.mixin.integration.Integration import grails.testing.services.ServiceUnitTest import org.spockframework.runtime.model.SpecInfo import spock.lang.Specification import org.hibernate.SessionFactory +import spock.lang.Stepwise +@Stepwise @Integration @Rollback class ProfileServiceSpec extends Specification { diff --git a/examples/simple/src/integration-test/groovy/spec/DefaultMenuSpec.groovy b/examples/simple/src/integration-test/groovy/spec/DefaultMenuSpec.groovy index 755ac7b8..48f90c85 100644 --- a/examples/simple/src/integration-test/groovy/spec/DefaultMenuSpec.groovy +++ b/examples/simple/src/integration-test/groovy/spec/DefaultMenuSpec.groovy @@ -1,7 +1,9 @@ package spec import grails.testing.mixin.integration.Integration +import spock.lang.Stepwise +@Stepwise @Integration class DefaultMenuSpec extends AbstractSecuritySpec { diff --git a/examples/simple/src/integration-test/groovy/spec/DefaultSecurityInfoSpec.groovy b/examples/simple/src/integration-test/groovy/spec/DefaultSecurityInfoSpec.groovy index dfff080b..0cf21949 100644 --- a/examples/simple/src/integration-test/groovy/spec/DefaultSecurityInfoSpec.groovy +++ b/examples/simple/src/integration-test/groovy/spec/DefaultSecurityInfoSpec.groovy @@ -3,7 +3,9 @@ package spec import grails.testing.mixin.integration.Integration import org.springframework.security.core.userdetails.User import org.springframework.security.core.userdetails.UserCache +import spock.lang.Stepwise +@Stepwise @Integration class DefaultSecurityInfoSpec extends AbstractSecuritySpec { diff --git a/examples/simple/src/integration-test/groovy/spec/RegistrationCodeSpec.groovy b/examples/simple/src/integration-test/groovy/spec/RegistrationCodeSpec.groovy index 4a99b4c5..f6e4a26f 100644 --- a/examples/simple/src/integration-test/groovy/spec/RegistrationCodeSpec.groovy +++ b/examples/simple/src/integration-test/groovy/spec/RegistrationCodeSpec.groovy @@ -3,7 +3,9 @@ package spec import grails.testing.mixin.integration.Integration import page.registrationCode.RegistrationCodeEditPage import page.registrationCode.RegistrationCodeSearchPage +import spock.lang.Stepwise +@Stepwise @Integration class RegistrationCodeSpec extends AbstractSecuritySpec { diff --git a/examples/simple/src/integration-test/groovy/spec/RequestmapSpec.groovy b/examples/simple/src/integration-test/groovy/spec/RequestmapSpec.groovy index 68325929..1d745abd 100644 --- a/examples/simple/src/integration-test/groovy/spec/RequestmapSpec.groovy +++ b/examples/simple/src/integration-test/groovy/spec/RequestmapSpec.groovy @@ -4,7 +4,9 @@ import grails.testing.mixin.integration.Integration import page.requestmap.RequestmapCreatePage import page.requestmap.RequestmapEditPage import page.requestmap.RequestmapSearchPage +import spock.lang.Stepwise +@Stepwise @Integration class RequestmapSpec extends AbstractSecuritySpec { diff --git a/examples/simple/src/integration-test/groovy/spec/RoleSpec.groovy b/examples/simple/src/integration-test/groovy/spec/RoleSpec.groovy index ca6a3f75..8f17ba1d 100644 --- a/examples/simple/src/integration-test/groovy/spec/RoleSpec.groovy +++ b/examples/simple/src/integration-test/groovy/spec/RoleSpec.groovy @@ -4,8 +4,10 @@ import grails.testing.mixin.integration.Integration import page.role.RoleCreatePage import page.role.RoleEditPage import page.role.RoleSearchPage +import spock.lang.Stepwise @Integration +@Stepwise class RoleSpec extends AbstractSecuritySpec { void testFindAll() { diff --git a/examples/simple/src/integration-test/groovy/spec/UserSimpleSpec.groovy b/examples/simple/src/integration-test/groovy/spec/UserSimpleSpec.groovy index 06e8fa42..2f5928ab 100644 --- a/examples/simple/src/integration-test/groovy/spec/UserSimpleSpec.groovy +++ b/examples/simple/src/integration-test/groovy/spec/UserSimpleSpec.groovy @@ -5,7 +5,10 @@ import page.user.UserCreatePage import page.user.UserEditPage import page.user.UserSearchPage import spock.lang.Issue +import spock.lang.Stepwise +import test.User +@Stepwise @Integration class UserSimpleSpec extends AbstractSecuritySpec { @@ -13,6 +16,13 @@ class UserSimpleSpec extends AbstractSecuritySpec { when: to UserSearchPage + and: + User.withNewSession { + User.findAll().sort { it.username }.eachWithIndex { u, i -> + println "$i: ${u.username}" + } + } + then: assertNotSearched()