Timeline for Test Class for Code Coverage - Coding a Test Method in Test Class
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 30, 2018 at 19:41 | comment | added | David Reed | Your test is failing. You need to figure out why. While comments should not be for follow-up discussions, this is probably because you don't re-query your objects after you perform trigger work. | |
Mar 30, 2018 at 19:39 | comment | added | Kyle Golik |
Thank you @DavidReed now I got a basic syntax question, when I Run Test on my Test Class I get this error: "System.AssertException: Assertion Failed: Expected: , Actual: May 2018" This is the snippet of my code: code qli.Year_Served_First__c='2018'; qli.Months_Served_Y1__c='May'; update qli; system.assertEquals(oli.Months_to_Fulfill__c, 'May 2018'); // Release governor limits and resources Test.stopTest(); } }code
|
|
Mar 30, 2018 at 17:37 | comment | added | David Reed |
Your test method must also be annotated with @isTest . See the example of a complete test class in the link in the answer above.
|
|
Mar 30, 2018 at 17:33 | comment | added | Kyle Golik |
This is the beginning of my code, when I put in a second isTest, it errors out: code @isTest private class UpdateOpportunityProductMonthsToFulfill{ static void testOLIUpdate() { // Obtain Apex governor limits and resources for this test Test.startTest();
|
|
Mar 30, 2018 at 17:26 | comment | added | sfdcfox♦ |
@KyleGolik You need to change @testSetup to @isTest .
|
|
Mar 30, 2018 at 17:05 | comment | added | Kyle Golik | Thank you @David Reed for the follow up. I still after removing the testSetup, I still have no Test Methods? I feel I am missing something simple. As for the SOQL query, I am going to change accordingly. | |
Mar 30, 2018 at 15:31 | history | answered | David Reed | CC BY-SA 3.0 |