Go to file
qiniu-bot 89dd3585d1
Merge pull request #81 from tongjingran/diffReset
Add test case for goc diff
2020-07-30 19:57:45 +08:00
.github/workflows add golint action 2020-07-26 17:38:38 +08:00
cmd mock qiniu, gihub, artifacts client 2020-07-27 10:40:45 +08:00
docs/images README.md: Add demo gif of goc run 2020-06-19 13:17:15 +08:00
pkg add comments for exported method and fix fmt 2020-07-30 17:00:27 +08:00
tests add unittes case & add e2e sample 2020-07-23 15:43:16 +08:00
.gitignore add unittes case & add e2e sample 2020-07-23 15:43:16 +08:00
ci-build.sh goc version: dynamic inject the version value when publishing 2020-07-03 19:36:49 +08:00
codecov.yaml add codecov.yaml 2020-07-11 08:43:27 +08:00
go.mod change server name register to server and process duplicate flag values 2020-07-16 12:27:01 +08:00
go.sum add unittes case & add e2e sample 2020-07-23 15:43:16 +08:00
goc.go update copyright with qiniu.com url 2020-05-26 00:21:54 +08:00
LICENSE update copyright with qiniu.com url 2020-05-26 00:21:54 +08:00
Makefile add version test 2020-07-17 13:01:36 +08:00
OWNERS init the directory structure and create OWNERS file (#2) 2020-05-09 15:34:47 +08:00
README.md README: clarify the go version for goc developing 2020-07-30 17:48:01 +08:00

goc

Go Report Card Build Release codecov GoDoc

goc is a comprehensive coverage testing system for The Go Programming Language, especially for some complex scenarioslike system testing code coverage collection and accurate testing.

Enjoy, Have Fun! Demo

Installation

Download the latest version from Github Releases page.

For developing, you need install Go first (version 1.13+ is required).

Examples

You can use goc tool in many scenarios.

Code Coverage Collection for your Golang System Tests

Goc can collect code coverages at runtime for your long-run golang applications. To do that, normally just need three steps:

  1. use goc server to start a service registry center:
    ➜  simple-go-server git:(master) ✗ goc server
    
  2. use goc build to build the target service, and run the generated binary. Here let's take the simple-go-server project as example:
    ➜  simple-go-server git:(master) ✗ goc build .
    ... // omit logs
    ➜  simple-go-server git:(master) ✗ ./simple-go-server  
    
  3. use goc profile to get the code coverage profile of the started simple server above:
    ➜  simple-go-server git:(master) ✗ goc profile
    mode: atomic
    enricofoltran/simple-go-server/main.go:30.13,48.33 13 1
    enricofoltran/simple-go-server/main.go:48.33,50.3 1 0
    enricofoltran/simple-go-server/main.go:52.2,65.12 5 1
    enricofoltran/simple-go-server/main.go:65.12,74.46 7 1
    enricofoltran/simple-go-server/main.go:74.46,76.4 1 0
    ...   
    

Tips

  1. To understand the execution details of goc tool, you can use the --debug flag. Also we appreciate if you can provide such logs when submitting a bug to us.

  2. By default, the covered service will listen a random port in order to communicate with the goc server. this may not be suitable in docker or kubernetes environment since the port must be exposed explicitly in order to be accessible by others in such environment. For this kind of scenario, you can use --agentport flag to specific a fixed port when calling goc build or goc install.

  3. To use a remote goc server, you can use --center flag to compile the target service with goc build or goc install command.

RoadMap

  • Support code coverage collection for system testing.
  • Support code coverage counters clear for the services under test at runtime.
  • Support develop mode towards accurate testing.
  • Support code coverage diff based on Pull Request.
  • Optimize the performance costed by code coverage counters.

Contributing

We welcome all kinds of contribution, including bug reports, feature requests, documentation improvements, UI refinements, etc.

Thanks to all contributors!!

License

Goc is released under the Apache 2.0 license. See LICENSE.txt