Testing
Testing ensures that behavior of your code is correct and expected. Good-written tests allow you to develop with confidence that your code will work and will not break your existing code.
IntelliJ IDEA includes several packages that you can use to run your tests. Also, you can apply a specific testing scope for the selected package.
Packages for testing
For testing purposes, IntelliJ IDEA includes the following packages:
- gotest
Use for running standard unit tests. For more information about
go test
, refer to Package testing.- gocheck
Use to have extended functionality of
go check
and running more complex tests. For more information aboutgo check
, refer to go check.- gobench
Use for running performance tests. For more information about
gobench
, refer to Package testing: Benchmarks.
Templates for Go tests work the same way as templates for Go applications (Go Build). But instead of selecting Go Build, you should select Go Test.
Run/debug configuration templates for tests
Navigate to
.In the Run/Debug Configurations dialog, click Add New Configuration Alt+Insert and select Go Test.
(Optional) Customize settings by modifying additional fields.
Click Apply.