-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposed refactoring of AppContext, MessagingContext, and its subclasses after PW test migration. #33497
Closed
feasel0
wants to merge
2
commits into
project-chip:master
from
feasel0:feature/unittest--doc--example
Closed
Proposed refactoring of AppContext, MessagingContext, and its subclasses after PW test migration. #33497
feasel0
wants to merge
2
commits into
project-chip:master
from
feasel0:feature/unittest--doc--example
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
… reflect PW migration.
PR #33497: Size comparison from 7b2f729 to f3bf109 Full report (75 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, linux, mbed, nxp, psoc6, qpg, stm32, telink)
|
@feasel0 why this PR is still a draft? |
PR #33497: Size comparison from eeac38f to 1980820 Full report (77 builds for bl602, bl702, bl702l, cc13x4_26x4, cc32xx, cyw30739, linux, mbed, nxp, psoc6, qpg, stm32, telink, tizen)
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This draft has been replaced by PR #34036
In order to update the unit testing documentation (See PR #33492) I needed to make some assumptions about what
AppContext
,LoopbackMessagingContext
, andUDPMessagingContext
will look like after the transition to PW is complete. This draft is an example of how those classes might be refactored, as well as how they might be used in a test.I assume we want
LoopbackMessagingContext
to inherit from::testing::Test
(and thenAppContext
inherits fromLoopbackMessagingContext
). So people writing unit tests will have their test contexts inherit fromAppContext
if they need the loopback messaging, or they will inherit directly from::testing::Test
if they don't need the loopback messaging but do need other fixtures.I propose several changes to
AppTestContext.h/cpp
andMessagingContext.h/cpp
.AppTestContext
's SetUp and TearDown functions are made virtual.LoopbackMessagingContext
andUDPMessagingContext
inherit from::testing::Test
.VerifyOrDieWithMsg
in the SetUp/SetUpTestSuite functions are replaced by ASSERT_EQ.sLoopbackTransportManager
andsUDPTransportManager
are made into pointers. This is done to reduce the static footprint.Assuming the above is correct and what we want, a number of tests in
src/app/tests
,src/controller/tests
, and other places can be updated so that their test context inherits fromAppContext
instead of defining a member variable that holds a pointer to an AppContext instance that is created dynamically.As an example of how these tests might look after refactoring, I have updated
src/controller/tests/TestEventCaching.cpp
andsrc/controller/tests/TestWriteChunking.cpp
so that the test context inherits fromAppContext
.