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