Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 2576

A unit test is code that is written and executed to test a specific portion/unit of source code. Unit tests are class methods with the testMethod modifier or @isTest annotation and are usually placed in separate test classes annotated with the @isTest annotation. Code that is executed by unit tests is considered covered. At least 75% of an organization's codebase must be covered by unit tests and every trigger must have at least 1% unit test coverage.

1 vote

Error in Test Class :Quote has no pricebook assigned

Just as @BarCotter suggested, you need to assign the Quote record with a Pricebook Id. You simply do the following in your test class: Quote testQuote = new Quote(Name = 'test-RFQ', Effective_Date__c …
Programmable Medley's user avatar
2 votes
1 answer
2k 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: TestUtilities.SoftAssertEquals(IfCaus …
Programmable Medley's user avatar
8 votes

Variable is not visible in test class

That's because you did not label your properties as public (you don't have an access modifier at all) in your class. I am going under the assumption that you wanted these List to be accessible publicl …
Programmable Medley's user avatar
3 votes
1 answer
2k views

Peculiar StandardSetController Issue with Test Class

Currently I have a test method that is proving to be quite difficult to test. I currently have a controller extentsion that is used for a custom list view button. The test code gets almost every lin …
Programmable Medley's user avatar
4 votes
1 answer
1k 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 Si …
Programmable Medley's user avatar
3 votes
Accepted

A MORE Odd Test Coverage Issue with an Inner Abstract Class and an Inner Extended Class

Okay, oddly enough, adding the constructor to the base class was the trick to having the Test class pass. However, it didn't pass until I ran it through the setup menu. ::shurgs:: Such a simple answer …
Programmable Medley's user avatar
10 votes
Accepted

Test method with query string

Because you need to insert an Account prior to running your tests. Simply do the following prior to the test: public static testMethod void TestChurchName() { Account TestAccount = new Account(N …
Programmable Medley's user avatar
1 vote

Create test fixtures for Apex Unit Tests

I created this one today believe it or not. I had a basic version of this but, I finally expanded it on to make it more versitle. It took me a while but, I finally got it down to something I was com …
Programmable Medley's user avatar
12 votes
Accepted

Test Class for QuickAction.QuickActionDefaultsHandler

After some thinking, I realized that I can create the instances I want by using JSON strings and deserializing them into my desireable mock implementations. So, in my class implementing the QuickActi …
Programmable Medley's user avatar
8 votes
3 answers
4k views

Test Class for QuickAction.QuickActionDefaultsHandler

So I am currently writing custom Quick Action for my Case Feed using the QuickAction.QuickActionDefaultsHandler interface (The code is in this question I also asked). I was looking for a proper way t …
Programmable Medley's user avatar
3 votes

Apex Code Coverage: Test classes are included with 0% in overall code coverage calculation

I know this is a late answer but, I would like to give my two cents since I was about to ask a very similar question. The reason your overall code coverage is so low is due to a non-test method withi …
Programmable Medley's user avatar
0 votes

Apex Test Class for trigger

It would actually be rather simple. To get a baseline test: @isTest public class AfterUpdateOpportunityTriggerTest { static testMethod void AfterUpdateOpportunityCreatesProjectsTest() { / …
Programmable Medley's user avatar
1 vote

Unit testing with callout conflicts with workflow rule

Here is a suggestion that I think might work. It is kind of weird, but bear with me. So I will ask you to try the following: public static Account customer { get; set; } static { //This will inse …
Programmable Medley's user avatar
4 votes
Accepted

OpportunityLineItem in test classes

Instead of of this: Pricebook = [select id from PriceBook2 where isStandard = true].Id Why not try this instead? PriceBook2Id = Test.getStandardPricebookId()
Programmable Medley's user avatar