You need to sign in to do that
Don't have an account?
Bryan Jimenez 5
Having trouble with dynamic apex class
Hi Everyone,
I am currently trying to get a test to work for a simple dynamic apex query.
However, I am getting nothing back when running the test.
Could someone please offer some assistance?
Below is my controller
My Test
My Visualforce Page is called UserInfoVF
Thank you in advance for your help!
I am currently trying to get a test to work for a simple dynamic apex query.
However, I am getting nothing back when running the test.
Could someone please offer some assistance?
Below is my controller
public class UserInfo { Public List<User> getUserInfo() { List<User> UserInfo=[Select Name,Kolbe_Score__c,Verb__c,Question_1__c,Question_1_Answer__c,Question_2__c,Question_2_Answer__c,Question_3__c,Question_3_Answer__c,Question_4__c,Question_4_Answer__c,Question_5__c,Question_5_Answer__c,Question_6__c,Question_6_Answer__c,User_Bio_Image_ID__c From User Where id = :ApexPages.currentPage().getParameters().get('sfdc.userId') ]; return UserInfo; } }
My Test
@isTest public class UserInfoTest { public static testMethod void TestMethod1() { User U = new User(); U.Kolbe_Score__c= 'Test'; insert U; Test.StartTest(); PageReference pageRef = Page.UserInfoVF; pageRef.getParameters().put('id', String.valueOf(U.Id)); Test.setCurrentPage(pageRef); UserInfo testAccPlan = new UserInfo(); //testAccPlan.save(); call all your function here Test.StopTest(); } }
My Visualforce Page is called UserInfoVF
Thank you in advance for your help!
All Answers