Contributions
Re: Get test step name via property expansion in groovy step
nmrao Thanks for the reply. Switching to a better naming convention is actually our main cause of test step renames.. 😉 Using the same type of request multiple times in a test case is not uncommon in this project either. Also, if you would use that, dynamically by method or whatever, or something like CONTAINS as suggested in the other reply: it gets harder for a human reader to understand what is actually being pointed at, and if it still is correctly being pointed at. Basically we want to point to a test step with a reference instead of a string literal, so that it automatically adjusts. But for human readability it should still include the test step name.2 years agoPlace ReadyAPI QuestionsReadyAPI Questions730Views0likes0CommentsRe: Get test step name via property expansion in groovy step
JoostDGThanks for the reply. Sadly none of the suggestions are quite what I'm looking for. For the polling example we do use the following a lot, as it's mostly the preceding test step: testStep = context.testCase.getTestStepAt(context.getCurrentStepIndex()-1).getLabel() As you already said "Of course, if you start changing the order of the target test steps this will no longer work neither." Unfortunately for us, that is also something we do quite a lot, adding new test steps.. CONTAINS.. might be more groovy, but robust? 😉 I feel this would just add insult to injury: instead of at least knowing what's happening it'd become pretty much random if a test case ends up broken or not after a test step name change. If you managed to remember what you're allowed to change it would work of course. But that'd basically require a naming convention based around this. Could work in a new project, but we already have around 10k test steps in our project. getTestStepById() might be robust, but indeed nowhere near intuitive enough. When designing/maintaining it would be too much extra effort, as you can't easily see the GUIDs in the UI. And even if you could, as GUIDs are not easily compared at a glance, it would be hard to quickly see what test step it is actually referring to.2 years agoPlace ReadyAPI QuestionsReadyAPI Questions782Views0likes2CommentsGet test step name via property expansion in groovy step
Is it possible to get the test step name via a property expansion, or some other method that is automatically adjusted along with test step name changes? When a property expansion is used in a groovy step, it is automatically updated when the test step name is changed. For example, have the following property in a groovy step: def id = context.expand( '${TestStep 1#id}' ) Change the name of the referred test step "TestStep 1" to "01 - test step" and this is automatically adjusted to: def id = context.expand( '${01 - test step#id}' ) In our project we use some scripts to for example repeat a rest request step until the expected response is returned, or until a maximum number of attempts has been reached. In those scripts we refer to the test step to repeat by name: def testStep = "TestStep 1" Poll(testStep, responseProperty, expectedValue) ^ our "Poll"-method repeats "testStep" until the value of that test step's "responseProperty" is equal to the "expectedValue". Or a maximum number of 20 tries with a time out of 500 milliseconds between each attempt is reached. But that "testStep"-variable is not automatically adjusted along with test step name changes. We have some other methods that also rely on referring to a rest request test step by name from another groovy test step. As we use this a lot, changing test step names always comes with the risk of breaking tests.855Views0likes5CommentsRe: ReadyAPI 3.1 - TestRunner - An illegal reflective access operation has occurred
We had a similar issue in our installation. A succesful workaround for us has been to add "--add-opens=java.base/java.util.regex=ALL-UNNAMED" to the JAVA_OPTS in the testrunner. Our warning was: "WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedConstructor$1 (file:/C:/Program%20Files/SmartBear/ReadyAPI-3.1.0/lib/groovy-all-2.4.17.jar) to constructor java.util.regex.Matcher()"5 years agoPlace ReadyAPI QuestionsReadyAPI Questions558Views1like1Comment