You need to sign in to do that
Don't have an account?

test coverage not processing bulk update branch
Can anyone help troubleshoot why my test coverage code is not testing a bulk update?
Here is my test coverage code:
Code:
static testMethod void testOpportunityOwnerRoleClass() { // Create a new opportunity to test Opportunity o = new Opportunity(Ownerid='00540000000o1y6AAA',Name='Test Opportunity Owner Role Trigger',CloseDate=Date.newInstance(2008,12,31),StageName='Prospecting'); insert o; // Check if owner role field has been set to updated with owner role System.assert(true, [Select Owner_Role__c from Opportunity WHERE ownerid = '00540000000o1y6AAA']); //System.assert(true, [Select Owner_Role__c from Opportunity WHERE ownerid = '00570000000sTcH']); } static Opportunity createNOpportunities(Integer n) { Opportunity opp = new Opportunity( ownerid = '00540000000o1y6AAA', Name = 'Bulk Opportunity Test', StageName = 'Prospecting', CloseDate = System.Today()); insert opp; return opp; } public static testMethod void testBulkOpportunities() { Opportunity o = createNOpportunities(numOpportunities); o.StageName = 'Qualification'; update o; Integer i = 0; for (Opportunity op : [Select Owner_Role__c from Opportunity WHERE ownerid = : o.ownerid]) { System.assertEquals('SVP, Sales & Marketing',op.owner_role__c); i++; } }
I'm trying to loop thru multiple opportunities where a field has been updated and assert that each opportunity with a specific ownerid is set correctly?
I'm having problems looping thru all opportunities created in the bulk test?
Currently, my test coverage code is 67%. I need another 8% to deploy.
Please help.
Thankk you.
Message Edited by Dman100 on 09-02-2008 11:18 PM
Message Edited by Dman100 on 09-03-2008 09:58 AM
Will someone please help?
The routine createNOpportunities() never references its argument 'n'. It unconditionally creates one Opportunity. I think you meant something more like this:
P.S. All triggers are bulk now, so not sure that this test is necessary. Post your trigger code?