10 coding watchouts for an Automation Developer – Part 3

Click here to read about 10 coding watchouts for an Automation Developer- Part 2

  1.   Testing Framework

A framework usually takes away the grunt work out of running the tests, generating reports. The most common frameworks used in automation is JUnit & TestNG. Moreover you can design your own framework.

TestNG is a preferred framework for testers. It is inherited from JUnit and NUnit. It allows you to group test cases easily which is not possible in JUnit.

Using a framework like TestNG gives you to flexibility to define execution order, dependency on other cases/skipped if one or more cases fail, etc.

It also has automatically to generate test reports in both HTML and XML formats.

  1.  Retrieving test data from external files

Instead of hard coding, it will be better to keep test data is kept in external files and read it through your script.
For example : to compare data, use for data-driven testing or it can even be used for Assertion/Validation purposes.

Keeping test data in external files is always a good approach. It gives the feasibility to make changes in just one file whenever test data changes rather than tampering your entire code.

  1.   Modularize your code

Always follow “Divide and conquer”.

Smaller the size of code component, easier it is to maintain.

It will provide more reusability and separation of concerns. It becomes even more beneficial when working in teams for others to understand the code easily.

Click here for Part 4

Ravi Beck