You need to sign in to do that
Don't have an account?
Tena Wolver
Test Webservice where I use many Webservice Methods
I have to test a webservice where I first pull session informaton and then I pull down data by calling another method. This is all done in one method in my actual class. I have created 2 mockup classes to use with testing.
global class serverGetSessionMockImpl implements WebServiceMock {infoi inside for Session mockup}
global class serverGetClassesMockImpl implements WebServiceMock {info inside for Classes mock up}
In my test class I call these classes.
Test.setMock(WebServiceMock.class, new serverGetSessionMockImpl());
//setup the class information
Test.setMock(WebServiceMock.class, new serverGetClassesMockImpl());
I then call the class method that uses this webservice in my test class.
//set page to the controller
myPageCon.LoadPage(); //this actually uses the webservice method
What I find is that whatever was the last mock service class I called(Session or Classes) is the one that gets used in my test. I need it to use each of them.
How do I do this?
global class serverGetSessionMockImpl implements WebServiceMock {infoi inside for Session mockup}
global class serverGetClassesMockImpl implements WebServiceMock {info inside for Classes mock up}
In my test class I call these classes.
Test.setMock(WebServiceMock.class, new serverGetSessionMockImpl());
//setup the class information
Test.setMock(WebServiceMock.class, new serverGetClassesMockImpl());
I then call the class method that uses this webservice in my test class.
//set page to the controller
myPageCon.LoadPage(); //this actually uses the webservice method
What I find is that whatever was the last mock service class I called(Session or Classes) is the one that gets used in my test. I need it to use each of them.
How do I do this?
global class serverGetSessionMockImpl implements WebServiceMock {infoi inside for Session mockup}
global class serverGetClassesMockImpl implements WebServiceMock {info inside for Classes mock up}