Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Can someone provide an example of how to write test code for a field set used in a controller? I just need the code showing how to create a field set in the test code, so I do not have to depend on a field set existing in the org?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

FieldSets are metadata rather than data and your VF page would fail if the field set wasn't present. So it would make sense to reference the field set in your test so that the missing field set is discovered

Also it's important to simulate the near real life execution scenario in a test, I.e reference the same field set that is being used by the VF Page/ Controller.

You can bundle your field set in the same deployment bundle as the code to avoid the breach of dependency.

share|improve this answer
    
Thanks for your help. –  JimH Jul 22 '13 at 11:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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