Forum Discussion

SiRazoR's avatar
SiRazoR
New Contributor
6 years ago

Cloning mock service

Hey, I have a question that I have searched for everywhere and didnt found answer. My task is to create script in groovy that will clone mockService to different project, set different ports etc ... the problem is that i can't find any possible way to reach my goal. I know that TestCase's have clone method so i was looking for same thing in mockServices and found nothing. I tried lot of things like append mockServiceList, use addWsdlMockService with parameter containing desired mockService to target project and nothing worked. 

 

I may do this by hand using F9 but this is supposed to work automatically after some period

  • Finally, I found the sollution on smartBear api docs . There was something like CloneMockServiceAction.cloneToAnotherProject(WsdlMockService mockService, String name, WsdlProject targetProject, String description) which description seems deprecated because current parameters are different -> 

    cloneToAnotherProject(WsdlMockService mockService, String targetProjectName, String name, String description) 

    To solve my problem I used same method that cloneToAnotherProject used inside and i did this on target Project object

    importMockService(WsdlMockService mockService, String name, boolean createCopy, String description)   

     

  • SiRazoR's avatar
    SiRazoR
    New Contributor

    Finally, I found the sollution on smartBear api docs . There was something like CloneMockServiceAction.cloneToAnotherProject(WsdlMockService mockService, String name, WsdlProject targetProject, String description) which description seems deprecated because current parameters are different -> 

    cloneToAnotherProject(WsdlMockService mockService, String targetProjectName, String name, String description) 

    To solve my problem I used same method that cloneToAnotherProject used inside and i did this on target Project object

    importMockService(WsdlMockService mockService, String name, boolean createCopy, String description)