You need to sign in to do that
Don't have an account?
Newbie 2014
Help requested to debug a test class
Hi: I wrote this simple test class below hardcoding with a id. I executed the select statments in query editor, returning 8 ids correctly. But when run the test class below and check logs, I see it is gettign 0 rows after execution. Can't figure out why that might happen. Any clue will be appreciate. Much thanks
--------
@isTest()
public class deleleteLineItem
{
static testmethod void unittest() {
List<opportunitylineitem> ol = new List<opportunitylineitem>();
ol = [select id from opportunitylineitem where opportunityid = '006m0000002IbCiAAK'] ;
for(opportunitylineitem o: ol){
delete o;}
}
}
--------
@isTest()
public class deleleteLineItem
{
static testmethod void unittest() {
List<opportunitylineitem> ol = new List<opportunitylineitem>();
ol = [select id from opportunitylineitem where opportunityid = '006m0000002IbCiAAK'] ;
for(opportunitylineitem o: ol){
delete o;}
}
}
All Answers
account a = new account(name='testacount');
insert a;
Opportunity o = new Opportunity(name='testopp', accountid=a.id);
insert o;
//u can create OpportunityLineItem and insert opprtinity Id with 0.id...etc