Skip to main content

Questions tagged [webservicemock]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
1 answer

Too many callouts error when running a test class

Any input would be greatly apprecaiated. I'm attempting to execute a test class, but when I run the test, I get a message saying 'too many callouts: 101' in the logs and the test fails to complete. ...
djpackman's user avatar
-1 votes
1 answer

MOCK test Class for POST web service test class

Hi I am new to integration i need to write the Mock Test class for my webservice test class, i am stuck , please help me to create the mock call out in the APEX Below my class: public class ...
raghav's user avatar
  • 3
14 votes
1 answer

How do I unit test code that includes a callout?

This is a canonical question and answer developed by the community to help address common questions. If you've been directed here, or your question has been closed as a duplicate, please look through ...
1 vote
0 answers

Test Webservice Callout [duplicate]

Can anyone see what I am doing wrong? I am not getting back any data from my mock callout. Below- jsonStr is what is returned from the webservice and it is being returned as null. Apex: public ...
Olivia's user avatar
  • 3,471
2 votes
1 answer

Webservice mock callout goes to the webservice original class and fails

I am using a WebService callout, returning a string, and testing it; I am quite new to it. The problem is in the Mock class. When I am debugging it, the response element is created, the string is ...
Franktrt's user avatar
  • 173
1 vote
1 answer

Testing Webservice Callouts : Methods defined as TestMethod do not support Web service callouts

The following class is wsdl2apex generated. Can anyone help me on how to write test class for the same //Generated by wsdl2apex public class e_services { public class EPort { public ...
wizard's user avatar
  • 423
6 votes
1 answer

Issues Testing Webservice Callouts

I am trying to write a test class for a simple HTTP POST web service call. (I am just sending a three line json body to an endpoint). Where I having trouble is trying to test my apex code. I ...
Vik's user avatar
  • 183
0 votes
0 answers

How to handle multi callout in test class?

I have webservice class which have multi callout.For the first callout i have some list of URl's.From the list of URL's I want to do the second callout and so on. apexCode: global with sharing class ...
uma451's user avatar
  • 809
0 votes
1 answer

Multiple Webservice Test Mock

I have a method that calls multiple webservices in it. When I implement a mock webservice how does it tie that mock webservice to the actual web service it is mocking? Is it possible to create ...
TemporaryFix's user avatar
  • 2,946
0 votes
0 answers

Help testing a web service callout for a trigger that doesn't directly request a callout

I'm attempting to include a mock web service callout in a test for a trigger, though the trigger and test don't explicitly execute a callout. I've found this documentation on creating the mock, but I'...
Matt's user avatar
  • 1,017
3 votes
1 answer

Webservice callout - Test class - not working

I have batch class that makes a HTTP callout to a remote web service. To deploy into production, I have created a test class with StaticResourceCalloutMock. I am executing the test class in a full ...
Razu's user avatar
  • 353
5 votes
1 answer

Callout Mock Responses & multiple HTTP Status Code values

I'm trying to unit test the behavior of some code which performs callouts and its logic is dependent on the HTTP status code of the response - 200 vs 401. The pattern being exercised is familiar: ...
Mark Pond's user avatar
  • 23k
4 votes
1 answer

Security Scanner Results shows asserts needed for mock class.Is it mandatory?

We made a security scan through ' Security Scanner' which says that asserts are mandatory for mock class.But we have used asserts for all the test classes which makes use of those mocks.I ...
Priyalakshmi's user avatar
  • 1,456
4 votes
1 answer

Test class for a controller that has logic to query the external object records

We have enabled the Lightning connect and defined an External Data Source for Lightning Connect - Odata 2.0 Adapter and the External Object records are loaded from Informatica. The functionality ...
Sirisha Kodi's user avatar
1 vote
1 answer

System.LimitException occurs in WSDL Class

I'm getting System.LimitException: Too many callouts: 101 error message in my WSDL class file generated by SFDC. Repeated error was shown as following: Class.ServiceHistory_wsdl....
Cω Tham's user avatar
0 votes
1 answer

Custom Apex soap API

We have written a custom Apex soup API for integrating with ERP System. Our wsdl works fine .Currently we are accepting the records response one by one sent by ERP. Now my question is if ERP sends the ...
Salesforce Classes's user avatar
1 vote
1 answer

Test class for Batch class with web service callout and test data

I have a batch class which in turn makes REST callouts(No future annotation). Now I want to write test class for same. Currently what i tried - -StaticResourceCalloutMock class in salesforce - ...
SEuser's user avatar
  • 1,847
2 votes
0 answers

Weird issue (NEW BUG) with Test.SetMock and body.toString() - Dreaded Uncommitted work pending

Using test.setMock between test.startTest and test.stopTest DML performs fine everywhere except: This code fails unless the insert is not done: sr = [Select Body From StaticResource Where Name = '...
Eric's user avatar
  • 54.2k
3 votes
2 answers

Loading data before Webservice callouts?

I need Opportunity record to be inserted in test class and then use that Id in webservice call out. Tried every different combination but it asks me commit the DML operation before doing webservice ...
Soberano's user avatar
  • 1,232
23 votes
3 answers

Mocking a webservice CalloutException for a SOAP Fault

I have a mock class for a web service that implements WebServiceMock. With some requests the actual web service being mocked will return a SOAP Fault that results in a System.CalloutException in Apex....
Daniel Ballinger's user avatar
2 votes
1 answer

Webservice calls in unit Tests

I could run unit test for webservice method call using mock very well, but when I call a webservice method and after that another webservice method in the same test, I get "You have uncommitted work ...
Sanjivani's user avatar
  • 435
1 vote
2 answers

Implementation of AWS Toolkit test classes. Test.setMock Have any done it?

Background We are integrating with AWS Services, so we installed the Amazon Toolkit and right after installed we run the Apex Test Execution and we find out that there are 6 test methods not passing ...
Jose's user avatar
  • 2,142
4 votes
1 answer

Too many callouts 11 while testing using webservicemock interface

i have written a test class for a controller in which one of the method makes a callout. This is one single invocation of external SAP webservice. But my debug log shows more than 10 invocation of the ...
Bforce's user avatar
  • 6,828
2 votes
2 answers

Testing webservicemock never reached the response line in the generated class. why?

written a test class to test the callout that is using SOAP. I have generated class using WSDL. The response line in the generated class not covered though i tried several ways. Given below is the ...
Bforce's user avatar
  • 6,828
31 votes
4 answers

Method defined as testMethod do not support web service callouts, test skipped

I have been struggling with this error for a few days now. I get this error every time I try to run a test for a method that has an httpCallout. I followed the architecture from http://www.salesforce....
Mr. Ant's user avatar
  • 559
2 votes
0 answers

why this simple example in this article throws error? [duplicate]

i have created all the classes in this link just to see how the Test mock working. but i ended up in ...
Bforce's user avatar
  • 6,828
3 votes
1 answer

Help Testing a Web Service Callout

I have set-up an APEX class that uses a web service callout to create a PDF and attach it to a contact record. However, I can't push it into production because the web service callout is skipped in ...
Kim's user avatar
  • 39
3 votes
1 answer

My test classes are contributing towards uncovered code

I have a test class containing several WebServiceMock implementors. He looks like this: @isTest private class MyTestClass { public class ValidateMock implements WebServiceMock { public ...
Matt and Neil's user avatar