Hello. When anyone has time and can review the PHPUnit testing code it’s
available at:
Commit (deec1d6eddca7f5f9e8543cdf45489edd9badadf) on this branch is to fix
the PHP Unit testing framework. It includes fixes for phpunit.xml and code
corrections for tests (to get this to actually work). I have turned on
Code Coverage so it’s easier to tell what’s being tested.
Comments, improvements, suggestions welcome. I’ll keep working on
expanding the tests over the next several weeks.
Brady - Don’t have my laptop with me this weekend (working in Eastern
Colorado covering a hospital here …) but I think I just installed the
‘phpunit’ package for ubuntu. For automated tests on a daily build we are
venturing into the Continuous Integration realm which there are several
tools for but I haven’t used any of them in a long time. From a quick
search it would look like PHP Under Control (running with Cruise Control -
which I have used) and Jenkins-PHP are the two biggies. I can look into
them if you think we should set them up for the daily demos.
I have several other additions to check in on to the branch before a merge
to master. I have been picking out certain classes/files and then writing
tests to cover all the code in the file - using the code coverage portion
of PHP Unit to identify those methods/lines not tested.
One of the hardest parts of testing OpenEMR is that lots of the code is
tightly coupled with the DB. There’s little to no way for me to insert a
Mock Object to isolate a procedure b/c it’s calling on ADODB directly.
This is a much longer discussion than I will get into in this email but it
kinda directs towards are we thinking of becoming more OO (object oriented)
in version 5 with some separation of the database access layer (since we
have to migrate away from mysql to mysqli or PDO) or where are things
headed? Happy to lend a hand refactoring/testing classes as time permits
but wasn’t sure where we are headed.
In your view which part of OpenEMR should get testing? Where are you
seeing the most problems? I can focus there if people would like.
cheers
ian
p.s. I am transitioning from my current job here in Colorado to a different
position in California in late May. I might fall off of email for the
first part of May due to the move with my wife, 2 year old and dog.
Regarding database, I am guessing the project may be modifying the library/sql.inc functions to use Zend database model(via PDO) rather than adodb in the future in order to solve the mysql php deprecation issue (note there is a big Zend project ongoing to bring in a large amount of MU2 items: https://github.com/zhhealthcare/openemr/commits/ModuleInstaller-V14)
Can’t think of any specific things to focus on. Bugs are generally not predictable, so good to just build functions systematically. Would be nice to get installer stuff tested since critical, but can get to that later; note the online demos test installation stuff every day, which makes testing that less critical.
Good luck on the move and don’t go dark for too long
Brady - Thanks for the links to the demo farm. Will read the README file
and see if we can hook in a regular run of the unit tests. Ubuntu probably
has packages built for the Jenkins or can easily be integrated. I’ll check
on the version we are using in the Demo farm (most likely the 12.04 LTS).
The Zend DB model would be a great place to start.
More information on the Jenkins stuff and/or more tests that I have added
to the PHPUnit_Testing_Fixes branch as I add them.
It wouldn’t be very tough to get automated testing of daily build done,
since could just build the option into the demo farm, which is based on
ubuntu. I’d just place another option in:
Regarding database, I am guessing the project may be modifying the
library/sql.inc functions to use Zend database model(via PDO) rather than
adodb in the future in order to solve the mysql php deprecation issue (note
there is a big Zend project ongoing to bring in a large amount of MU2
items: zhhealthcare/openemr · GitHub
)
Can’t think of any specific things to focus on. Bugs are generally not
predictable, so good to just build functions systematically. Would be nice
to get installer stuff tested since critical, but can get to that later;
note the online demos test installation stuff every day, which makes
testing that less critical.
Good luck on the move and don’t go dark for too long
Brady - Thanks. I’ll get a version of Ubuntu 12.04 then and clean default
install so that I can figure out all the dependencies for the Jenkins
stuff. There’s a bunch of stuff that Jenkins needs (plugins, etc) and then
PHAR’s for the PHP mess detector, complexity analysis, etc.
Interestingly enough with setting up Jenkins for PHP it relies on using
Apache Ant/Java to couple the two. I’ll start mucking about and see how
crazy the setup is. The initial run actually exposed one of our most
recent bugs with the “call by reference bug”.
More news soon. I am starting to collect different bugs from the email
list that should be tested.