Skip to content

UI Tests Code Coverage #2703

@f-delahaye

Description

@f-delahaye

Any interest to have (basic) support for code coverage of UI Tests in Karate?

Unlike https://stackoverflow.com/questions/69297222/is-it-possible-to-get-code-coverage-with-karate-tests-for-java-code, this issue is about coverage of the Javascript code run by UI Tests.

AFAIK, nyc/istanbul is the standard tool for JS code coverage (what JaCoCo is for Java).

What Karate could do is to export the coverage collected by istanbul in files
What it probably can't do is:

  • instrument the code
  • and generate the report from the files

The former could be done by using one of the istanbul plugins (e.g. babel-istanbul-plugin, or vite-istanbul-plugin) or with the nyc CLI prior to the code being deployed.
The latter can be done with the nyc CLI

So, most of the work would have to be done outside of Karate - unless someone has an idea.

That said, I'm happy to propose a PR for the part that can be implemented in Karate if it can add value to the project.
I was thinking maybe a RuntimeHook could do the trick, with maybe a few parameters to enable/configure it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions