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
Unit Testing Code Pattern #412
Comments
Given the age of this issue, and the volume of issues we have to work through, I've decided to close this alongside a number of other older issues. If you can still replicate the issue under the latest in-development version of MagicalRecord (3.0 at the time of writing), please feel free to re-open and one of @magicalpanda/team-magicalrecord will take another look. Thanks! |
I'm seeing this as well. It works for the first test, but after -cleanUp is run, the auto setup refuses to create the stack again (or at least the MOM, which leads to not seeing any entities).
|
Removing the -setDefaultModelFromClass line gives me "cannot setup persistent store with nil model!" later on. Replacing that line with the following works:
I suspect -cleanUp is nil-ing the model and the setup call isn't putting it back properly. |
http://www.cimgf.com/2012/05/15/unit-testing-with-core-data/
Above blog is described about unit testing with MagicalRecord.
It say the pattern of a common test code is as follows.
I think
[MagicalRecord cleanUp]
doesn't clear test data in InMemoryStore.If testB is executed after testA, testB is failed.
I expect Foo entities count is always 1 in testB method.
In common case, we want to clear all data in each test method execution.
I think more common pattern of testing code is like here.
What do you think about my opinion?
Please give me advice.
The text was updated successfully, but these errors were encountered: