Presentation by Roger Connell at ADUG Melbourne August 2015
Roger contributed to the ADUG discussion about how unit testing is used by members.
At Innova Solutions any test jig required to exercise or debug a function or object is written as a DUnit class. These are then incorporated into generalised tests suits which make them available as regression tests when a new version of Delphi is released. It is also helpful when you need to change something to be able to run the original tests.
In some cases we do write the test case first and then use that as a test harness while we refine the function or object code but given the vintage of much of our legacy library in most cases the test case is written to first demonstrate a bug and then to step through the code to make the repair
Our tests include Internet polling, inter-process synchronisation, database access and Delphi based connection to Microsoft Word, Access, etc.
We do not follow what we now understand to be “good unit testing practice” this is not because we reject these practices but because we have developed our tests over time and a retrofit would not be cost effective. Good practice discussion points
A Zip file of a project containing one simple test case from our suit together with the tested source code is available here. The tested object is a simple log file object and the test case checks the ability to roll logs and purge outdated logs.
While it is not possible to offer our actual test projects for download as they by definition require access to our complete code library it is thought that the actual test cases might help others understand our approach and are made available. The source for an extensive set of Innova Test Cases below but they do not include the library source which would be required to compile them.
The general library test cases are contained in DUnitTstCase.pas and DUnitTstCaseUniCode.pas.
The cross platform persistent object database test cases are in DUnitTstCaseCrossPlatform.pas and the test database objects are in LibTstNewCrossPlatformObjs.pas and LibTstNewPermRemObjsCrossPlat.pas. Object database details are available via http://www.innovasolutions.com.au/delphistuf/ADUGSymposium2008.htm.
These test cases also run under the Firemonkey unit testing frame work discussed at ADUG in December . http://docs.innovasolutions.com.au/Docs/ADUGDelphi/ADUGDecember2014.html. At this stage the persistent local database has been demonstrated via unit testing on the MAC but more work is required the get the remote db code working when significant transmission times are involved.
The company accepts no liability for any alleged or actual damage arising from the use of any of these products or this information.
on this information contact us :: enq at innovasolutions.com.au
INNOVA Solutions Pty Ltd - ACN
081 449 836