You need to sign in to do that
Don't have an account?
Rachel Linder 8
Trigger Deployment is Failing and Don't Know How To Correct
I am deploying a new trigger. And It is failing. I am not a developer so I do not know how to correct the error. Any help would be appreciated. Here is the Apex Test Failuers error:
The "TestClass" code is:
The "TestClass" code is:
@isTest(SeeAllData=true) private class TestClass { static testMethod void myUnitTest() { Profile p = [Select id from Profile where Name ='System Administrator']; Profile EUP = [Select id from Profile where Name ='EU - Standard User w/ Reporting']; user u = [select id, ProfileId, UserRoleId,Name, Team__c, Territory__c, Region__c from User where /*Name =: 'Gavin Barber']; //*/ProfileId =: EUP.Id and isActive = true limit 1]; // user u2 = [select id, ProfileId, UserRoleId,Name, Team__c, Territory__c, Region__c from User where /*Name =: 'Amy Harrington'];//*/ProfileId =: p.Id and isActive = true limit 1]; // /*User u = new User(Alias = 'standt', Email='standarduser@testorg.com', EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', LocaleSidKey='en_US', ProfileId = p.Id, TimeZoneSidKey='America/Los_Angeles', UserName='standarduser@testorg.com');*/ Date d = System.Today(); DateTime dt = system.now(); date flightstart = date.valueof(dt.addMonths(-3)); date flightend = date.valueof(dt.addMonths(3)); string ThisWeek1 = dt.format('w'); string LastWeek = dt.addDays(-7).format('w'); integer Lastweeki = integer.valueof((string)Lastweek); integer thisweeki = integer.valueof((string)thisweek1); string thisyear = dt.format('yyyy'); string thisMonth = dt.format('MMMM'); string Quarter = ThisMonth == 'January' ? 'Q1' : ThisMonth == 'February' ? 'Q1' : ThisMonth == 'March' ? 'Q1' : ThisMonth == 'April' ? 'Q2': ThisMonth == 'May' ? 'Q2' : ThisMonth == 'June' ? 'Q2' : ThisMonth == 'July' ? 'Q3' : ThisMonth == 'August' ? 'Q3' : ThisMonth == 'September' ? 'Q3' : ThisMonth == 'October' ? 'Q4' : ThisMonth == 'November' ? 'Q4' : ThisMonth == 'December' ? 'Q4' : '' ; list<Quota__c> qtalist = new list<Quota__c>(); Quota__c testqta = new Quota__c (OwnerId = u2.Id, January__c = 100, February__c = 100, March__c = 100, April__c = 100, May__c = 100, June__c = 100, July__c = 100, August__c = 100, September__c = 100, October__c = 100, November__c = 100, December__c = 100, RecordTypeId = '012500000009iOD',Year__c = '2013',Region__c = 'aaa',Office__c = 'aaa',Team__c = 'aaa'); qtalist.add(testqta); Quota__c qta3 = new Quota__c (OwnerId = u2.Id, January__c = 2, February__c = 2, March__c = 2, April__c = 2, May__c = 2, June__c = 2, July__c = 2, August__c = 2, September__c = 2, October__c = 2, November__c = 2, December__c = 2, RecordTypeId = '012500000009iOD',Year__c = '2012',Region__c = 'aaa',Office__c = 'aaa',Team__c = 'aaa'); qtalist.add(qta3); Quota__c qta2 = new Quota__c (name ='default',OwnerId = u2.Id, January__c = 2, February__c = 2, March__c = 2, April__c = 2, May__c = 2, June__c = 2, July__c = 2, August__c = 2, September__c = 2, October__c = 2, November__c = 2, December__c = 2, RecordTypeId = '012500000009iOD',Year__c = '2012',Region__c = 'aaa',Office__c = 'aaa',Team__c = 'aaa'); qtalist.add(qta2); insert qtalist; test.startTest(); list<Account> AdvertiserList = new list<Account>(); id holdingcompanyrt = utils.getRecordTypeId('Account', 'Holding Company'); Account HoldingCompany = new Account(Name = 'Test HoldingCompany', RecordTypeId = holdingcompanyrt, OwnerID = u2.Id); insert HoldingCompany; id mainagencyrt = utils.getRecordTypeId('Account', 'Main Agency'); Account MainAgency = new Account(Name = 'Test Main Agency', RecordTypeId = mainagencyrt,OwnerID = u2.Id,Holding_Company_Name__c = HoldingCompany.Id); insert MainAgency; id LocalAgencyrt = utils.getRecordTypeId('Account','Local Agency'); Account LocalAgency = new Account(Name = 'Test Local Agency', RecordTypeId = LocalAgencyrt, Main_Agency__c = MainAgency.Id, Holding_Company_Name__c = HoldingCompany.Id, SageID__c ='ABC100'); insert LocalAgency; Account LocalAgency2 = new Account(Name = 'Test Local Agency2', Main_Agency__c = MainAgency.Id ,RecordTypeId = LocalAgencyrt, SageID__c ='ABC100'); insert LocalAgency2; id Advertiserrt = utils.getRecordTypeId('Account', 'Advertiser'); Account Advertiser = new Account(Name = 'Test Advertiser', RecordTypeId = Advertiserrt, Local_Agency__c = LocalAgency.Id ); insert Advertiser; Advertiser.BillingState = 'Idaho'; Advertiser.BillingCountry = 'United States'; Advertiser.Create_Sage__c = true; Advertiser.SageID__c = ''; Advertiser.Main_Agency__c = null; update Advertiser; Advertiser.BillingState = ''; update Advertiser; Advertiser.SageID__c ='100ABC'; update Advertiser; test.stopTest(); } static testmethod void testmethod2() { test.startTest(); Opportunity opp = [select id from Opportunity where Name IN('test') and CloseDate >: system.today()-60 and Sales_Stage_High_Level__c =: 'Open' and HasOpportunityLineItem =: true limit 1]; opp.move_all_flight_dates__c = true; opp.ContractStartDate__c = system.Today(); opp.ContractEndDate__c = system.Today()+90; update opp; test.stopTest(); } static testmethod void testmethod5() { test.startTest(); Opportunity opp = [select id from Opportunity where Name IN('test') and Sales_Stage_High_Level__c =: 'Open' and HasOpportunityLineItem =: true limit 1]; opp.StageName = 'Closed Won'; opp.HasSageID__c = false; opp.Exception__c = false; opp.SVP_Email__c = null; update opp; delete opp; test.stopTest(); } static testmethod void testmethod4(){ test.startTest(); Opportunity opp = [select id from Opportunity where Name IN('test') and Sales_Stage_High_Level__c =: 'Open' limit 1]; OpportunityTeamMember ot = new OpportunityTeamMember(UserId = '005500000018PC2', TeamMemberRole='Account Manager',Split__c = 50,Date_Split_Starts__c = system.Today(),Date_Split_Ends__c=system.Today()+30, OpportunityId = opp.Id); insert ot; test.stopTest(); } static testmethod void testmethod6(){ test.startTest(); /* Opportunity opp = [select id from Opportunity where Name IN('test') and Sales_Stage_High_Level__c =: 'Open' and HasOpportunityLineItem =: false limit 1]; Product2 prod = new Product2(name='test product',CanUseRevenueSchedule=True); insert prod; PricebookEntry pbe = new PricebookEntry(UnitPrice=0, UseStandardPrice=true,Product2Id=prod.id, Pricebook2Id = '01s50000000IJr3',IsActive=true); insert pbe; OpportunityLineItem oliUS = new OpportunityLineItem(UnitPrice=0,Quantity=1,PricebookEntryId=pbe.Id ,OpportunityId=opp.id, Placement__c = 'aaa', Flight_Start_Date__c =system.today()-1,Flight_End_Date__c = system.today()+30, Rev_Type__c = 'CPM',Rate__c = 1, insertbudget__c = 600, distribute_evenly__c = true ); insert oliUS;*/ test.stopTest(); } static testmethod void testmethod3(){ PageReference pageref = new Pagereference('apex/Account_Transfer2'); test.setcurrentpage(pageRef); //Instantiate the standard controller Account act = new Account(); ApexPages.StandardController sc = new Apexpages.standardController(act); //Instantiate the extension //Account_Transfer2 ext = new Account_Transfer2(sc); //Do the work //ext.getEmps(); //ext.del(); //ext.onSave(); //ext.AccountWork(); //ext.NextPage(); //ext.Opportunity_Transfer(); } }
Or fix the code like below