function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

How to write test class for my search apex controller method



I am writing a test class for my search function. In VF page it has three criteria i.e. Name, Start date and End Date to summarize the results and I am using command button method “rerender” to render the results in a data table.


In my Apex controller, the selected criteria’s will be checked for ‘null’ or ‘not null’ before querying the result. I need to pass values for these criteria satisfying both ‘null’ and ‘not null’ for testing.


How to write a test method to pass values for these criteria’s?.



you must be having setters and getters for the three fields right!! Set them accordingly. and then call your action method for the button.