How to run test cases in a specified file?

前端 未结 7 1646
孤独总比滥情好
孤独总比滥情好 2020-12-04 05:30

My package test cases are scattered across multiple files, if I run go test it runs all test cases in the package.

It is unnecessar

7条回答
  •  猫巷女王i
    2020-12-04 06:20

    go test -v -timeout 30s  -run ^(TestFuncRegEx)
    
    • The TestFunc must be inside a go test file in that package
    • We can provide a regular expression to match a set of test cases or just the exact test case function to run a single test case. For instance -run TestCaseFunc

提交回复
热议问题