QuestionQ26

VerifiedTest Automation Tools

A development team at Universal Containers created Apex Triggers and Apex Classes in a sandbox. The team also wrote test classes to unit-test these triggers and classes. When run in the sandbox, every test method passes and all classes satisfy the minimum code-coverage requirement. However, when they attempted to deploy these components to production, several test methods failed.

What should an architect recommend?

Explanation

Apex unit tests should be self-contained and create the records they require in the test methods (or shared test setup). Avoiding SeeAllData=true prevents tests from depending on environment-specific production or sandbox data, which can differ and cause deployment-time failures.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!