Skip to main content

Questions tagged [apextestrunresult]

Filter by
Sorted by
Tagged with
-1 votes
1 answer
37 views

Getting error in apex test class while deploying in production.?

I have a objective Area with field name (Org with master-detail relationship). For the field Org I have a filter called (Org.status equals active). Status is Org object field. I have a test apex class ...
محمد حفیظ شیخ's user avatar
0 votes
1 answer
62 views

Apex trigger test object is only changed, if value is changed within the @isTest scope

I have this test where I need to set a boolean (Requires_number__c) on a WebCart. This boolean is normally set via a trigger, in case a specific cartItem is added to the cart. The problem I am ...
I am not Fat's user avatar
0 votes
2 answers
111 views

Test Code Coverage - Delete DML catch block

We have implemented one method using Apex for delete some records under the class which is without sharing. In the method, first we are retrieving the list of the records(which needs to be deleted) ...
samarpita saha's user avatar
0 votes
0 answers
74 views

Delete in a Apex Test Class

I have this apex test class, the only problem with this is delete isn't being covered when running test. Is there something missing from this? @isTest(seeAllData=false) public class ...
Jaemy Malik's user avatar
-3 votes
1 answer
98 views

Apex test class not working and fails

I have the following apex class: public with sharing class TT_DisplayRelatedOpportunities { @AuraEnabled(cacheable=true) public static List<Opportunity> getOppList(String recordId) {...
Marjan's user avatar
  • 15
0 votes
1 answer
175 views

I want to cover catch block of main class to have 100% code coverage. Can't seem to throw exception. If anyone can help

I am able to cover try block of my main class, but failing to do the same for catch block. Here's the given code for my current test class and Main Class. Controller Class- public with sharing class ...
SF Learner's user avatar
0 votes
0 answers
348 views

Apex Test - either Invalid conversion from runtime type String to Date or Invalid Date

I am trying to test code that takes a URL string and maps it into fields and values. I am having trouble with the date and date/time fields. In the following code I get the error message "Invalid ...
Jonathan Crow's user avatar
0 votes
0 answers
167 views

Understanding the proper response for a mock callout

I have code that I am trying to test that includes a getcontent() request. I know I need to create a mock callout for this, however I don't know what the proper response should be. How can I find out ...
Jonathan Crow's user avatar
0 votes
1 answer
112 views

Issue : "No content to map to Object due to end of input" in test classes

I am getting Issue in test class. I am not able to cover the test coverage of responsebody When I debug it show the "common.apex.runtime.impl.ExecutionException: No content to map to Object due ...
Abhi's user avatar
  • 1
0 votes
0 answers
76 views

Apex Failed Test Run: Method does not exist or incorrect signature

I have a class with the function: public static void updateTargetAmount(Id targetId, String customFieldApiName){...} In my Testclass i handover the 2 parameters: TargetHelper.updateTargetAmount(...
Benjamin's user avatar
0 votes
1 answer
734 views

Apex Test for LightningSelfRegisterController

I have the LightningSelfRegisterController and LightningSelfRegisterControllerTest that were prebuilt in SF. The test only covers the class at something like 72%. I need to get this to 90% and am ...
Jonathan Crow's user avatar
1 vote
1 answer
590 views

Test Code coverage for LightningLoginFormController

The prebuilt class LightningLoginFormController has a try/catch block that I am trying to cover in test. @AuraEnabled public static String login(String username, String password, String startUrl) { ...
Jonathan Crow's user avatar
-1 votes
1 answer
519 views

Apex Test for setExperienceId

I have a class ForgotUserPassword that uses a community page to set the Experience ID. When I try to build a test class for the setExperienceId, I get an error message saying that “This method can be ...
Jonathan Crow's user avatar
0 votes
2 answers
288 views

Apex test class method not working

I have the following method in my apex class: @testVisible private static Custon_Object_Case__c getExistingRecord(Messaging.InboundEmail email){ List<String> referenceId = email.references; ...
Marjan's user avatar
  • 15
0 votes
2 answers
31 views

Problem with Test Class If/Else string is null

I have the following class that I need to cover. It takes the search value from the VF Page and creates a list based on the entered value. public with sharing class ServiceConsoleFastLinksController { ...
Jonathan Crow's user avatar
0 votes
1 answer
187 views

Asking for License to assign a permission set to a user in test class

Hi all i am assigning a permission set to a user below the code " public static void assignPermissionSetsToUser(Id userId, Set<String> permissionSets) { List<...
Vishal's user avatar
  • 1
0 votes
1 answer
221 views

System.AssertException: Assertion Failed: Expected: Invalid File type, Please upload csv file., Actual :Script-thrown exception

Test class @isTest public class Participants2Test { @testSetup private static void testSetup(){ TestUtility.setup(); } @isTest static void testCsvFileRead() { // ...
YETURU CHENCHU's user avatar
0 votes
1 answer
58 views

APEX Multiple From in Database.getQueryLocator

I have a class (inherited) that sets the StandardSetController through a Database.getQueryLocator as follows: ApexPages.StandardSetController setCon = new ApexPages.StandardSetController(Database....
Jonathan Crow's user avatar
0 votes
1 answer
15 views

Help with Testing Database.Batchable

I have a class with the following: global with sharing class MS_Batch_Delete implements Database.Batchable<sObject>{ global final List<MS__c> mss; global MS_Batch_Delete( ...
Jonathan Crow's user avatar
1 vote
1 answer
49 views

What does this do? Throw new MS_Exception

I have (inherited) a class MS_exception that is this: public with sharing class MS_Exception extends Exception { } It has zero code coverage. Does it actually do anything? Do I need to cover it? The ...
Jonathan Crow's user avatar
1 vote
1 answer
42 views

Apex Testing Object Data

I have a class with the code below that I am trying to test. I am still very new to Apex and not sure I understand what I am supposed to do with the "(Object data)" part. I tried testing by ...
Jonathan Crow's user avatar
0 votes
1 answer
201 views

Test class for records owned by System User

I have batch job class which fetches ServiceAppointment where Owner.Name = 'System User' in it's Database.QueryLocator start method. global class CancelDuplicateSaBatchClass implements Database....
Ravi's user avatar
  • 1
0 votes
0 answers
213 views

Inserting KimbleOne Event through Apex

I am trying to test Apex code that was developed to provide a @RestResource for Kimble Event information. In order to test it I either need to insert the event through Apex or us SeeAllData=true. I ...
Jonathan Crow's user avatar
2 votes
1 answer
199 views

test-result-codecoverage.json with more than 10k coverage items

We have high number of test methods. After running all test cases using sfdx force:apex:test:run test-result-codecoverage.json doesn't include all classes, it includes only 25% of classes. Is there a ...
Ashish Narang's user avatar
0 votes
1 answer
109 views

Trying to Load Data for RecentlyViewed but get error message "Required fields are missing: [OwnerType]"

I have a line of code in my test class: List<sObject> newRecentlyViewed = Test.loadData(RecentlyViewed.sObjectType, 'MyRecentlyViewedData'); The csv I uploaded to the static resource ...
Jonathan Crow's user avatar
-1 votes
2 answers
184 views

Cover StandardSetController in Apex Test

I have the following class and text class. The test class covers the class at 90% but doesn't seem to do anything or test anything. Any idea what I am doing wrong? public with sharing class ...
Jonathan Crow's user avatar
1 vote
1 answer
52 views

Apex Test Error - Constructor not defined

I am still new to Apex testing and am trying to build a test class on the following, but keep running into the error message “Constructor not defined: [MyNewCaseListController].(ApexPages....
Jonathan Crow's user avatar
1 vote
1 answer
97 views

Apex Test - Instantiate new Controller

I am trying to instantiate a new controller. But every syntax I have tried shows an error. Here is my code: Class: public class MyNewCaseController { public string filterId {get; set;} ...
Jonathan Crow's user avatar
-2 votes
1 answer
36 views

Test running issues [closed]

Tried running the test for the first time and seems I am doing something wrong can someone give me a hint? I saved it before running the code but the star never disappeared
K2Ardash's user avatar
-1 votes
1 answer
1k views

Does running all tests in an org impact actual real functionality? Should I not run all tests in production daily?

For years I was under the assumption that running all tests in an org does not impact actual functionality. At most, it may somewhat impact performance... Every night I run all tests in our UAT ...
Ryan Werner's user avatar
0 votes
1 answer
126 views

Apex test class for Standard Controller extensions - Test problem

:) I am writing test class for controller extensions, but I get the error: System.TypeException: Invalid conversion from runtime type Asset to Account. Can you please look at my code, and tell me what ...
ApexNewbie's user avatar
-3 votes
1 answer
1k views

How can I fix the errors in this Apex Test Class?

I installed an app from Salesforce Labs into my production org and later found out that there are errors in the test class. Now these errors are preventing me from deploying a different project, so I ...
NickG's user avatar
  • 3
1 vote
1 answer
2k views

Debug Test and Debug All Tests for apex unit tests in VSCodedx

Does anyone have a link to the official documentation on this new feature added to VSCode-dx? Also, any tips on using this feature would be appreciated. What I've tried so far: I've tried the feature ...
Bahman.A's user avatar
  • 928
-3 votes
1 answer
61 views

test classes fail after updating a fields length and its datatype [closed]

Was given a task to update a fields data type and its length, I commented certain parts of the code to do the change as it mentioned the field was referenced in the Apex classes. After the update ...
sumchans's user avatar
  • 887
2 votes
1 answer
296 views

Deployment / Validation apex test results

Does anyone know where the test results (especially runtime) are stored for tests that are run during a validation/deployment ? I know the objects where the test results are but how do they relate to ...
jani_r's user avatar
  • 123
0 votes
1 answer
611 views

Change Set Deployment - Code coverage failure

I am sorry if this has been answered here before, I was not able to find an answer. I made a small modification[changed an if condition, no new lines added or removed] to one of the apex classes in ...
sumchans's user avatar
  • 887
0 votes
1 answer
766 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 ...
Abhijith E's user avatar
1 vote
0 answers
819 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 ...
Aryansh04's user avatar
  • 280
0 votes
1 answer
124 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 ...
jojopogi's user avatar
  • 544
0 votes
1 answer
8k 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 ...
Kamran Jabbar's user avatar
0 votes
1 answer
362 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 ...
Vignesh S's user avatar
0 votes
1 answer
653 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?
Spande's user avatar
  • 81
1 vote
1 answer
329 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 ...
Spande's user avatar
  • 81
0 votes
1 answer
1k 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 ...
garvi's user avatar
  • 63
1 vote
1 answer
63 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 ...
kratos's user avatar
  • 551
1 vote
0 answers
866 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 ...
Xi Xiao's user avatar
  • 865
-3 votes
1 answer
4k 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> ...
RAHUL KUMAR's user avatar
0 votes
1 answer
408 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->->->->->->->->...
Shubham Gupta's user avatar
1 vote
1 answer
581 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 ...
Endrit Sino's user avatar
0 votes
1 answer
248 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 ...
Xi Xiao's user avatar
  • 865