When executing a specified function of go test, the report: testing: warning: no tests to run
For example go test -v -run Mytest
The test file name must be this _test suffix
xxxx_test.go
If it is not designated to run by correspondence, then the test function must start with Test
For example, the following file can
package tools import ( " fmt " " testing " ) func TestMytest(t * testing.T) { Mytest() } func Mytest() { m: = make(map[ string ] string ) m[ " a " ] = " b " m2: = make(map[ string ] interface {}) m2[ " a " ] = " b " test(m2) a: = " aaa " test2(a) } func test(t map[ string ] interface {}) { fmt.Printf( " %T " , t) } func test2(t interface {}) { fmt.Printf( " %T " , t) }
There are two ways of execution
go test -v test_test.go
go test -v -run Mytest
Read More:
- [Solved] Error running ‘go build myfir_go_project‘: Cannot run program
- [Solved] SHELL Run Error: “-BASH: ./TEST.SH: /BIN/BASH^M: BAD INTERPRETER: NO SUCH FILE OR DIRECTORY”
- Docker run Error: container_linux.go:235: starting container process caused “process_linux.go:258: appl
- Go declares that the local variable does not use command line arguments. Main. Go: 4:6: a declared but not used
- When using postman assertion, the global variables set in the tests of the pit will take effect only after the interface is executed
- [Solved] .\main.go:3:6: missing function body .\main.go:4:1: syntax error: unexpected semicolon or newline be
- How to Solve Docker Run Error: standard_init_linux.go:219: exec user process caused: exec format error
- Docker Open Error: Warning: docker.service changed on disk. Run ‘systemctl daemon-reload‘ to reload unit
- [Solved] Golang Error: main.go:5:2: package go_code/chapter10/factory/model is not in GOROOT
- [Solved] There are test failures. Please refer to D:\Java_study\springboot\springboot-sugon-3\target\surefire-reports for the individual test results.
- Docker Create tomcat Error standard_init_linux.go:211: exec user process caused “no such file or directory”
- JMeter JDBC Error: No pool found named: ‘test‘ [How to Solve]
- Implement base64_decode in GO language to solve the problem of illegal characters
- [Solved] Junit.test use error: log4j:WARN No appenders could be found for logger
- [Solved] Linux Start jar Error: nohup: failed to run command ‘java‘: No such file or directory
- ArchLinux starts error after modifying MariaDB database path Can’t create test file /xxxxx/xxxxx-test
- Error while trying to run project:unable to start debugging.the debugger is not properly installed. run setup to install or repa
- How to Solve golang test Error: # command-line-arguments [command-line-arguments.test]
- GO Exception Runnerw.exe: CreateProcess failed with error 21
- Creating test database for alias ‘postgres’… Got an error creating the test database: permission