Forum Discussion
ChrisAdams
Champion Level 2
4 years agoIn the meantime, here's some examples. Note these are in a Groovy script step..
log.info("Current Environment - ${context.testCase.testSuite.project.activeEnvironment.name}")
log.info("Get the value for Test Case Property called 'TestCaseProp' - ${context.expand( '${#TestCase#TestCaseProp}' )}")
log.info("Get the value for Test Suite Property called 'TestSuiteProp' - ${context.expand( '${#TestSuite#TestSuiteProp}' )}")
log.info("Get the response status code for a named service call - ${testRunner.testCase.testSteps["REST Request"].testRequest.response.responseHeaders["#status#"];}");
- ChrisAdams4 years ago
Champion Level 2
Apologies for several messages. I can't edit replies anymore.
log.info("---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------"); log.info("Current Environment - ${context.testCase.testSuite.project.activeEnvironment.name}") log.info(""); log.info("Get the value for Test Case Property called 'TestCaseProp' - ${context.expand( '${#TestCase#TestCaseProp}' )}") log.info("Get the value for Test Suite Property called 'TestSuiteProp' - ${context.expand( '${#TestSuite#TestSuiteProp}' )}") log.info(""); log.info("Get the response status code for a named service call - ${testRunner.testCase.testSteps["REST Request"].testRequest.response.responseHeaders["#status#"];}"); log.info(""); log.info("Let's have a look at the response from a named test request...") log.info(testRunner.testCase.testSteps["REST Request"].testRequest.response.getContentAsString() ) log.info(""); log.info("Root URL for a named request ${testRunner.testCase.testSteps["REST Request"].properties['Endpoint'].value}"); log.info("Get the path for a named service call - ${testRunner.testCase.testSteps["REST Request"].testRequest.getPath()}"); log.info("Get the full URL for a named service call.... ${testRunner.testCase.testSteps["REST Request"].properties['Endpoint'].value}${testRunner.testCase.testSteps["REST Request"].testRequest.getPath()}"); log.info("") log.info("---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------");
- BF_14Corp4 years agoNew Contributor
Here is the value I am trying to capture - requestUri
I cannot find any documentation regarding the testing and posting of these context values.
Any help would be greatly appreciated. See image below for my current test without the needed groovy
script.