Open eserte opened 4 years ago
Just realized that this issue tracker is for both Catmandu-RKD and Catmandu-Store-RKD. But both show the same failure.
This package contains an implementation of a remote API. This is a functional test that fails because it tries to assert the output based on external data, which is tenuous.
Instead of sending a query against the remote API and comparing the live output, this test should assert whether or not functionality works against a mock of the API.
i.e. use something like https://metacpan.org/pod/Test::MockModule
I am not a fan of mocking, because mocking may hide real problems. On the other hand, accessing real live interfaces which may change means that an author needs to be prepared to do test-only releases every now and then. Just my $0.02.
That's valuable feedback! Thanks!
Yes, interfaces may change their contract, and testing against that, instead of a mock, may help in catching these changes in a timely fashion. This pertains to modelling through URI's, data structures (naming of fields, entities, relationships,...), authentication,...
Then there's the data itself: values, data or information. Functional tests could test whether a value is present or absent if that directly ties into the API contract (i.e. the required presence of a field). But I don't think they should do hard assertions against the actual - changeable - information returned by the API.
So, my recommendation would be: use a regular expression to check whether the value returned by the API adheres to relevant constraints:
Even so, we have to be wary: we're testing the client implementation; not the API itself.
My smokers report the following failure:
Statistical analysis shows that there are no pass reports anymore with newer Catmandu versions (>= 1.2002):