# Packetbeat: Code Coverage for your Golang System Tests

**URL:** <https://discuss.elastic.co/t/packetbeat-code-coverage-for-your-golang-system-tests/104484>\
**Category:** Beats\
**Tags:** packetbeat\
**Created:** [October 19, 2017, 3:52am UTC](https://discuss.elastic.co/t/packetbeat-code-coverage-for-your-golang-system-tests/104484 "2017-10-19T03:52:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![sunanxiang](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sunanxiang/32/23175_2.png) [@sunanxiang](https://discuss.elastic.co/u/sunanxiang)\
**Post date:** [October 19, 2017, 3:52am UTC](https://discuss.elastic.co/t/packetbeat-code-coverage-for-your-golang-system-tests/104484/1 "2017-10-19T03:52:52Z")

</div>

**I followed this blog and want to do Code Coverage System test.But I can't find the param in the blog.**

```auto
$ ./packetbeat.test -h
Usage of ./packetbeat.test:
  -I string
          file
  -N Disable actual publishing for testing
    -O Read packets one at a time (press Enter)
  -c string
        Configuration file (default "/etc/beat/beat.yml")
  -cpuprofile string
        Write cpu profile to fil
  ...

```

**in my machine, the usage is different.**  
**-systemTest and -c param belongs to different file. -systemTest is the usage of packetbeat.test ,-c is the usage of packetbeat.**  
**the error is : flag provided but not defined: -c**  
**so**

```auto
packetbeat.test -systemTest -c config.yml -test.coverprofile coverage.cov

```

**can't be exec in my machine.**

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [October 23, 2017, 12:30pm UTC](https://discuss.elastic.co/t/packetbeat-code-coverage-for-your-golang-system-tests/104484/2 "2017-10-23T12:30:59Z")

</div>

Which branch are you using? In master we change a little how beats are run (introducing support for sub commands).

We normally run system tests via `make`. You can ask `make` to print the commands to be executed via `make -n`.

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [October 23, 2017, 12:36pm UTC](https://discuss.elastic.co/t/packetbeat-code-coverage-for-your-golang-system-tests/104484/3 "2017-10-23T12:36:03Z")

</div>

I tried Packetbeat from master and the command you specified still works despite several changes beats since that blog post.

Like you have shown with the help output, the `-c` flag is known to `packetbeat.test` so getting back `flag provided but not defined: -c` is odd.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [November 9, 2017, 4:03am UTC](https://discuss.elastic.co/t/packetbeat-code-coverage-for-your-golang-system-tests/104484/4 "2017-11-09T04:03:46Z")

</div>

This topic was automatically closed after 21 days. New replies are no longer allowed.
