go-sdk

module
v3.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2025 License: Apache-2.0

README

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

Directories

Path Synopsis
To activate, simply import this package for its side effects:
To activate, simply import this package for its side effects:

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL