Forum Discussion
You script is actually missing the object in color
Here is the script to start mock service:
//To start mock service
//Change the service name as needed. def name = 'GlobalWeatherSoap MockService' def wsdlMockService = testRunner.testCase.testSuite.project.mockServices[name] wsdlMockService.start() if (wsdlMockService.getMockRunner().isRunning()) { log.info("+++++++++ Mock is running") }
Stop script:
//To stop mock service //Change service name as needed. def name = 'GlobalWeatherSoap MockService' def wsdlMockService = testRunner.testCase.testSuite.project.mockServices[name] wsdlMockService.getMockRunner().stop()
Thank you for your hint. I tried but I have the same issue.
After the line:
wsdlMockService.getMockRunner().stop()
the istruction:
wsdlMockService.getMockRunner().isRunning()
returs the error:
- Thu Sep 15 13:20:32 CEST 2016:INFO:---- ERROR: Cannot invoke method isRunning() on null object
If I comment the line with .stop(), no error.
I don´t understand if this is by design or not.
Thanks
- nmrao9 years agoChampion Level 3The sample code snippets provided to you after testing them only.
You can just try to add a test case with two separate groovy scripts, and both and try.- duccio_fabbri9 years agoNew Contributor
Your snippets are OK! I tried and they work perfectly.
But please, try to add this line to your second snippet:
log.info("wsdlMockService.getMockRunner().isRunning() returns: "+wsdlMockService.getMockRunner().isRunning())
I receive an error.
Same line, after snippet 1, returns "true".
Is it ok?
- nmrao9 years agoChampion Level 3
Hope you did not forget to change the value for "name" variable which is the service name as per your environment.
If you add the above statement as second last statement in your second script, then it should be true. At the same time, the same statement is added at the end, you expect nullpoint because, mockRunner is stopped.
Related Content
- 4 years ago
- 8 years ago
- 4 years ago
- 4 years ago
- 10 years ago
Recent Discussions
- 15 years ago