Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
481 views
in Technique[技术] by (71.8m points)

testing - Writing Quality Tests

We know that code coverage is a poor metric to use when gauging the quality of test code. We also know that testing the language/framework is a waste of time.

On the other hand, what metrics can we use to identify quality tests? Are there any best practices or rules of thumbs that you've learned to help you identify and write higher quality tests?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
  1. Make sure your tests are independent of each other. A test shouldn't depend on the execution or results of some other test.
  2. Make sure each test has clearly defined entry criteria, test steps and exit criteria.
  3. Set up a Requirements Verification Traceability Matrix (RVTM). Each test should verify one or more requirement. Also, each requirement should be verified by at least one test.
  4. Make sure your tests are identifiable. Establish a simple naming or labeling convention and stick to it. Reference the test indentifier when logging defects.
  5. Treat your tests like you treat your code. Have a testware development process that mirrors your software development process. Tests should have peer reviews, be under version control, have change control procedures, etc.
  6. Categorize and organize your tests. Make it easy to find and run a test, or suite of tests, as needed.
  7. Make your tests as succinct as possible. This makes them easier to run, and automate. It's better to run lots of little tests than one large test.
  8. When a test fails, make it easy to see why the test failed.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...