Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

keploy/go-sdk

Keploy Go Coverage Agent

This package enables native Go coverage reporting for tests generated by Keploy enterprise. It works by listening for commands from the Keploy binary to start and stop coverage collection for each test case.

How to Use

To integrate the coverage agent into your Go application, follow these two steps:

1. Activate the Agent

Add a blank import for the package in your application's main entry point (e.g., in your main.go file). This import's side effects will automatically initialize and run the coverage agent in the background.

import (
	// ... other imports
	_ "github.com/keploy/go-sdk/v3/keploy"
)

2. Build with Coverage Flags

Compile your application using the -cover and -covermode=atomic flags. These are required for the agent to access and clear coverage data for each test run according to https://pkg.go.dev/runtime/coverage@go1.25rc2#ClearCounters

go build -cover -covermode=atomic -o your-app .

3. Run tests with Keploy enterprise version

sudo -E keploy-enterprise test -c "./your-app" --dedup

Now you will see dedupData.yaml getting created.

Run sudo -E keploy-enterprise dedup to get the tests which are duplicate in duplicates.yaml file

In order to remove the duplicate tests, run the following command:

sudo -E keploy-enterprise dedup --rm

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /