What are unit test standards?

What are unit test standards?

Unit tests are short, quick, and automated tests that make sure a specific part of your program works. They test specific functionality of a method or class that have a clear pass/fail condition. By writing unit tests, developers can make sure their code works, before passing it to QA for further testing.

How do you name unit test classes?

Naming Test Classes

  1. If the test class belongs to the first group, we should name it by using this formula: [The name of the tested class]Test.
  2. If the class belongs to the second group, we should name it by using this formula: [The name of the tested feature]Test.

How do you name a test case?

However, every test case can be broken down into 8 basic steps.

  1. Step 1: Test Case ID.
  2. Step 2: Test Description.
  3. Step 3: Assumptions and Pre-Conditions.
  4. Step 4: Test Data.
  5. Step 5: Steps to be Executed.
  6. Step 6: Expected Result.
  7. Step 7: Actual Result and Post-Conditions.
  8. Step 8: Pass/Fail.

Do you put method name in unit test?

Improve this answer Follow edited Jul 9 at 11:21 answered Oct 20 ’09 at 11:47 Marc ClimentMarc Climent 9,13422 gold badges4848 silver badges5454 bronze badges 19 256 For me it makes no sense to put method name in test method.

What are the names of the unit tests?

The basic naming of a test comprises of three main parts: [UnitOfWork_StateUnderTest_ExpectedBehavior] A unit of work is a use case in the system that startes with a public method and ends up with one of three types of results: a return value/exception, a state change to the system which changes its behavior,…

Why are unit test names not expressive enough?

If both the name of the test and the error messages in it are not expressive enough, the poor maintenance developer (often the same one who developed the tests) is left to wonder what was this joker thinking? looking at a year old code base with unit tests.

What are the names of the test methods?

I observed that MethodName_StateUnderTest_ExpectedBehavior is similar with given/when/then in other order (more useful for long testing methods list): when_given_then. When – MethodName, or many methods names if needed, or action without associated with specific method. Given – state at test moment. Then – excepted result.