New answers tagged

0 votes

VS Code SFDX Unit Tests: Cannot see "Run Test" or "Run All Tests"

I had the "Run Test" and "Run All Tests" tags disappear because the Salesforcedx-vscode-apex › Java: Memory was too low for an Org with a lot of Apex. Increasing the Memory size to ...
Alan MacK's user avatar
  • 101
0 votes

Unable to fetch accountId of User in Test class

The issue is here: User u = TestUtility.createCommunityUser(con.Id,profileId,'Fname','Test'); that calls public static User createCommunityUser(String contactId, String profId, String firstName, ...
cropredy's user avatar
  • 69.9k
0 votes

How to properly test and assert an @restresource that do multiple API calls?

we can acheive this using map of callouts. Below article clearly explained the way how to do that https://developer.salesforce.com/blogs/developer-relations/2013/03/testing-apex-callouts-using-...
Durai Pandi's user avatar
2 votes

Need help increasing the code coverage for this trigger

Some background The golden rule of unit testing is You only gain coverage for lines of code that are executed by some test method In tests, we are the ones responsible for setting up the test data. ...
Derek F's user avatar
  • 59.4k
0 votes

ContentDocumentLink Trigger successfully blocks file upload on Org but fails in Dev Console

I was able to recreate your issue in a sandbox but was unable to resolve it while keeping addError(). addError() was not throwing an exception in the unit test. Maybe someone else can recommend how to ...
Wes Lyons's user avatar
  • 146
0 votes
Accepted

force:apex:test:run throws error in CI: "No tests were able to be executed on the org. Please verify that the source code has been pushed correctly"

About 12 hours later and the error is gone. No changes were done to code/org settings from my side. Those are the mysterious ways of Salesforce, I guess :)
Andrei Migachev's user avatar
0 votes

B2B Commerce: Error getting or creating webcart

You will need to assign the buyer group to the WebStore by creating a WebstoreBuyerGroup record. https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/...
Andrew's user avatar
  • 11
1 vote

Apex - 0% Code Coverage!

Solved. The FundingAwardTriggerTest test class was omitted from my outbound change set. Including it solved the issue!
Jean-Se's user avatar
  • 55
2 votes

"Connection was cancelled here" error NOT related to parallel testing

Since this seems to be related to coverage data, I tried clearing all test data (Dev Console > Test > Clear Test Data, then querying ApexCodeCoverageAggregate using ToolingAPI and deleting all ...
Jason Clark's user avatar
  • 11.8k
1 vote
Accepted

Apex Mocks - Verify that child is correctly related to a previously registered parent in Unit of Work

Since it is unit test code, you should know how many Contacts will be added to the same parent account Thus, your ApexMocks verify for unitOfWork.registerNew(new Contact( ...
cropredy's user avatar
  • 69.9k

Top 50 recent answers are included