Linked Questions
25 questions linked to/from How do I unit test code that includes a callout?
-1
votes
2
answers
4k
views
how to create and send the request/response body for the post method in test class [duplicate]
static testMethod void testPost(){
RestRequest req = new RestRequest();
RestResponse res = new RestResponse();
Profile testEditorProfile = [Select id from Profile where Name= :System....
0
votes
1
answer
1k
views
How to set StatusCode on Test.setMock [duplicate]
I have a simple class that just calls the generic HTTPCallOUt method for its test class.
I want it to be able to fail in order to catch all the code. Here is my code:
Test.startTest();
Test....
-1
votes
1
answer
1k
views
Test Class For Http callout Post [duplicate]
Kindly Provide me a feasible solution to write the test class for this below code`
public class ActiveCampaign {
@future (callout=true)
public static void createUser(String Email, String FirstName, ...
0
votes
1
answer
856
views
Help with TEST Class using @HttpGet [duplicate]
I have this simple little @HttpGet method.
@HttpGet
global static List<Case> getCases() {
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
...
0
votes
1
answer
451
views
Test class for HTTPCallout POST with Invocable Method from Flow [duplicate]
I'm still pretty new to this, and I've looked around and haven't been able to find the solution that combines everything like I'm trying to do. I've tried quite a few things, but here's where I ...
-1
votes
1
answer
217
views
How to call this method from web service in my test class [duplicate]
I am not able to call this method in my test class:
WebServiceCallout.invoke(
this,
request_x,
response_map_x,
new String[]{endpoint_x,
'https://www....
0
votes
0
answers
235
views
Creating an Apex Test Class for Apex class that handles a webhook integration when an opportunity in Salesforce moves to the 'Closed Won' stage [duplicate]
How can I create a test class on the below trigger?
public class webhookOpportunityStageNameClosedWon {
// call method 'handleOpportunityStageNameClosedWon' in the '...
0
votes
1
answer
135
views
Apex Test Class failing - cannot figure it out - Webcall out [duplicate]
I am trying to use an Apex Class I found at this link:
https://automationchampion.com/2020/12/01/getting-started-with-process-builder-part-50-auto-convert-leads/
Here is the Apex Class:
Public class ...
0
votes
0
answers
145
views
Creating a Test Class for 2 Classes [duplicate]
In order for Territory Assignment rules to fire on Account creation and Update, I have got 2 Classes working (with Triggers), however I am struggling to create a Test class for these, any help would ...
0
votes
0
answers
136
views
How to cover Http Response class method and AccessToken Method? [duplicate]
I have to increase the code coverage of the class. In order to do that, I have written code coverage for the constructors.
This is the class:
public class LendingTIDOutboundIntegrationHelper {
...
-3
votes
1
answer
75
views
How To Write Test Class for HTTP POST Method [duplicate]
How We can Write Test Class for this Method.
public static String authMethod(){
Pardot_Credential_Setting__c objSetting = customSetting();
if(objSetting != null){
...
0
votes
0
answers
46
views
Test class where a single method calls two Webservices in a row [duplicate]
I need to create a Test class where a single method (doPost()) calls two Webservices in a row.
The first is a REST API and the second is a SOAP API.
The first API retrieve a token that I need to use ...
0
votes
0
answers
43
views
How to write a test class for a method that send a htttp request among other things [duplicate]
I'm trying to write the test class for a method like this.
@AuraEnabled
public static DynamicTableMapping getFilteredAccounts(String filterId){
List<string> headervalue = new ...
0
votes
0
answers
41
views
Problem with Apex HTTP callout POST Test [duplicate]
I get the following error: "System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out" when executing my test. The code coverage is already at ...
1
vote
0
answers
34
views
Correctly Write Test and Callout test on trigger [duplicate]
I have a trigger on Account after insert and after update.
In both cases I need to call my BUS to update in the compagny database.
Since I will have to deploy my dev into QA I need to write a test ...