You need to sign in to do that
Don't have an account?
Its Urgent ! Anyone can solve my problem.Code coverage test classes
1.System.QueryException: List has no rows for assignment to SObject
Class.Leadpage.: line 11, column 1 Class.Leadtestss.runTest1: line 28, column 1
2.System.QueryException: List has no rows for assignment to SObject
Class.Leadpage.: line 11, column 1 Class.Leadtestss.runTest2: line 58, column 1
so on...
@isTest public class Leadtestss{ static testMethod void runTest1() { Account account = new Account(); account.Name = 'Accc3'; insert account; Contact contact = new Contact(); contact.FirstName = 'Todda'; contact.LastName = 'Wilmss1'; contact.AccountID = account.Id; contact.Email = 'twilms@verisign.conm'; contact.MobilePhone = '918527116723'; insert contact; Lead lead1 = new Lead(); lead1.FirstName = 'test'; lead1.LastName = 'Bcc3'; lead1.company='cc3'; insert lead1; test.startTest(); PageReference pageRef1 = Page.Leadpage; // Your page name pageRef1.getParameters().put('Id', String.valueOf(lead.Id)); Test.setCurrentPage(pageRef1); Test.setMock(HttpCalloutMock.class, new Leadpagemock()); ApexPages.StandardController sc1 = new ApexPages.StandardController(lead1);//Instance of your object Leadpage testDObj = new Leadpage(); testDObj.getperformcallout(); test.stopTest(); } static testMethod void runTest2() { Account account = new Account(); account.Name = 'Accc4'; insert account; Contact contact = new Contact(); contact.FirstName = 'Todda1'; contact.LastName = 'Wilmss2'; contact.AccountID = account.Id; contact.Email = 'twilms@verisign.cnm'; contact.MobilePhone = '918527117723'; insert contact; Lead lead1 = new Lead(); lead1.FirstName = 'test1'; lead1.LastName = 'Bcc4'; lead1.company='cc4'; insert lead1; test.startTest(); PageReference pageRef1 = Page.Leadpage; // Your page name pageRef1.getParameters().put('Id', String.valueOf(lead.Id)); Test.setCurrentPage(pageRef1); Test.setMock(HttpCalloutMock.class, new Leadpagemock()); ApexPages.StandardController sc1 = new ApexPages.StandardController(lead1);//Instance of your object Leadpage testDObj = new Leadpage(); testDObj.getperformcallout1(); test.stopTest(); } static testMethod void runTest3() { Account account = new Account(); account.Name = 'Accc5'; insert account; Contact contact = new Contact(); contact.FirstName = 'Todda2'; contact.LastName = 'Wilmss'; contact.AccountID = account.Id; contact.Email = 'twilms@verisign.conm'; contact.MobilePhone = '918527116723'; insert contact; Lead lead1= new Lead(); lead1.FirstName = 'test2'; lead1.LastName = 'Bcc5'; lead1.company='cc5'; insert lead1; test.startTest(); PageReference pageRef1 = Page.Leadpage; // Your page name pageRef1.getParameters().put('Id', String.valueOf(lead.Id)); Test.setCurrentPage(pageRef1); Test.setMock(HttpCalloutMock.class, new Leadpagemock()); ApexPages.StandardController sc1 = new ApexPages.StandardController(lead1);//Instance of your object Leadpage testDObj = new Leadpage(); testDObj.getperformcallout2(); test.stopTest(); } static testMethod void runTest4() { Account account = new Account(); account.Name = 'Accc6'; insert account; Contact contact = new Contact(); contact.FirstName = 'Todda3'; contact.LastName = 'Wilmss3'; contact.AccountID = account.Id; contact.Email = 'twilms@verisign.conjm'; contact.MobilePhone = '9185271163'; insert contact; Lead lead1= new Lead(); lead1.FirstName = 'test4'; lead1.LastName = 'Bcc6'; lead1.company='cc6'; insert lead1; test.startTest(); PageReference pageRef1 = Page.Leadpage; // Your page name pageRef1.getParameters().put('Id', String.valueOf(lead.Id)); Test.setCurrentPage(pageRef1); Test.setMock(HttpCalloutMock.class, new Leadpagemock()); ApexPages.StandardController sc1 = new ApexPages.StandardController(lead1);//Instance of your object Leadpage testDObj = new Leadpage(); testDObj.getperformcallout3(); test.stopTest(); } static testMethod void runTest5() { Account account = new Account(); account.Name = 'Accc7'; insert account; Contact contact = new Contact(); contact.FirstName = 'Todda4'; contact.LastName = 'Wilmss4'; contact.AccountID = account.Id; contact.Email = 'twilms@verisign.m'; contact.MobilePhone = '918527016723'; insert contact; Lead lead1= new Lead(); lead1.FirstName = 'test4'; lead1.LastName = 'Bcc7'; lead1.company='cc7'; insert lead1; test.startTest(); PageReference pageRef1 = Page.Leadpage; // Your page name pageRef1.getParameters().put('Id', String.valueOf(lead.Id)); Test.setCurrentPage(pageRef1); Test.setMock(HttpCalloutMock.class, new Leadpagemock()); ApexPages.StandardController sc1 = new ApexPages.StandardController(lead1);//Instance of your object Leadpage testDObj = new Leadpage(); testDObj.getperformcallout4(); test.stopTest(); } static testMethod void fakeTest11(){ Leadpage.fakeMethod11(); } static testMethod void fakeTest12(){ Leadpage.fakeMethod12(); } static testMethod void fakeTest13(){ Leadpage.fakeMethod13(); } static testMethod void fakeTest14(){ Leadpage.fakeMethod14(); } static testMethod void fakeTest15(){ Leadpage.fakeMethod15(); } }
Regards,
Mahesh
1.System.QueryException: List has no rows for assignment to SObject
Class.Leadpage.: line 11, column 1 Class.Leadtestss.runTest1: line 28, column 1
2.System.QueryException: List has no rows for assignment to SObject
Class.Leadpage.: line 11, column 1 Class.Leadtestss.runTest2: line 58, column 1
3.System.QueryException: List has no rows for assignment to SObject
Class.Leadpage.: line 11, column 1 Class.Leadtestss.runTest3: line 88, column 1
4.System.QueryException: List has no rows for assignment to SObject
Class.Leadpage.: line 11, column 1 Class.Leadtestss.runTest3: line 118, column 1
5.System.QueryException: List has no rows for assignment to SObject
Class.Leadpage.: line 11, column 1 Class.Leadtestss.runTest3: line 148, column 1