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.
To integrate the coverage agent into your Go application, follow these two steps:
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"
)
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/[email protected]#ClearCounters
go build -cover -covermode=atomic -o your-app .
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