The testclass tag has no wiki summary.
0
votes
0answers
18 views
How to avoid a dealock when setting up custom settings for test data?
We have a few triggers on different objects that depend on a custom setting to exist, so when we create test units on those objects, we need to create that custom setting.
We wanted to avoid having ...
1
vote
2answers
25 views
Trigger Test Class and Code Coverage
Need assistance to identify what's needed to obtain better coverage, which is currently 62%. Lines 12, 13, 17, 18, 23, 27 are all not covered. To note: I have not included any references to Contact__c ...
0
votes
1answer
22 views
Test methods for schedular which call the method of external end point
I am new to apex and have some questions.
Below are my conditions.
I have class A_Class in which it calls the external end point in some methods.
To test this class, I have already written HTTP ...
0
votes
1answer
24 views
Code Coverage for inner class having web service in salesforce
I have created the question - Scheduled reports and saving as salesforce documents
Scheduled reports and saving as salesforce documents
I have put the whole class in an inner class, for which, the ...
1
vote
1answer
55 views
Check with instanceof always returning true!
I am in the midst of writing a Test class for my code and there is a snippet of code that passes that I know should be failing.
The code below will always pass:
...
1
vote
1answer
61 views
Why is this test class returning an error?
I've got an after insert\after update trigger running off the Account object which is upsertting a new child record (object name : "SubsidiariesAndBrands__c"). It's running fine, but for some reason I ...
2
votes
1answer
49 views
Contract / Warranty Creation from Asset
The code I am attempting to fix today revolves around Contracts and Customer Assets.
The idea being that when a customers asset is generated or updated the account manager will check off "Support ...
2
votes
1answer
50 views
Update Trigger doesn't fire in testMethod
Basically, I've written a trigger that will update a custom field on an User object when the value of a standard field changes. The trigger works when it is "triggered" via actions made by me on the ...
5
votes
1answer
116 views
Error: MIXED_DML_OPERATION on setup and non-setup objects
In my test class i have the creation of a dummy custom setting and a dummy lead:
Group g1 = new Group(Name='group name', type='Queue');
insert g1;
QueuesObject q1 = new ...
2
votes
1answer
39 views
Developer Console and Package Visibility Error
Not sure if this is a bug in the Developer Console...?
I am building some simple test classes that reference static methods in a managed package. Everything works great when I build and update the ...
1
vote
1answer
40 views
Test Class update to Opp Owner causing DML Exceptions
I've been pulling my hair out trying to resolve a problem with a test class for a trigger that fires on update of Opportunity. When the Opp Owner is updated, the trigger updates the Owner of related ...
0
votes
1answer
91 views
Test class with custom setting
I' have written a trigger on lead, very simple.
I'am using the custom setting for the first tine to avoid hard coding or query to get ids.
I haven't experience testing custom setting.
I have a ...
4
votes
1answer
57 views
A MORE Odd Test Coverage Issue with an Inner Abstract Class and an Inner Extended Class
I am having some trouble getting any code coverage from my Test class. I noticed on the forum that there seemed to be an issue in regards to inner classes, which led me to a similar issue below:
A ...
6
votes
1answer
392 views
Spring 13 Test methods must be in test classes Error
Is someone getting the error "Test methods must be in test classes"
I am using @Istest annotation inside the class:
public class someclass{
@istest
public static void testme(){
...
}
...
1
vote
0answers
36 views
How to solve the heap size issue in test classes
I created test class for Apex Class .test class code coverage 90% but I can't move from sandbox to production because an error is thrown regarding heaps size: Heap Size 6798787. What can I do to avoid ...
2
votes
2answers
34 views
Creating a test for my trigger, need help on the cases to check
trigger trig_Opportunity_CreateOppOwner on Opportunity (before update, after insert) {
List<id>OppsID = new List<id>(); //List that will hold all id of all new Opportunities owners
...
2
votes
2answers
190 views
TestMethod do not support Web service callouts, test skipped
I have written a test class for a trigger on the lead object.
When i run the test class i get the following error:
Methods defined as TestMethod do not support Web service callouts, test skipped
...
1
vote
1answer
47 views
Any way to use test.load data when running Anonymous Block in Developer Console?
Cannot run our code in Anonymous Block using the test.loaddata statement. When running without the @isTest annotation fails since the "test.loaddata" statement can only be used for test methods.
When ...
1
vote
2answers
97 views
Writing test code for trigger on Master/Detail
I managed to get a simple rollup working fine for a rollup. The next step is to write a test for it.
trigger doRollup on Daily_Time_Record__c (after insert, after update, after delete, after ...
1
vote
2answers
122 views
Test class for happy birthday message
This is my working code to post an happy birthday picture and message on chatter :).
Global class HappyBirthdayRandom2 implements Schedulable{
//for test method
public static String CRON_EXP = '0 ...
1
vote
1answer
93 views
Test method to support getContent call
I have created getContent() method to send a pdf page in email using Visualforce page. But while running test method on the controller, I am getting following error message -
"Methods defined as ...
0
votes
0answers
74 views
Test Class Code Coverage Issue : System.QueryException
My Apex class is
Class1:
Public class myclass{
//some code
public void save(){
invoice_policy__c inp=[select ...
4
votes
1answer
60 views
Help with PostInstall Test Method Assert
I'm having trouble adding an Assert to the Test Method in my PostInstall Email Class. Can anyone point me to a resource or identify where I'm going wrong in my code? Thanks!
global class ...
4
votes
1answer
109 views
Test passes on Validation and fails on Deployment
I'm trying to deploy a change set with one updated class to production.
When I run Deploy it fails because an assertion failure in some other class in my org.
When I run Validation only it passes with ...
3
votes
1answer
167 views
How to I get a test class working for a standardsetcontroller that bases off one record
I have a difficult issue because I have essentially a standardcontroller that runs off the current opportunity but it needs to be used via a relatedlist button on a custom object so it has to be a ...
0
votes
3answers
78 views
How to create a custom field in test class
I have a custom setting which holds all the fields of an object. If i created a new custom field on the object it is need to get inserted into custom setting and for this i have written code which is ...
2
votes
2answers
127 views
Testing Apex Classes created by JSONtoApex
I'm using the json2apex (http://json2apex.herokuapp.com/) function to build a class to I can deserialize the JSON created by this call:
http://services.pbs.org/callsigns/zip/77050.json
It works ...
5
votes
1answer
185 views
Testing Errors in Web Service Callouts
I am testing a callout to a third party web service as documented here:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_callouts_wsdl2apex_testing.htm
Works great - but I can't see ...
4
votes
1answer
94 views
How to view the detailed debug log of the change set validation in production
I pushed a changeset from stage (sandbox) to production. Everything worked fine in stage but in production it didnt. It just says "Test Coverage of Selected Apex Trigger is 0%, at least 1% test ...
6
votes
2answers
83 views
Can I create a reusable class that creates opportunity records?
I have multiple Test classes that has duplicate code. One of the methods is to create opportunity records. Can I create a separate class that does this by itself and reference it from the Test ...
3
votes
1answer
130 views
Test class is not visible. Can I not call a test class from a separate test class?
Hello and thank you for taking the time to read my question. I am getting near the end of finally testing my new trigger, and started to clean up my code. I decided(as recommended by others in this ...
1
vote
1answer
57 views
How can I find the total size of a project
I'd like to increase my test coverage from 73% to 75% for Production. I am now increasing coverage on classes in Sandbox. I know how large are those classes without comments from Apex Classes page.
...
5
votes
2answers
428 views
No longer possible to mix testMethods in classes?
All of a sudden I am unable to call methods in any classes which are marked with @IsTest. The only thing I changed was all my *-meta.xml files (blindly) from ApiVersion 25/26 to 27.
Until now all my ...
1
vote
1answer
214 views
Test Class for Xml Dom Document & WebServices
My Apex class
public with sharing class helpTextClass {
public string main(string url)
{
Http h = new Http();
HttpRequest req = new HttpRequest();
...
4
votes
1answer
54 views
Is a test method isolated from effects of other test methods
Suppose I have test class TestClassName with two test methods:
@isTest
private class TestClassName {
static testMethod void testMethodName() {
// DML to insert data
}
static ...
3
votes
1answer
350 views
Where can I read the debug output of test classes
Suppose I have a test class TestClassName.
@isTest
private class TestClassName {
static testMethod void testMethodName() {
System.debug('My debug statement');
System.assertEquals(1, ...
7
votes
1answer
720 views
How to reduce the test class execution time while deploying?
I have optimized almost all my test classes but the "Run All Tests" execution time is still not reduced.
I ran the tests in my full copy sandbox and it took 28 minutes. There are about 464 test ...
4
votes
2answers
247 views
Help with test coverage
I was wondering if someone would be able to help me create a test class for the following code as I am programmatically challenged :) any help would be greatly appreciated!!! Thanks in advance!!!
...
4
votes
1answer
312 views
REQUIRED_FIELD_MISSING, Required fields are missing: [Name]: [Name]
when i trying to insert opportunity in my testclass i am getting an error
Test_opportunityTrigger.Test_opportunityTrigger: line 24, column 1
22:28:17.312 ...
2
votes
3answers
50 views
Where is the documentation for the Page keyword?
In the documentation for testing controllers and extensions, there's a statement that references a Page object, but I've been unable to find where this is located elsewhere in the documentation. Where ...
2
votes
1answer
172 views
Weird issue with inner class not being covered via Test Class?
I have a test class that is basically covering a class which has structure like
public class classA {
public class classB implements Triggers.Handler {
public void handle(){
...