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:
- 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.
- Test Organization: Organize your tests into logical groups or classes. Group related tests together to improve readability and maintainability.
- 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.
- 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.
- 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.
- 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.
- Test Data: Use appropriate test data to cover different scenarios. Consider boundary values, invalid inputs, and any other relevant test cases.
- 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.
- Keep Tests Fast and Deterministic: Aim for fast-running tests that complete quickly. Minimize any external dependencies that can introduce variability into test results.
CHAT SAMMIAT