Linked Questions

0
votes
0answers
596 views

Test Controller for Visualforce Email Template Component - How? [duplicate]

I have a controller that does simple queries of data for a visualforce email template. Not setting or computations, simple queries for list lines. How do I test this? public class ...
1
vote
2answers
7k views

SOQL query is not working in Test class coverage

I wrote three soql queries in test class static testMethod void test_DoGet() { RestRequest req = new RestRequest(); RestResponse res = new RestResponse(); ...
2
votes
2answers
299 views

System.QueryException: List has no rows for assignment to SObject due to no records in SOQL

Below is the code written by someone else .I need to rectify this in short time as its deployment time. Any help would be helpful for me.I know code is written badly. I also know error is because ...
0
votes
2answers
240 views

Why is my aggregate query returning no rows when called during test?

I have the following query inside an @HttpGet REST API method: SELECT Document_Id__c FROM Content_Link__c GROUP BY Document_Id__c HAVING Count(Account__c) > 0 When run regularly I see the ...
2
votes
1answer
153 views

Help getting sufficient test coverage: stuck at 16%

So I've been reading and noticed that as a general rule you should shoot for 75-90% code coverage for a trigger, aiming for 90% or higher if possible. I feel proud of myself for getting the test ...
-4
votes
2answers
470 views

test class is not working [closed]

I worte the below helper class and it is working perfectly, but I have an issue with the deployment because of the test class public class CESExtension { public CES__c CES; public opportunity ...
0
votes
1answer
456 views

how to pull opportunity owner name in test class

I wrote a batch class to send email to opportunity owner when the opportunity's close date is passed. global class SendEmailToopsowner implements Database.Batchable<sObject> { global ...
1
vote
2answers
151 views

Unit Test data accessability

Today I experienced an error that I have never experienced before. When I go into my developer console on salesforce and run unit tests for, supposedly, all of my code, I get my typical high ...
2
votes
1answer
87 views

Sandbox to Prod- Test Data

I am having a hard time wrapping my head around a concept. I write a query that pulls out data from salesforce and sends it to a web service. The webservice sends me back data for a report. This ...
0
votes
1answer
82 views

Why won't this Test Class provide code coverage?

Edit Sept 28th 2016 Thank you all for the feedback! I have a lot of reading to do and I will be marking this as answered. Please see... Customer Community User (Non-Plus) Sharing Set Access not ...
1
vote
1answer
103 views

TestClass for throwing Exception while testing Trigger [duplicate]

I writing my first Testclass to test my first Trigger and encountered some error. I have written a trigger to update the Phone number of all contacts when its Accounts Phone number is updated. Its ...
2
votes
1answer
44 views

Rewriting trigger for an old API version

I was in the process of updating the API version of all the old classes and triggers in our org (noticed alot of them were in version 15-18 instead of 41+). Everything wen successfully, except for one ...
0
votes
0answers
74 views

Test Class - Issue

Test Class @isTest(SeeAllData=true) public class ImplementationControllerTest { public static testmethod void test1() { Implementation__c i = [SELECT Id,Implementation_Status__c,...
-1
votes
1answer
41 views

Testclass to check date change

I have a trigger that changes a date field based on activity on related object. The trigger works fine but the test class that I created didn't work and has 0 coverage. So basically, if there is a ...
0
votes
1answer
30 views

Test Error- Changing from List to Id - List has no rows for assignment to SObject

In my test class I have a query: Id oppId = [SELECT Opportunity__c FROM Credit_Review__c LIMIT 1].Opportunity__c; when I use query editor: SELECT Opportunity__c FROM Credit_Review__c LIMIT 1 I get ...