Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gotestoutline

CLI tool that outputs tests and subtests outline of a go test source file in JSON format.

Installing

go install github.com/devuo/gotestoutline@latest

Using

> gotestoutline file_test.go

This will write an output like the following to stdout:

[
    {
        "name": "TestMain"
        "type": "test",
        "path": [],
        "lbrace": 123,
        "rbrace": 458
    },
    {
        "name": "Succeeds",
        "type": "subtest",
        "path": ["TestMain"],
        "lbrace": 138,
        "rbrace": 235,
    },
    {
        "name": "Succeeds (With Option)",
        "type": "subtest",
        "path": ["TestMain", "Succeeds"],
        "lbrace": 140,
        "rbrace": 210,
    },
    {
        "name": "Fails",
        "type": "subtest",
        "path": ["TestMain"],
        "lbrace": 138,
        "rbrace": 189,
    }
]

Schema

const (
    TestType           Type = "test"
    SubtestType        Type = "subtest"
    DynamicSubtestType Type = "dynamicsubtest"
)

type Test struct {
    // Name of the test
    Name   string   `json:"name"`
    // Type of test
    Type   Type     `json:"type"`
    // Path to this test, including parent test names
    Path   []string `json:"path"`
    // Character position of the test opening brace / parenthesis
    LBrace int      `json:"lbrace"`
    // Character position of the test closing brace / parenthesis
    RBrace int      `json:"rbrace"`
}

About

CLI tool that outputs tests and subtests outline of a go test source file in JSON format.

Resources

Stars

Watchers

Forks

Releases

Used by

Contributors

Languages