Skip to content

Hubtel Automated Software Testing Guidelines

Every organization has conventions that make their work processes unique to them. Here we look at Hubtel's guidelines on how to write tests in terms of naming convention, file, solution and method nomenclatures and general approaches for testing. These rules apply to both unit and integration tests in hubtel.

Guiding Document

Writing Tests

When writing tests, consider the following guidelines:

  1. Test Naming Convention: Follow a clear and consistent naming convention for your unit tests. Use descriptive names that indicate what aspect of the code you are testing.
  2. Test Organization: Organize your tests into logical groups or classes. Group related tests together to improve readability and maintainability.
  3. Test Coverage: Aim for comprehensive test coverage by testing different scenarios and edge cases. Cover positive and negative test cases to ensure code correctness and robustness.
  4. Arrange, Act, Assert (AAA): Structure your tests using the AAA pattern. The "Arrange" section sets up the necessary preconditions, the "Act" section performs the action being tested, and the "Assert" section verifies the expected outcome.
  5. Isolation: Isolate your tests to focus on the specific unit under test. Use test doubles (e.g., mocks, stubs) to replace dependencies and control their behavior.
  6. Readable Assertions: Use clear and expressive assertions to verify the expected results. Well-defined assertions make it easier to understand the purpose of the test and diagnose failures.
  7. Test Data: Use appropriate test data to cover different scenarios. Consider boundary values, invalid inputs, and any other relevant test cases.
  8. Avoid Test Dependencies: Ensure that tests are independent and do not rely on the state or outcome of other tests. Each test should be able to run in isolation.
  9. Keep Tests Fast and Deterministic: Aim for fast-running tests that complete quickly. Minimize any external dependencies that can introduce variability into test results.