Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions _rules/1600.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
rule_id: 1600
rule_category: testability
title: Use short concise functional test names
severity: 2
---
A test name should describe the behavior being verified in plain language, not the implementation detail being exercised. It should read like a sentence that a non-developer can understand, preferably in the present tense. In other words, without words like "should" and "would".

```csharp
// Avoid
[Fact]
public void TestCalculations1() { ... }

[Fact]
public void CalculateTotal_WhenDiscountIsApplied_ShouldReturnReducedAmount() { ... }

// Prefer
[Fact]
public void Total_is_reduced_when_a_discount_is_applied() { ... }
```

Use underscores to separate words if your test framework supports it. Keep names short enough to fit on one line, but long enough to communicate intent without reading the test body.