[Koha] Integration testing (WebDriver), Permission system rewrite and getting to Koha REST API!
Kivilahti Olli-Antti
olli-antti.kivilahti at jns.fi
Fri Jul 17 21:44:58 NZST 2015
Hi there!
I have been working to get the new REST API working with Koha.
Big issues are authenticating the REST API and doing browser-based automated testing.
However there are some pretty fundamental issues in Koha that make working with those topics very difficult.
PERMISSIONS:
First of all the permissions system is very hard to manipulate outside of the user space. There is no internal Koha API for granting/revoking specific permissions.
This is a huge issue with integration testing where we need to easily set up test context with proper permissions.
Also there is no way currently to conveniently operate permissions using a REST API. So we would need to rewrite the permission back-end anyway.
Bug 14540<http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540> - Move member-flags.pl to PermissionsManager to better manage permissions for testing.
deals with this issue and rewrites the internal permission mechanism, while preserving the end-user experience as it was.
This enables us as testers to easily setUp and tearDown permissions for automated browser testing sessions.
I recommend you take a look, as the rewrite is well tested and covered with WebDriver-tests.
INTEGRATION TESTING:
I have implemented a integration testing framework using the PageObject-pattern to create clear and robust browser tests. These browser tests don't need any additional servers to install, but rely on system packages (apt-get install phantomjs) to make the integration tests.
These tests instantiate a real browser with javascript execution capability, and make real HTTP requests to the configured host and port, simulating real user interactions as accurately as possible. There are also two debugging interfaces for the automated test agent to make it more easy to script the user session.
Take a look at:
Bug 14495<http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14495> - WebDriver/WebTester Factory for easy generation of Web testing UserAgents.
Bug 14536<http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14536> - PageObject-pattern base implementation
DEALING WITH EXCEPTIONS:
In Koha we currently don't have any established mechanism of propagating errors from business/database-layer to the end-user, and conveniently catching them and presenting them. Currently we return $error-variables from subroutines, which makes programming more challenging, and tedious, especially if we need to propagate the same errors through multipe subroutine calls to the end-user.
I have implemented to Koha an Exception-system very similar from other programming languages.
Quite frankly this is an industry standard nowadays and a best-practice for dealing with things-going-wrong. It helps a lot in programming defensively. Take a look at:
Bug 13995<http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13995> - Proper Exception handling
I am 100% convinced that these improvements will push Koha testing and development to the next level.
The best overview of the new features can be seen from the test scripts in Bug 14540<http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540>
Looking forward to your sign offs!
--
Olli-Antti Kivilahti
Järjestelmäkeittäjä
vaarakirjastot.fi
+358 50 449 7763
--Powered by Kubuntu Linux!
More information about the Koha
mailing list