Best practice for Test Classes-
- Never write a test class without starting it with ‘@isTest’.
- For negative and positive, always put assert statements.
- Avoid using hardcoded IDs.
- It must have 75% coverage but always try to increase it to 95%.
- Keep the real scenario in mind while writing a test class as it will handle any number of records.
- Each branch of conditional logic must be tested.
-
This reply was modified 6 years, 2 months ago by
Forcetalks.