3

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?

0
3

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.

0

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.