Questions tagged [apextestrunresult]
The apextestrunresult tag has no usage guidance.
21
questions
0
votes
0answers
35 views
Salesforce Apex Test Class Error - 74% code coverage when you need 75% [duplicate]
I am getting the error upon change set deployment in my Prod environment that my code coverage does not meet the required 75%. Now I understand what that means, just not really how to tackle it to ...
0
votes
1answer
26 views
Test Coverage Issue with Site.getSiteId()
I am unable to cover the below function in test class as siteId is always returned null
Id siteId = Site.getSiteId();
if (siteId != null) {
//Community user logic -- THIS IS THE PART THAT IS NOT ...
0
votes
0answers
20 views
Error when trying to translate Knowledge Articles in a test class
I have a test class in which I'm trying to translate Knowledge Articles into Spanish. Default language is English. If you were to do this from Salesforce UI, you have to publish each version ...
0
votes
1answer
22 views
Refactoring Help for main class or test code coverage
I'm trying to refactor the following code.I'm trying to figure out how to refactor this code OR if anyone have a good way to do code coverage for this.
My issue is that, in dev, the code coverage is ...
0
votes
0answers
13 views
Help to writing testclass for Auto Convert Leads [duplicate]
Public class AutoConvertLeads
{
@InvocableMethod
public static void LeadAssign(List<Id> LeadIds)
{
LeadStatus CLeadStatus= [SELECT Id, MasterLabel FROM LeadStatus WHERE ...
0
votes
0answers
19 views
How do you use the PricebookEntryHistory in the Apex Test Class? [duplicate]
How do you use the PricebookEntryHistory in the Apex Test Class? I have a batch job that reads off the PricebookEntryHistory object to check if a field value has changed, and I'm trying to figure out ...
0
votes
1answer
139 views
DEBUG|Insert failed. First exception on row 0; first error: INVALID_OR_NULL_FOR_RESTRICTED_PICKLIST, bad value for restricted picklist field
I have a record type picklist on Case object.
When I create case via email-to-case that works fine without any issue(I have some APEX code related to that)
Issue:
The problem is when I write test ...
0
votes
1answer
35 views
Test class not covering my batch
I'm new to batch scripts. In my apex batch My start method will send records to execute method based on input given in custom label. I have created a test class and I'm not sure my execute method is ...
0
votes
1answer
72 views
How to Schedule Run all apex tests on daily basis
How to Schedule Run all apex tests on a daily basis?
Currently, we are performing it manually is there any way we can automate it?
0
votes
0answers
58 views
Why code coverage result is different when we run it from CLI and Salesforce
We are working on SonarQube code coverage, We are using Salesforce CLI for generating the code coverage result and we are importing that result in the SonarQube.
We see that there is a difference in ...
0
votes
1answer
47 views
test class for wrapper class in apex
public with sharing class ResponseWrapper{
public String Id;
public String Time;
public String lobType;
public String businessContextId;
public Information[] document;
public ...
1
vote
1answer
35 views
Missing ApexTestRunResult Data
Yesterday we had 10-11 records and today just 2. This is what I did:
Check recycle bin and using All Data
Check Bulk API delete capable processes and users
Check connected apps.
DataLoader.io SSO ...
1
vote
0answers
166 views
How to delete a Person Account in Apex Test
I have difficulty to delete Person Account(PA) in Apex test. The reason is that I cannot figure out how to disable the associated user record.
The org has Salesforce SSO and PA feature enabled. Here ...
-3
votes
1answer
142 views
Unable to cover test class for history object [duplicate]
Here is my test class
public class BoothChangeReportCtrl {
@auraEnabled
public static List<BoothChangeDetail> getBoothChangeData(){
List<BoothChangeDetail> ...
0
votes
1answer
27 views
How can i test inside for loop apex test? [duplicate]
public static List<priceBookEntryWrapper> searchproduct(String sampleId, String seriesValue, list<string> gradeValues){
system.debug('seriesValue->->->->->->->->...
0
votes
1answer
152 views
Too many SOQL queries error encountered when running the class in Sandbox but not in Production
I have experienced a bunch of test classes fail to pass in a Sandbox, but execute fine in Production.
Has anyone some good tips on what look out specifically? I think the code itself is not ...
0
votes
1answer
46 views
unit testing - if record is created with certain record type
I have a function createWithRecordTypeIfExists(String recordType). Its logic goes like this:
Check whether a record type for this object exists in the org.
If yes, create a new record with this ...
1
vote
1answer
820 views
OpportunityTeamMember and OpportunitySplit in Test Class
I am facing an issue while writing a test class for Opportunity trigger handler class. We have enabled and Opportunity Team member and Opportunity Split process in our org. In the split process, 100% ...
0
votes
1answer
826 views
Apex test run doesn't report back to sfdx
I used to run Apex tests using sfdx force:apex:test:run -r human -c command and everything was fine. But after I've created another scratch org this command no longer produces any result, it just ...
-3
votes
1answer
1k views
how to get Percentage coverage of each ApexClass through SOQL
Is there any way we can query Like below and get the result
Query: SELECT Percentagecovered,ApexClassname FROM ApexCodeCoverage or
How can i convert below query to get % covered.
SELECT ...
6
votes
1answer
240 views
ApexTestRunResult's status is set to complete and all tests pass, but the enqueued and completed count do not match
It is possible to programatically run tests in the platform by creating ApexTestQueueItem records. They reference classes by their Id, and you can even optionally specify if you want the test to ...