Bug 33492 - ERM - We need EBSCO Cypress tests
Summary: ERM - We need EBSCO Cypress tests
Status: In Discussion
Alias: None
Product: Koha
Classification: Unclassified
Component: ERM (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Jonathan Druart
QA Contact:
URL:
Keywords:
Depends on: 32030
Blocks:
  Show dependency treegraph
 
Reported: 2023-04-11 17:24 UTC by Pedro Amorim
Modified: 2023-08-07 01:20 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro Amorim 2023-04-11 17:24:09 UTC
For discussion.
Today we became aware of many new bugs in the EBSCO part of ERM that have apparently found their way over the last few weeks/months(?).
We don't have cypress tests for this as it requires EBSCO credentials but is there a way around this?
Comment 1 Martin Renvoize 2023-04-12 06:23:55 UTC
I wonder if we could optionally run tests if an environment variable, containing an API key, is set?

That way ebsco partners with a valid test key could at least run tests.  It's not perfect as it wouldn't be easy to run them consistently in the existing CI framework as I imagine sharing such a key with community would likely be against some terms and conditions somewhere.

The only other thing I can think of is to attempt to kick the ebsco APIs, but that negates the integration test where aiming for in the first place. We want to easily detect breakages caused by us or changes at the ebsco end.
Comment 2 David Cook 2023-04-12 06:40:06 UTC
(In reply to Martin Renvoize from comment #1)
> I wonder if we could optionally run tests if an environment variable,
> containing an API key, is set?

This would be the most realistic thorough option I think.
 
> That way ebsco partners with a valid test key could at least run tests. 
> It's not perfect as it wouldn't be easy to run them consistently in the
> existing CI framework as I imagine sharing such a key with community would
> likely be against some terms and conditions somewhere.

One could ask EBSCO for testing credentials but I think they tend to only do that for short-term scenarios. 

> The only other thing I can think of is to attempt to kick the ebsco APIs,
> but that negates the integration test where aiming for in the first place.
> We want to easily detect breakages caused by us or changes at the ebsco end.

Another option could be mocking the API. It wouldn't help detect breakages on the EBSCO end, but it would cover breakages caused by us.

I have a Ruby project where I provide a HTTP API which makes a lot of backend calls to a variety of other APIs from different vendors. In my unit tests, I override important Net::HTTP methods so that they return what I want. 

It looks like Cypress has some options for stubbing responses: https://docs.cypress.io/guides/guides/network-requests

--

With my Ruby project, I mock the responses for my unit tests, and then when I want to run my integration tests, I use real credentials for real test systems, and run tests on those real test systems. 

Those test systems are all in a client's own ecosystem though, so it's very easy to organize. It's not like interacting with an external third-party system.

I reckon robust integration tests for the EBSCO API aren't going to be doable. Someone with EBSCO API credentials could test but probably not doable from a generic community perspective...
Comment 3 Pedro Amorim 2023-04-12 10:53:16 UTC
Ignoring the credentials for a bit, I think mocking the API would at least be better than not having any tests.
Some of the recent bugs we discovered were caused by changes in the way we render tables, or the way we handle loading in the UI. These would've been caught by tests even if they were simply mocking the API.
Comment 4 Tomás Cohen Arazi 2023-07-25 17:10:19 UTC
We really need those tests
Comment 5 Victor Grousset/tuxayo 2023-08-07 01:20:21 UTC
(In reply to Martin Renvoize from comment #1)
> I wonder if we could optionally run tests if an environment variable,
> containing an API key, is set?
> 
> That way ebsco partners with a valid test key could at least run tests. 
> It's not perfect as it wouldn't be easy to run them consistently in the
> existing CI framework as I imagine sharing such a key with community would
> likely be against some terms and conditions somewhere.

Is there any Koha support provider that has an EBSCO key of their own? Or only their libraries have? So they could put it in a CI an existing runner in the case they host one or if they can provide a new CI runner that would run cypress tests which would include the EBSCO ones.