KelvinS
KelvinS

Reputation: 3071

Should I measure code coverage for GUI Tests?

I have a small doubt about code coverage.

The tests of my application are divided into GUI Tests (simulates a user using the application) and Unit Tests (test each class/function independently).

Recently I started to use GCOV and LCOV tools to measure the code coverage of my code and figured out that the Unit Tests are covering about 55% of the code and the Unit Tests + GUI Tests are covering about 90% of the code.

Is it correct/common to measure the code coverage of the GUI Tests or should I only measure it for the Unit Tests?

Note 1: the tests are related to a desktop Qt application.

Note 2: keep in mind I'm a beginner in automated software testing.

Upvotes: 2

Views: 2406

Answers (2)

Mandar Kale
Mandar Kale

Reputation: 337

I answer is Yes. Provided

  • Unit test coverage and UI test coverage actually adds up. Meaning if code has 100 lines, you actually cover 95 lines, 55 through unit test and 35 by UI test.

  • You actually execute both the test category each time before
    releasing.

Upvotes: 2

dm03514
dm03514

Reputation: 55972

IMO if in total all your tests are exercising 90% of your code (lines?) I think that's an important insight to have. Most languages/frameworks have some sort of library to merge coverage reports, so that front should be pretty easy too.

Some things against the full report could might maybe possibly be:

  • if coverage profiling is too resource intensive, it may impact your GUI Test performance? and if your tests aren't developed using defensive waits, they may have flaky test failures (not sure how QT GUI tests work, only thinking of selenium)
  • if coverage is not actionable and no one looks it maybe just be an unnecessary thing to calculate?

Upvotes: 2

Related Questions