Tuesday, July 3, 2007

Quality code best practice.

The most simple test automation can be fraught with errors. To prevent these problems, you must strictly adhere to the four characteristics of high quality test code.

To review, the four characteristics are:
- Can be easily analyzed in the event of a failure.
- Takes as few environmental dependencies as possible.
- Follows good design principles.
- Is consistent with organizational and company policies.

As these characteristics are applied, it is possible to identify practical examples of these characteristics, such as:
- Do not hard-code paths and network names.
- Avoid taking network dependencies.
- Don’t assume English. Provide as much information as is reasonable when a test fails.
- Use appropriate synchronization mechanisms.
- Use Thread.Sleep sparingly. Never hard-code user credentials, especially passwords.

No comments: