From a2fe20da97cd1f5e7239815931380cafff5567c5 Mon Sep 17 00:00:00 2001 From: jichangjun Date: Fri, 22 May 2020 19:08:38 +0800 Subject: [PATCH] add example into README document --- README.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++-- go.sum | 1 + 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c8949f1..29fdedd 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,56 @@ [![codecov](https://codecov.io/gh/qiniu/goc/branch/master/graph/badge.svg)](https://codecov.io/gh/qiniu/goc) [![GoDoc](https://godoc.org/github.com/qiniu/goc?status.svg)](https://godoc.org/github.com/qiniu/goc) -A Comprehensive Coverage Testing System for The Go Programming Language +goc is a comprehensive coverage testing system for The Go Programming Language, especially for some complex scanrios,like system testing code coverage collecting and +accurate testing. + > **Note:** > > This readme and related documentation are Work in Progress. ## Installation -```go get github.com/qiniu/goc``` \ No newline at end of file +To install goc tool, you need to install Go first (**version 1.11+ is required**), then: + +```go get -u github.com/qiniu/goc``` + +## Examples +You can use goc tool in many scenarios. + +### Code Coverage Collection for your Golang System Tests +Goc can collect code coverages at run time 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 [simeple-go-server](https://github.com/CarlJi/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 + ... + ``` + Enjoy, Have Fun! + +## RoadMap +- [x] Support code coverage collection for system testing. +- [ ] Support develop mode towards accurate testing. +- [ ] Support code coverage diff based on Pull Requst. +- [ ] Support code coverage counters clear for the services under test in runtime. +- [ ] 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. + +## License +Goc is released under the Apache 2.0 license. See [LICENSE.txt](https://github.com/qiniu/goc/blob/master/LICENSE.txt) \ No newline at end of file diff --git a/go.sum b/go.sum index 308a21e..863b9f0 100644 --- a/go.sum +++ b/go.sum @@ -548,6 +548,7 @@ github.com/openzipkin/zipkin-go v0.2.0/go.mod h1:NaW6tEwdmWMaCDZzg8sh+IBNOxHMPnh github.com/otiai10/copy v1.0.2 h1:DDNipYy6RkIkjMwy+AWzgKiNTyj2RUI9yEMeETEpVyc= github.com/otiai10/copy v1.0.2/go.mod h1:c7RpqBkwMom4bYTSkLSym4VSJz/XtncWRAj/J4PEIMY= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= +github.com/otiai10/mint v1.3.0 h1:Ady6MKVezQwHBkGzLFbrsywyp09Ah7rkmfjV3Bcr5uc= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo=