Stereo5677
2 years agoOccasional Contributor
Is there a way to store a global or project property inside a virtualized service response script?
I have a virtualized service that is running a script for it's response. Is there a way that I can store properties in that script so that they would be accessible inside groovy scripts inside the testing portion of the project instead of the virtualization portion? The issue I was running into was that testRunner is not accessible there. Normally that is what I would use to save properties.
Not a problem, I really appreciate the chance to help. I love learning, because who knows? I might need to do the same thing down the road.
I have a sample groovy script that might work.// Assuming you know how to get the data from the mock Request to save. def propertyValue = "This is a test" // Gets the project we're working in def project = context.mockService.project def testSuite = project.getTestSuiteByName("Test Suite Name") def testCase = testSuite.getTestCaseByname("Test Case Name") def testStep = testCasee.getTestStepByName("Test Step Name") testStep.setPropertyValue("PropertyName", propertyValue)