Linked Questions

-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....
Paritosh's user avatar
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....
Simple Code's user avatar
-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, ...
Soren Pradhan's user avatar
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; ...
Matthew Harris's user avatar
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 ...
OmniMacchiato's user avatar
-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....
Ram's user avatar
  • 1
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 '...
Cat's user avatar
  • 1
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 ...
Mike Rydell's user avatar
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 ...
Liam Heppenstall's user avatar
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 { ...
Ashok Priyadarshi Rout's user avatar
-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){ ...
Bablu Kumar's user avatar
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 ...
sdfcwolf's user avatar
  • 159
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 ...
Javier's user avatar
  • 33
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 ...
Josue Rivas's user avatar
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 ...
Benoît S's user avatar
0 votes
0 answers
23 views

How to cover these lines in test class for response [duplicate]

How to cover these lines in test class for response
otmane_ta's user avatar
0 votes
1 answer
658 views

how to test the Rest Callout using Stub API

Hi Greetings for the day. using the below code ,I have test the Rest callouts by using Stub API .Test class has been completed with out failure but received code coverage Zero.how to test the Rest ...
sakthidasan's user avatar
-4 votes
1 answer
595 views

How to cover the code coverage for Rest API Class [duplicate]

How to cover Code Coverage on test class for rest API, any help will be appreciated. My API Class:- @RestResource (urlmapping = '/UpdateBill/*') global without sharing class ApiUpdateClass{ ...
Wheels-Of- My Soul's user avatar
0 votes
1 answer
358 views

How to properly test invocable callout class

I am a total beginner in Apex, however I created the following class that calls an external API endpoint and is invoked by a flow: public class SubscribeToStatuspage { @InvocableMethod(label='Call ...
Eszter Fodor's user avatar
-2 votes
1 answer
82 views

I am getting stuck here, I just need test apex /snippet /mock for this. Any input will be highly appreciated [closed]

I am just new to apex testing, I am getting responce from Trigger upon that i am moving further in my class. let me know id there is a way around to get better understanding to develop test cases. ...
Kartik.S's user avatar
0 votes
0 answers
130 views

Test class for RequestData class [duplicate]

@HttpPost global static List<HHSurvey> getHHSurveyList() { RestRequest req = RestContext.request; RequestData mRequestData = (RequestData)JSON.deserialize(req.requestBody.toString()...
user avatar
0 votes
0 answers
164 views

How to Create a Test class with a Future Callout that is not dependent on an HTTP Response?

I am new to Apex, but I have been tasked with sending a Salesforce Custom Object to another Company system. My Class works as expected, but my test class fails due to having a @future method. I did ...
nigeldendy's user avatar
0 votes
0 answers
106 views

Erro "Os métodos definidos como TestMethod não suportam callouts para serviços da Web" ao implantar classe/trigger

Olá! Estou com problema ao implantar em produção uma trigger que foi atualizada, e ao executar o teste obtenho o erro a seguir em dois métodos que não possuem qualquer integração. "Os métodos ...
Camila Roque's user avatar