Merge pull request #15 from CarlJi/0522
add example into README document
This commit is contained in:
commit
a13481ecd1
50
README.md
50
README.md
@ -6,10 +6,56 @@
|
|||||||
[](https://codecov.io/gh/qiniu/goc)
|
[](https://codecov.io/gh/qiniu/goc)
|
||||||
[](https://godoc.org/github.com/qiniu/goc)
|
[](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:**
|
> **Note:**
|
||||||
>
|
>
|
||||||
> This readme and related documentation are Work in Progress.
|
> This readme and related documentation are Work in Progress.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
```go get github.com/qiniu/goc```
|
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)
|
1
go.sum
1
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 h1:DDNipYy6RkIkjMwy+AWzgKiNTyj2RUI9yEMeETEpVyc=
|
||||||
github.com/otiai10/copy v1.0.2/go.mod h1:c7RpqBkwMom4bYTSkLSym4VSJz/XtncWRAj/J4PEIMY=
|
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/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/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/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k=
|
||||||
github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo=
|
github.com/pelletier/go-buffruneio v0.2.0/go.mod h1:JkE26KsDizTr40EUHkXVtNPvgGtbSNq5BcowyYOWdKo=
|
||||||
|
Loading…
Reference in New Issue
Block a user