Skip to content

Create a XCTestCase subclass to manage CoreDataStack mock implementation - #18578

Merged
mokagio merged 3 commits into
wordpress-mobile:trunkfrom
crazytonyli:create-xctestcase-subclass-for-core-data
May 17, 2022
Merged

Create a XCTestCase subclass to manage CoreDataStack mock implementation#18578
mokagio merged 3 commits into
wordpress-mobile:trunkfrom
crazytonyli:create-xctestcase-subclass-for-core-data

Conversation

@crazytonyli

Copy link
Copy Markdown
Contributor

It's suggested in #18527 (comment) to create a XCTestCase subclass to manage ContextManagerMock, which I think would be very useful in lots of test cases.

Changes

This PR added a CoreDataTestCase which creates a ContextManagerMock instance for its subclass to use. A few unit tests were modified to inherit from this new subclass, as a simple demonstration of how the mock implement can be used in subclasses.

After this PR is merged, I'll create a follow-up PR which changes rest of unit tests to use the new CoreDataTestCase.

Test Instructions

Make sure all tests pass.

Regression Notes

N/A. Only unit test target is affected.

PR submission checklist:

  • I have completed the Regression Notes.
  • I have considered adding unit tests for my changes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

I've selected a few existing test cases which use `ContextManagerMock`
differently, changed them to use `CoreDataTestCase` to see how this
new subclass works with different scenarios.

Rest of the test cases will be updated to use `CoreDataTestCase` after
this commit is reviewed.
@jkmassel jkmassel mentioned this pull request May 12, 2022
Conflicts:
	WordPress/WordPress.xcodeproj/project.pbxproj
@mokagio
mokagio enabled auto-merge May 17, 2022 02:17
@mokagio
mokagio merged commit e0464dd into wordpress-mobile:trunk May 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants