-
Notifications
You must be signed in to change notification settings - Fork 123
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
New Comparison Strategy using JSONassert #159
Comments
Absolutely. Thank you very much for your contribution, go ahead with the required changes. Thanks. |
Awesome, I'll be in touch with a PR. |
Hey Alex, I've got my implementation ready and am trying to write some unit tests. I was basing them off of The error is
The exception is declared as expected like so: I tried removing that kind of Exception expectation and tried using the It almost seems like the Any thoughts? If those tests work for you, might it be something about your environment setup? Cheers, |
Currently I am on vacation. I will try next week. Thanks El 20 ago. 2016 6:58 p. m., "Sean Connolly" [email protected]
|
Hi Alex, Any update on this? I'd love to contribute this pull request if possible. Cheers, |
You can contribute for sure, now I can release a new version pretty fast. |
Great, good to hear. Can you comment on the unit tests? When I check out the master branch and run the unit tests, many fail with the error I mentioned above. Want to make sure I'm starting with everything working correctly before I start mucking around. Cheers, |
Test fixed, you can start working on this. |
Hi Alex, I still see a number of other failing tests. Are these failing on your side too? -Sean |
Can you list them? I execute some of them and they worked.
El dv., 10 de febr. 2017 a les 12:54, Sean Connolly (<
[email protected]>) va escriure:
… Hi Alex,
I still see a number of other failing tests. Are these failing on your
side too?
-Sean
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#159 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABcmYRiHVjNn8-24AV3wc13lk2Zjn1VIks5rbE_sgaJpZM4IyfmH>
.
|
Sure, 42 of the 62 tests in WhenExpectedDataShouldBeCompared.less_expected_collection_than_database_collection_should_fail:
WhenExpectedDataShouldBeCompared.expected_collection_item_has_less_attributes_than_database_collection_item_attribute_should_fail:
WhenManagedMongoDbRuleIsRegistered.mongo_server_should_throw_an_exception_if_mongo_location_is_not_found:
WhenMongoDbRuleIsRegistered.should_clean_previous_data_and_insert_new_dataset_with_clean_insert_strategy:
WhenMongoDbRuleIsRegistered.should_assert_if_expected_data_is_strict_equal:
I want to get all tests running & passing before I make any code changes so I know I don't break anything by adding this new feature. Cheers, |
I've written a new
MongoComparisonStrategy
based on the JSONassert project and really find it helps me debug my failing tests a lot quicker.Background
For background, the default comparison strategy builds a query using the expected data as an example. So, if everything matches then great, but if any of the expected JSON doesn't match the actual object, the query fails. The only feedback you get is that the expected JSON wasn't found. This makes it very difficult to debug what the actual JSON was and what needs to be corrected.
How it Works
This new
JsonComparisonStrategy
queries each document by only it's _id field, and then compares the expected JSON to the actual JSON. The feedback is much more useful, for example:This tells you that the record with _id
xyz/two
for the subdocument fieldauthorization.admins
was expected to be-rw
but was--w
.For comparison (har har) the default comparison strategy would report:
My Questions
Two questions.
org.skyscreamer.jsonassert
so want to get input first.-- An alternative would be another maven module. Seems overkill but may be a good place for add-ons long term?
MongoDbAssertion
has two top level functions public and the rest are private. I want to reuse a lot of these private functions, any objection to making them package-private instead?The text was updated successfully, but these errors were encountered: