You need to sign in to do that
Don't have an account?
Help - Test Method
Hi,
Can anyone help me in writing test method for the following apex controller.
public with sharing class LookupPopupController
{
public String query {get; set;}
public List<Opportunity> opportunities {get; set;}
public PageReference runQuery()
{
List<List<Opportunity>> searchResults = [FIND :query IN ALL FIELDS RETURNING Opportunity (id, name, StageName, Amount, CloseDate, FiscalQuarter, FiscalYear Where ForecastCategory IN ('Pipeline', 'Best Case') and CloseDate = THIS_FISCAL_QUARTER order by StageName)];
Opportunities = searchResults[0];
return null;
}
}
Thank you,
S.Sivakumar
Here's an example of one way to do it. You'll only want to use this as a guide and create a more substantial test.
Hey i am new to this, I dont know how to modify the test code.
If i run that code i am getting "Assertion failed" as an error message.
Please help me to achive the code coverage.
Thanks,
S.Sivakumar.
If i remove System.assert line i am getting 100%code coverage.
Is that a right way to do?
Please correct me.
Thanks,
S.Sivakumar.