Questions tagged [test-class]
66 questions
0
votes
1 answer
How to write an Apex Test Class for Importing a CSV File?
Hello! I am unable to test the written apex class.. Could you help me with this task?
Through the component, we transfer the ID of the CSV file sent to the server to the apex class, after which our apex class creates stations if there were none…

KriSWhitch
- 3
- 3
0
votes
1 answer
Tests with test fixtures as class methods (PyTest)
In organising tests in PyTest, I have seen that the test methods can be defined within a test class, like so:
class TestBasicEquality:
def test_a_equals_b(self):
assert 'a' == 'b'
If we want to write a test (test_client) that has to use…
user6003691
0
votes
1 answer
"error: cannot find symbol" while compiling; the class I am trying to use "cannot be found"
I have an assignment the requires an initial class and a separate project to test that class. Now, everytime i attempt to compile it it gives me a these errors:
package blooddata;
TestBloodData.java:10: error: cannot find symbol
…

Casey Phillips
- 1
- 1
- 2
0
votes
1 answer
Need optimization of this trigger?Can anyone help me out.?
Actually, I am trying to get Area_c field from custom object(Zip Codes) into the lead object custom field Area_c. So, I have written some of the code but is there any other way to write it or get some optimization of this code.
trigger…

Sanny
- 3
- 1
0
votes
1 answer
Assert Statement is failing in Test Class during my Unit Test
Logic:
public static void wmgRemoveOldGroupQueue(Map newMap, Map oldMap){
String wmgRecordTypeId = Schema.SObjectType.Case.getRecordTypeInfosByDeveloperName().get('WMG_Operations_Workflow').getRecordTypeId();
…

Ashmita ranjan
- 21
- 1
- 8
0
votes
2 answers
Mock Webservice Call out implementation
Recently working test classes in Salesforce started to Fail due to this error
Methods defined as TestMethod do not support Web service callouts
Stack Trace: null
I have reviewed the SF response…

kpedrick1
- 15
- 1
- 5
0
votes
0 answers
How to write test class for wrapper class for below code,
In TimelineCase class, Here We are send the recordId and pageNo and pase size in processTimelineItem() Method, Expecting it will fetch the case record by using sql in this class. but here we able to cover the sql case record and unable to fetch the…

Ajay
- 1
- 1
- 2
0
votes
1 answer
Access Trigger.New value in Apex Test Class
tl;dr - How do you make a test class wait until a specific trigger is done with its updates or inserts before continuing on with the test?
Background
I have a trigger that creates a new Portal_Content__c object whenever an Account object is created,…

Jwok
- 646
- 9
- 23
0
votes
1 answer
Test coverage for test class of trigger is showing 53 constantly
I am new to salesforce development.I have written test class for following trigger, which is having coverage as 53 only. I tried several times by adding and changing code lines into test class but it is still showing 53. Could you please help me to…

SAdmin
- 3
- 1
0
votes
2 answers
How to mock throw new customException?
Hope all are doing good.
I am wanted to mock one of my exception which is inside one private method like below :
private void verifyScenarios(String empid, String token) {
if (Validation if true) // Line 1 :
throw new CustomException("my…

Mohammad Wasim Khan
- 95
- 1
- 1
- 9
0
votes
1 answer
Test Class in apex
So i am new to salesforce and i finished my training and now im working on a project. But on my project i have stumbled on a test class that i am not finding a way to write it, so i would appreciate if anyone can help me figure out a way to write…

User101
- 5
- 6
0
votes
2 answers
How to create an Apex Class?
Through plenty of trial and error, I've created the functioning trigger in my sandbox. My issue is that I would like to now apply it to my live org but I can't seem to understand the whole apex class thing.
How can I create a class?
The idea behind…

Gabe Mejia
- 3
- 2
0
votes
2 answers
Test class for Apex Trigger for update
I am new in Apex Development. I want to write a TestClass for my Apex Trigger.
I am sharing my code with you:
trigger ClosedOpportunityTrigger on Opportunity (before update) {
for(Opportunity o:Trigger.New) {
if(o.Probability==100 &&…

Sakthi S
- 31
- 1
- 13
0
votes
1 answer
How to create code coverage for my Apex Class
Here is the class I managed to create, not sure where to start with code coverage as this is my first apex class, or doing anything with salesforce.
Can someone point me in the right direction. Thanks!
public with sharing class…
user6391338
0
votes
1 answer
How to write test class for codes which is used by VF pages as expression language
I need to write a test coverage code for a getter, setter methods in a controller class
public Boolean showNtc {
get {
if (reg[0].Status__c == 'Review') {
return true;
} else {
return false;
}
…

Chathura
- 155
- 6