5

I provide a standardized but unmanaged package to clients who have different workflow needs. The workflows sometimes interfere when I deploy new standard code. Does it make sense to turn them off? That would mean that after deployment when I turn them back on again, the tests would fail.

Example: My clients use validation rules that accept only certain amounts for membership dues. They all have different amounts. On top of it they sometimes change the amounts. When I test code for the online payments module, I insert opportunities with random amounts, but if those amounts aren't the same as the ones the client instance accepts, the test fails. I could modify the test amounts to fit the current validation rule, but later the organization could change the accepted amounts and the test would fail again.

Any guidance on this? Thanks, Baird

1

One thing you could do is create a custom setting where the clients would enter their limits. Then in your tests (using seealldata=true) you could query for those settings and adjust your test records accordingly. You would have to be careful in your implementation to ensure that all tests are returning only records your test have inserted since seel all data is set to true.

Another possible solution is when inserting records in your tests, parse out the errors to understand what the limits are for the field and readjust the record being inserted to account for the errors. This may be a bit more tricky depending on what type of asserts you have in your test classes...But is would be more streamlined...

| improve this answer | |

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.