You need to sign in to do that
Don't have an account?
manjiri
How to write test classes for apex controller method
Hi,
Currently I am new, in writing testcases for apex classes.
I want to test the method for apex controller for visualforce page
e.g.public PageReference next()
how can I write test method for this?
Can anybody share the example?
Thanks
Currently I am new, in writing testcases for apex classes.
I want to test the method for apex controller for visualforce page
e.g.public PageReference next()
how can I write test method for this?
Can anybody share the example?
Thanks
1. http://www.salesforce.com/us/developer/docs/pages/index.htm
2. Go to Visualforce Controllers -> Custom Controllers and Controller Extensions -> Testing Custom Controllers and Extensions
In short, to write test methods for controllers, you want to write test scenarios to validate your controller's behavior.
You can instantiate the controller class just like any other class or object. Then you can 'set' and 'get the property values to start testing the
test scenarios. And you can also execute the action methods which return a PageReference and check to see if the proper Page or URL is returned.
I know this is just a start, but I hope it helps.
Check Apex language reference manual available in the wiki.
Try to implement all the test methods in a singe class based in the situation decided how many test class u want.
Thanks,
Currently I want to do test coverage for triggers, I am searching for that. If you know any solution example please share that.
Thanks
Here's a great example from one of our partners on bulkifying a trigger and how to write the correlating test class with 100% test coverage.
Best,
Sati