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?
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.
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. |
|||||
|