Skip to content

Commit

Permalink
Describe current test naming conventions in the contributing guidelin…
Browse files Browse the repository at this point in the history
…es (#2821)

Closes FerretDB/engineering#66.
  • Loading branch information
Elena Grahovac authored Jun 9, 2023
1 parent 0f8f663 commit 345488d
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
23 changes: 23 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,29 @@ Writing separate tests might be much better than making a single test that check

Also, we should use driver methods as much as possible instead of testing commands directly via `RunCommand`.

#### Integration tests naming guidelines

1. Test names should include the name of the command being tested.
For instance, `TestDistinct` for testing the distinct command.
2. Compatibility tests should have `Compat` in the name, following the command.
For example, `TestDistinctCompat`.
3. If the test doesn't use driver method but runs a command directly via `RunCommand`,
the suffix `Command` should be added.
For example, `TestDistinctCommand`.
4. If the test is both compat and runs a command, the suffix `CommandCompat` should be added.
For example, `TestInsertCommandCompat`.
5. If the file consists of compatibility tests, add the `_compat` suffix.
For example, `distinct_compat_test.go`.
6. Test names should be descriptive and provide information about the functionality or condition being tested.
If the test is checking for a specific error scenario, include the error scenario in the name.
7. Keep test names concise, avoiding overly cryptic names.
Use abbreviations when appropriate.
8. Avoid including test data in the name to maintain clarity and prevent excessively long names.
9. Test case names should follow `TitleCase` capitalization style.
No spaces, dashes or underscores should be used neither for test names nor for test case names.
10. Keep the concatenation of test name segments (test, subtests, and handler) within 64 characters
to satisfy the maximum limit for database names.

### Submitting code changes

#### Before submitting PR
Expand Down
6 changes: 3 additions & 3 deletions integration/indexes_compat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ func TestIndexesCompatCreate(t *testing.T) {
}
}

// TestIndexesCreateRunCommand tests specific behavior for index creation that can be only provided through RunCommand.
func TestIndexesCompatCreateRunCommand(t *testing.T) {
// TestCreateIndexesCommandCompat tests specific behavior for index creation that can be only provided through RunCommand.
func TestCreateIndexesCommandCompat(t *testing.T) {
setup.SkipForTigrisWithReason(t, "Indexes creation is not supported for Tigris")

t.Parallel()
Expand Down Expand Up @@ -559,7 +559,7 @@ func TestIndexesCompatDrop(t *testing.T) {
}
}

func TestIndexesCompatDropRunCommand(t *testing.T) {
func TestDropIndexesCommandCompat(t *testing.T) {
setup.SkipForTigrisWithReason(t, "Indexes are not supported for Tigris")

t.Parallel()
Expand Down

0 comments on commit 345488d

Please sign in to comment.