1.

What are some development practices to follow when writing automated tests?

Answer»

All the software development rules APPLY when writing automated tests. Here are some of the best practices that ONE can apply for tests.

  • Validating the tests will fail
    • Similar to testing that software will work, it's essential to ensure the test will fail if the FEATURE its testing doesn't meet the criteria. 
    • A test that never fails is worse than having no tests, as it gives a false assurance that the feature is working. 
  • Don't Repeat Yourself (DRY)
    • Avoiding duplication in code is crucial.  
    • The benefit of this strategy is that the change is isolated to a single location, preventing BUGS and ERRORS
  • Keep Functions Small
    • Since the testers who are creating automated tests are not familiar with good coding standards, it's easy to fall into the trap of creating giant functions that try to do everything. 
    • This quickly results in unmaintainable code that the team is afraid to touch when the requirements change, resulting in out-of-date tests that test the legacy behavior of the system. 
  • Write Good Documentation
    • Having well-written documentation explains not only the what, but then why is important for new team members when they try to understand the tests. 
    • It can also help the person who wrote the tests when they try to modify/understand the tests in the future.


Discussion

No Comment Found