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

2 Answers 2

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
    Commented Sep 8, 2017 at 20:00
  • Yes you will need test code coverage for your controller
    – EricSSH
    Commented Sep 8, 2017 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
    Commented Sep 11, 2017 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%.
    – metasync
    Commented Sep 9, 2017 at 23:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .