Names of unit tests (using gotests)

Hello everyone,

Are you using https://github.com/cweill/gotests to generate table-based unit test skeletons, and if so, what naming convention do you use for your tests ?

I am talking about the field “name” in the auto generated tests struct slice:

tests := []struct {
    name           string
    fields         fields
    args           args
    wantExitStatus subcommands.ExitStatus
}

On running said tests, the output looks like this:

=== RUN   TestAPICmd_Execute
=== RUN   TestAPICmd_Execute/API_cmd_should_call_Server.Start()
--- PASS: TestAPICmd_Execute (0.52s)
--- PASS: TestAPICmd_Execute/API_cmd_should_call_Server.Start() (0.52s)

This is because I have set may name field to:

name: "API cmd should call Server.Start()"

Any advice ?

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.