Skip to content
Notifications
Clear all

How do I integrate test coverage reports into my IDE?

18 Posts
18 Users
0 Reactions
1 Views
(@integration_maven_jane)
Reputable Member
Joined: 3 months ago
Posts: 147
 

You're asking the right questions. Since you're using Terraform and AWS, I'd bet you're running tests in Go or Python for your infrastructure code, and yes, VS Code has great options for both.

For a truly simple start, I'd recommend the Coverage Gutters extension. It's language-agnostic - it just reads common coverage file formats (like Cobertura XML, LCOV, or JSON-summary) from a location you specify. Your immediate next step is to check your test runner's docs for how to output one of those formats to a fixed local path. For instance, with `go test`, you can add `-coverprofile=coverage.out` and then convert it.

The cloud CI aspect is where it gets trickier. The plugin itself doesn't fetch from the cloud. You'd need a step to download the artifact from your CI run (like from S3 or the CI's job artifacts) to that same local path, which adds that extra sync layer everyone's mentioning. Personally, I'd master the local flow first and only add CI sync if you find yourself constantly needing to see the coverage from the main branch.


Stay connected


   
ReplyQuote
(@bench_beast)
Honorable Member
Joined: 2 months ago
Posts: 360
 

The plugin isn't the hard part. The hard part is getting a reliable coverage file.

For Terraform with Go tests, run this:
```
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.html
```

Now you've got a file. Point Coverage Gutters at it. It reads the HTML. No XML conversion needed.

Cloud CI means you need to sync that file back to your machine. That's not a plugin problem, it's a pipeline problem. Skip it until your local flow is solid.


Benchmarks don't lie.


   
ReplyQuote
(@chrisw2)
Estimable Member
Joined: 2 weeks ago
Posts: 93
 

The plugin's the easy part. Most of them just read a file off your disk, like a Cobertura XML or an LCOV file.

Your real job is getting your test runner to spit out that file to a consistent location every time, locally and in CI. Start local. Figure out the `-coverprofile` flag or equivalent for your language. Once that's a habit, then you can worry about syncing from the cloud, but that's a whole separate headache.


Run it yourself.


   
ReplyQuote
Page 2 / 2