0

Please correct me if I am wrong. My understanding that Apex Class and Apex Trigger Class needs to have at least 75% code coverage to pass validation test.

I would like to know if does this 75% code coverage also need to apply to Visual Force page? And by that I mean, do I need to write unit test for Visual Force page?

Thanks

0

If you have a controller for your Visualforce page you will need to write test code for the controller.

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_testing_best_practices.htm

3
  • in another word you are saying write unit test on the Controller?
    – CB4
    Sep 8 '17 at 20:00
  • Yes you will need test code coverage for your controller
    – EricSSH
    Sep 8 '17 at 20:02
  • here is my situation. I have a working web app and its has always been tested and validated pass in the past. Today, I then modified some visual force pages (only visual force pages and not any controller) - so i looks like i dont' have to write any new unit test. Correct?
    – CB4
    Sep 11 '17 at 19:05
0

The test classes are to be written for triggers and classes, and then run those test classes to generate code coverage information.

The file types includes are triggers(.trigger) and classes (.cls) from metadata. Test coverage is not needed for visual force pages.

Reference link Testing and Code Coverage

1
  • While it is definitely suggested you test all your classes and triggers, note that Salesforce mandates overall 75% coverage across all your classes/triggers and each trigger needs to have some coverage. However, you can have classes which out any coverage and Salesforce would be as long as overall is above 75%.
    – realfire
    Sep 9 '17 at 23:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.