Announcing some small progress with integration tests of Lyo

Hello everyone,

I was contemplating this for a very long time but never figured out the whole picture until now. Today I wrote some code that uses Maven Failsafe + Maven Jetty plugin + RestAssured to run some rudimentary integration tests on OSLC RefImpl 2020 against Lyo 4.0.0-SNAPSHOT. The first step added base RestAssured support and tested some XML values returned by the /rootservices endpoint

This commit adds:

  • An ability to start Jetty in the background during the Maven build, just like you’d do it via jetty:run. I think this is the most crucial part as before I was playing with an embedded Grizzly servlet container and Jersey test framework and there were just too many things to configure to make it even close to the Jetty env.
  • A new group of integration tests that would not run when you run mvn package but only on mvn verify. I set OSLC RefImpl to run those integration tests on PR and every day in the morning (to re-test any new Lyo changes on SNAPSHOT).
  • A test that uses RestAssured framework to test the Service Provider Catalog and RootServices endpoint. Note the built-in XML support.

An now, to the most interesting part:

This test adds full RDF parsing and checking of the values. We can refactor it later to:

I don’t have time to cover all OSLC servers with tests myself but I think this gives us a nice framework to cut down on manual testing. I hope you find it useful to add tests around things you care about, such as OAuth or Lyo Store query responses.

I will be very glad to help solve issues with integration tests using RestAssured if you will find resources to write some integration tests for your OSLC Servers written using Lyo. This approach should also work with Lyo 2.x. I know it’s not as nice as having full unit test coverage of Lyo itself (I recently had some good crash course on Mockito, which should help us with the static method hell in Lyo I was reluctant to touch, but that does not change the fact I am still reluctant to touch that code :slight_smile: ) but it seems to me like the “cheapest” way to catch regressions (and unintended compat breakage) in Lyo so that more people can upgrade to Lyo 4+ soon. It should be beneficial to you as well because while you will be helping us, you will actually be investing into integration testing of your own OSLC servers, which should help you convince your managers.


Cheers,
Andrew

Here is the Github Actions CI config you can use for your OSLC server code hosted on Github: https://github.com/oslc-op/refimpl/blob/master/.github/workflows/maven.yml