-
Notifications
You must be signed in to change notification settings - Fork 9
feat: customizeable recording file name #143
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
Closed
Closed
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
41cb6bb
failing test
JonasPammer 2352d27
first try at ServiceLoader impl.
JonasPammer 10b0d43
chore: intellij
JonasPammer 29271bb
docs: much friendlier and easier english
JonasPammer 56c074f
refactor: factory pattern
JonasPammer ac29ef2
chore: keep the META-INF for showcase purpose?
JonasPammer edd4410
chore: make custom implementation clear
JonasPammer f96e0ca
docs: document factory
JonasPammer 019b3a2
docs: missing `
JonasPammer 4ab0034
chore: javadoc
JonasPammer d40e279
suggestion: also add ContainerGebConfiguration ability
JonasPammer 74e99de
code review comments
JonasPammer 1e9d3aa
chore: update year in license header
JonasPammer a1e1df1
feat: allow implementation to access errorInfo
JonasPammer 1688a72
refactor: ensure getter of implementation is used, to open up mocking…
JonasPammer 51e159b
chore: code review <3
JonasPammer 4dca4dc
chore: code review
JonasPammer ee8e02b
code review alterations
JonasPammer 3e57616
code review alterations
JonasPammer f68e603
move *Loader to grails.geb.serviceloader. as per https://github.com/g…
JonasPammer d97443f
dropped https://github.com/grails/geb/pull/143/commits/058d3b22b4522f…
JonasPammer 41b4590
oki
JonasPammer 20298a2
refactor to last PRs
JonasPammer f2b0a6b
rebase fixes
JonasPammer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
...c/integration-test/groovy/org/demo/spock/ContainerGebTestDescriptionAnnotationSpec.groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| package org.demo.spock | ||
|
|
||
| import grails.plugin.geb.ContainerGebConfiguration | ||
| import grails.plugin.geb.ContainerGebSpec | ||
| import grails.testing.mixin.integration.Integration | ||
|
|
||
| @Integration | ||
| @ContainerGebConfiguration(testDescription = ContainerGebTestDescriptionImpl) | ||
| class ContainerGebTestDescriptionAnnotationSpec extends ContainerGebSpec { | ||
|
|
||
| void 'should not raise a FileSystemException on recording save by loading custom implementation of ContainerGebTestDescription'(String data_driven_testing_param_1) { | ||
| when: | ||
| go '/' | ||
|
|
||
| then: | ||
| true | ||
|
|
||
| where: | ||
| data_driven_testing_param_1 << ['very long text lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet Liskov Substitution'] | ||
| } | ||
| } |
13 changes: 13 additions & 0 deletions
13
...est-app/src/integration-test/groovy/org/demo/spock/ContainerGebTestDescriptionImpl.groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| package org.demo.spock | ||
|
|
||
| import grails.plugin.geb.DefaultContainerGebTestDescription | ||
| import groovy.transform.CompileStatic | ||
|
|
||
| @CompileStatic | ||
| class ContainerGebTestDescriptionImpl extends DefaultContainerGebTestDescription { | ||
JonasPammer marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| @Override | ||
| String getTestId() { | ||
| return "Custom_${getIterationInfo().feature.spec.displayName}" | ||
| } | ||
| } | ||
34 changes: 34 additions & 0 deletions
34
...est-app/src/integration-test/groovy/org/demo/spock/ContainerGebTestDescriptionSpec.groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| package org.demo.spock | ||
|
|
||
| import grails.plugin.geb.ContainerGebSpec | ||
| import grails.plugin.geb.ContainerGebTestDescription | ||
| import grails.plugin.geb.serviceloader.ServiceRegistry | ||
| import grails.testing.mixin.integration.Integration | ||
|
|
||
| @Integration | ||
| class ContainerGebTestDescriptionSpec extends ContainerGebSpec { | ||
|
|
||
| def setupSpec(){ | ||
| ServiceRegistry.setInstance(ContainerGebTestDescription, new ContainerGebTestDescriptionImpl()) | ||
| } | ||
|
|
||
| def cleanupSpec(){ | ||
| ServiceRegistry.setInstance(ContainerGebTestDescription, null) | ||
| } | ||
|
|
||
| /** | ||
| * "The filename, directory name, or volume label syntax is incorrect" (too long) | ||
| */ | ||
| void 'should not raise a FileSystemException on recording save by loading custom implementation of ContainerGebTestDescription'(String data_driven_testing_param_1, String param_2, int param_3) { | ||
| when: | ||
| go '/' | ||
|
|
||
| then: | ||
| true | ||
|
|
||
| where: | ||
| data_driven_testing_param_1 << ['very long text lorem ipsum dolor sit amet lorem ipsum dolor sit amet lorem ipsum dolor sit amet Liskov Substitution'] | ||
| param_2 << ['If an implementation is hard to explain, it is an established design pattern.'] | ||
| param_3 << Integer.MAX_VALUE | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/testFixtures/groovy/grails/plugin/geb/DefaultContainerGebTestDescription.groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| /* | ||
| * Copyright 2024-2025 original author or authors | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package grails.plugin.geb | ||
|
|
||
| import groovy.transform.CompileStatic | ||
| import org.spockframework.runtime.model.ErrorInfo | ||
| import org.spockframework.runtime.model.IterationInfo | ||
|
|
||
| /** | ||
| * Implements {@link org.testcontainers.lifecycle.TestDescription} to customize recording names. | ||
| * | ||
| * @author James Daugherty | ||
| * @since 4.2 | ||
| */ | ||
| @CompileStatic | ||
| class DefaultContainerGebTestDescription implements ContainerGebTestDescription { | ||
|
|
||
| IterationInfo iterationInfo | ||
| ErrorInfo errorInfo | ||
|
|
||
| @Override | ||
| String getTestId() { | ||
| return [ | ||
| iterationInfo.feature.spec.displayName, | ||
| iterationInfo.feature.displayName, | ||
| iterationInfo.displayName != iterationInfo.feature.displayName ? iterationInfo.displayName : null, | ||
| iterationInfo.displayName != iterationInfo.feature.displayName ? iterationInfo.iterationIndex : null | ||
| ].findAll(/* Remove nulls */).join(' ') | ||
| } | ||
|
|
||
| @Override | ||
| String getFilesystemFriendlyName() { | ||
| String safeName = getTestId().replaceAll('\\W+', '_') | ||
| return safeName | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Used by {@link ContainerGebConfiguration#testDescription()} interface to represent a null value. | ||
| */ | ||
| class NullContainerGebTestDescription extends DefaultContainerGebTestDescription {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.