eclipse-score / eclipse-score/communication

Change EXPECT_CALLS to ON_CALLS in tests where expectations are not being tested

Open
#90 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
62
Forks
97
Avg merge
1d 1h
Merged PRs (30d)
72

Description

### What

We have a lot of places in our tests where we use EXPECT_CALL and strict_mocks for code that is not being actively tested in a specific test case. We should instead use ON_CALLS for these calls (e.g. in test fixtures) and explicitly add the EXPECT_CALLS within each unit test for the calls that specific test is testing.

### How

Tests should follow the given-expected-when-then pattern which is an adaptation of the given-when-then pattern for GTest. EXPECT_CALLS should only be placed in the sections "expected". We do explicitly not want EXPECT_CALLS in any other section.
Go over all our tests and fix this.

Search for `StrictMock` in our codebase and judge whether a StrictMock is really necessary.
StrictMocks shall only be used if it must be verified that no other calls than the ones with expectations set are done. Consider that you can also put a `EXPECT_CALL(...).Times(0)` if this is only required for specific APIs.

Note: Not all tests apply the above pattern. Please judge whether you can easily add this pattern.

### Estimates for realization

- Effort large (needs further breakdown)
- No impact on users expected

### Category

- [ ] Affects Detailed Design

### Requirements / Architecture

- [x] Requirements / Architecture are not affected by this change?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.