Comprehensive unit testing
Prioritize unit tests over integration tests. Test state transitions, edge cases, serialization round-trips. Every implementation MUST include a corresponding test file. UI tests are fragile — prefer testing component logic as unit tests.
Testing
Every change MUST have tests. Every bug fix MUST have a regression test. Unit tests SHOULD be prioritized over integration tests. Test state transitions, edge cases, and serialization round-trips. UI tests are fragile — prefer testing component logic as unit tests.
TypeScript
Use Playwright for end-to-end and visual regression testing. Screenshot comparison for snapshot tests. Use Storybook for component catalog and visual tests where applicable.
C#
- xUnit with
[Fact]for single tests and[Theory]/[InlineData]for parameterized tests. - FluentAssertions for readable assertions.
- NSubstitute for mocking.
- Every change needs tests. Every bug fix needs a regression test.
- Prioritize unit tests over integration tests.
[Fact]
public void ParseOrder_WithValidInput_ReturnsOrder()
{
var result = OrderParser.Parse(validJson);
result.Should().NotBeNull();
result.OrderId.Should().Be("ORD-123");
}
[Theory]
[InlineData("", false)]
[InlineData("valid@email.com", true)]
[InlineData("no-at-sign", false)]
public void IsValidEmail_ReturnsExpected(string input, bool expected)
{
EmailValidator.IsValid(input).Should().Be(expected);
}
Python
- Use
pytestfor all tests. - Every change needs tests. Every bug fix needs a regression test.
- Prioritize unit tests over integration tests.
- Production dashboard data MUST NOT be removed or modified during testing — use demo port 9888, not production port 8888.