Forum Discussion

detica1's avatar
detica1
New Contributor
12 years ago

Disable Mock Service For Testcase

is there a way to disable a mock service for a testcase then re-enable it at the end?

i hope there is a groovy command to do this but i cant find it.

any help is appriciated
  • detica1's avatar
    detica1
    New Contributor
    i found the answer to my own problem:



    //Start mock service (put this is the setup scipt section)
    def project = testRunner.testCase.getTestSuite().getProject();
    def mockService = project.getMockServiceByName("SMS Notification MockService");
    mockService.start();

    //Stop mock service (put this in the teardown script section)
    def project = testRunner.testCase.getTestSuite().getProject();
    def mockService = project.getMockServiceByName("SMS Notification MockService");
    def mockRunner = mockService.getMockRunner();
    mockRunner.stop()