-
Notifications
You must be signed in to change notification settings - Fork 2
/
HISTORY
executable file
·53 lines (42 loc) · 2.1 KB
/
HISTORY
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
HISTORY
This is the third version (second major re-write) of
this code. All three versions used Test::MockObject to
mock-up the DBI, but they differed in their modularity
and how the developer changed the mock DBI's behavior.
The first version was embedded in an application, using
DFA::Simple to provide a state machine for processing
the SQL. This was not modular or reusable. (I was coming
up to speed on a client's DBI application and needed a
way to quickly test whether the DBI interface portion was
correct without modifying the production database.)
The second version was a .pl file implementing a singleton
object that put all its code and data into main::
(because I misunderstood how Test::MockObject worked),
used DFA::Simple again, and had to be require'd. Usable,
but not nearly as simple as it seemed like it should be.
In this third version:
- Test::MockDBI is a CPAN-standard Perl module now, with
code and data all in the Test::MockObject namespace.
Once again, Test::MockDBI is a singleton class, as I
cannot see a way that multiple Test::MockDBI objects
would be useful.
- DFA::Simple is no longer used, as using the second
version of Test::MockDBI to test multiple programs
revealed that any state machine(s) used should be part
of the developer-supplied code for processing specific
pieces of SQL, rather than built into the main code.
- Testing types ("--dbitest[=TYPE]") were made more
explicit. An explicit wildcard type of 0 (zero) was
added (easily since zero cannot be used as a regular
type). Strangely enough, this wildcard type almost
eliminated use of state machines in my testing...
- The separate test programs are autogenerated so they use
the correct #! startup line.
- The test suite covers almost all of the statements, and
most of the branches and conditionals.
- Devel::Cover can be used to generate test coverage
statistics.
- The developed-supplied code to invoke Test::MockDBI and
modify the behavior of the DBI is now about half the
size of what was required by the second version of
Test::MockDBI.