Java tests: ease comparison of project grid with expected state #6372
Labels
tests
Improving test coverage and speed
Type: Feature Request
Identifies requests for new features or enhancements. These involve proposing new improvements.
At the moment, many of our Java tests follow a pattern like this:
OpenRefine/main/tests/server/src/com/google/refine/operations/cell/KeyValueColumnizeTests.java
Lines 215 to 227 in 98d01b5
This is cumbersome, as it is very verbose and does not let the reader quickly grasp the shape of the expected result.
Proposed solution
Specify the expected state of a project after some operation by creating another project, in the expected state.
Introduce a test utility method to assert that two projects have equal contents.
Update the tests so that they go through such methods.
Alternatives considered
We could also make an assertion on an exported version of the project (such as CSV), but that would not be very readable and would introduce a dependency on an exporter which has nothing to do with the code being tested.
Additional context
Follow-up to #6371.
This will also help abstract away the way cell values are stored and accessed in a project, reducing the number of changes we need to make on the test suite for the new architecture developed in the
4.0
branch, as proposed here:https://forum.openrefine.org/t/reproducibility-project-november-2023-report/1100/5
The text was updated successfully, but these errors were encountered: