You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The test function TestPlannerQuery in planner_test.go verifies only if the resolved query has the expected number of bindings and if the result obtained after querying the graph has the expected number of rows. This can open space for mistakes in the future.
To illustrate, take the query below:
SELECT ?time
FROM ?test
WHERE {
?s ?p ?o .
OPTIONAL { ?s ?p AT ?time ?o }
};
Imagine that we expect its result to have 3 rows, on which the bindings for ?time should have the <NULL> value (like in the case the ?p bindings were all immutable predicates in our graph ?test). If a change is made in the code later on and a side effect is that the result of this query still has 3 rows but now with the bindings for ?time having non <NULL> values, the test would not detect the problem and would still pass as the number of returned rows is the same expected 3 as before, which is dangerous as the code is not having the right behavior anymore.
This is just one scenario to illustrate this potential problem. Another one could involve changes made in the ?test graph as well.
Then, a deeper test should be done here in TestPlannerQuery to assure that the values of the rows are indeed the ones we expect, and not only the number of them.
In addition to that, it would be nice to also be able to personalize, for each query tested there, which graph it is querying, instead of using the same graph for all of them. This way, if we develop something in the future that requires new triples in the ?test graph for us to be able to properly test it there in planner_test.go, we could just create another graph and use it to write those tests instead of adding new triples to the shared ?test graph and having to change all other tests impacted by these additions (which is error-prone).
The text was updated successfully, but these errors were encountered:
The test function
TestPlannerQuery
inplanner_test.go
verifies only if the resolved query has the expected number of bindings and if the result obtained after querying the graph has the expected number of rows. This can open space for mistakes in the future.To illustrate, take the query below:
Imagine that we expect its result to have 3 rows, on which the bindings for
?time
should have the<NULL>
value (like in the case the?p
bindings were all immutable predicates in our graph?test
). If a change is made in the code later on and a side effect is that the result of this query still has 3 rows but now with the bindings for?time
having non<NULL>
values, the test would not detect the problem and would still pass as the number of returned rows is the same expected 3 as before, which is dangerous as the code is not having the right behavior anymore.This is just one scenario to illustrate this potential problem. Another one could involve changes made in the
?test
graph as well.Then, a deeper test should be done here in
TestPlannerQuery
to assure that the values of the rows are indeed the ones we expect, and not only the number of them.In addition to that, it would be nice to also be able to personalize, for each query tested there, which graph it is querying, instead of using the same graph for all of them. This way, if we develop something in the future that requires new triples in the
?test
graph for us to be able to properly test it there inplanner_test.go
, we could just create another graph and use it to write those tests instead of adding new triples to the shared?test
graph and having to change all other tests impacted by these additions (which is error-prone).The text was updated successfully, but these errors were encountered: