Index
Index
 
Numerics
 
3 As
     See arrange, act, assert
404 File Not Found 522
 
A
 
abstract class
     enforcing contract 107
abstract test case 49-50, 52,
107, 118, 628
accept(). See TestFilter
acceptance test 110
action
     in a web application 514
ActionForward 518
actual value 282
addTest() 109, 113
addTestSuite() 112-113, 237
     ignores suite() method 238
     incorrect usage 238
aggregation 66
Agile 509
aliasing problem 579
AllTests 11, 115-116, 238,
590-591, 596
     alternatives to 116
     maintenance issues 115-116
Ambler, Scott 172
Ananiev, Alexander 413
anonymous inner class 58
Ant 94, 96, 235, 455, 591
     customizing test results
208-209, 213, 224
     for executing tests 174, 181, 183
     initializing test environment 165
     integration with Cactus 396
     JUnit result formatter 209
     reporting test results 198-199, 202, 205
     using an XML catalog 303
     with system properties 139-140
Anthill 174, 335, 407, 689
Apache 191
appearsEqual() 573, 577,
581, 583
     implementation details 583
     motivation behind 583
     problems with 583
application
     general testing strategy 509
application context 496
application logic
     separate from business logic 484
application servers 394-397, 406-410, 415-418
     automatic deployment 162
     performance problems with 259
     security 529
     testing with 302, 510, 512-513
     testing without 297, 386, 510
     See also containers
Armstrong, Eric 52
arrange, act, assert 6, 23, 414
Arrays.asList()
     for comparing arrays 25
aspect patterns
     Wormhole 649
AspectJ 650
Aspect-Oriented Programming 263
aspects 70, 559, 571, 649
assembly descriptor 529
Assert 14, 23, 225
assert methods 225
assertAppearsEqual() 581
assertAppearsNotEqual() 581
assertCollectionsEqual() 62
assertEquals() 13-15, 23, 37, 61-62, 248, 301, 493, 575, 581, 588
     alternatives to 581
     tolerance level 42
     tolerance level for floating-point numbers 14
assertEventsAppearEquals()
577, 582
assertFalse() 14, 31
assertion 13, 21, 23, 59, 74
     complex 604
     counting 224
     duplication in 617
     overly specific 60, 247
     style 294
     the implicit and 30
     XPath-based 282, 287, 294-298, 301-302, 403, 491
assertion failures
     multiple in test 248
assertion methods 14
AssertionFailedError 15
assertNotEquals() 31
assertNotNull() 14
assertNotSame() 14
assertNull() 14
assertSame() 14, 503
assertThrows() 59-60
assertTrue() 14-15
assertXMLEqual() 269, 273-276, 281-282, 285, 288
assertXMLIdentical() 290
assertXpathEvaluatesTo() 269
assertXpathExists() 269
Astels, Dave 697
asynchronous 376, 414, 427, 606
attribute values, XML 266
attributes
     web form 494
authentication 529-530, 532
authorization 529, 532-533
auto-increment 349, 351
Avalon 191
 
B
 
Bach, James 7, 20, 698
Bag 63
bar 174
Base Test Case
     defined 90-91
     managing test data with 145, 155
     when to use 179, 190, 193-194, 337, 616, 620
BaseTestCase (GSBase) 62
<batchtest> 181, 199, 201-202, 596
     fork attribute 182
     merge results 206
bean-managed persistence
374, 408, 653
Beck, Kent 6, 83, 106, 108, 259, 567, 649, 697
behavior 17, 19-20, 81
     complex 19
     enforcing common 48
     expected 23
     incorrect 371
     instead of methods 35
     method without 35
     predictable 6, 83, 245, 556
     scattered throughout 510
     special cases 92
     testing indirectly 46
     testing individually 87
     testing separately 359
Bloch, Joshua 26
BMP 408
     complexity of 408
     reducing complexity of 413
     See also bean-managed persistence
Bossicard, Vladimir 119, 185, 586, 618
boundary cases 490, 689
boundary condition 8, 127
Bowler, Mike 28, 117, 123, 476, 573, 576
breakpoint 5, 10
brittleness 75
     assumption about data format 331
     assumption about local environment 280, 513
     dependency on database 312
     dependency on implementation details 359, 565
     duplication 35, 54
     of test fixtures 556
     overly-precise assertions 60, 247, 294, 465
     subclassing the class under test 571
     vague assertions 269
broken links 510, 522, 525
bugbase-test.log 196
build script 142
buildControlDocument() 639
buildfile 97, 181
buildTestDocument() 639
business data 371
     corrupting 371
business logic
     dependency on container 444
     extracting from EJB 392,
395-396
     extracting from web components 456, 484
     in entity beans 374-375
     in message-driven beans 376
     in session beans 371-374, 387
     in stored procedures 366
     moving into POJO 379
     passing external resources into 386
     testing in isolation 384-386, 449, 689
     testing in memory 379
     testing without 427-430, 444-447, 458-459, 483-484, 510
bytecode magic 263
bytecode manipulation 185, 561
 
C
 
cache 181, 183
cache hit
     verifying 183
Cactus 441, 510, 533
     and the Parameterized Test Case pattern 132, 634
     begin method 532
     deploying tests 395
     when to use 137, 393-394,
398, 530-535
CallableStatement 367
callbacks 220
cannot break on its own 41
Cannot instantiate test case 118
cascading stylesheets 296
Catalina 479
Celis, Shane 248
CGLib 67
Chappell, Simon 677
checkstyle 616
class
     as a unit to test 4
class loader
     problems 254
class loading 235
     problems 234
class path 251, 394
See also classpath 11
class reloading
     problems 250
class under test
     subclassing 490, 507
ClassCastException 254
     narrowing EJB reference 253
class-level method 68, 433
     problems faking out 70
ClassNotFoundException 591
CLASSPATH 235
-classpath 235
<classpath> 235
classpath 234
CLEAN INSERT 170
     clearParameters() 358
client data 446
client state 381
clone() 573, 579-580
     consistent with equals() 579
     limitations of 579
     when to use it 580
Cloneable 573, 580
     pitfalls with 579
Closure 59
CMP. See container-managed persistence 400
code and fix 4
code path
     as a unit to test 4
cohesion 9, 20, 60, 107, 373
collaboration 328
collecting test case classes 586
collecting tests
     specific ones 107
Collection.add(Object) 34
collections 26
     comparing 61, 247
     duplicate elements 62
     unordered 62
Collections.synchronizedList() 24
com.gargoylesoftware.base. testing.TestUtil 581
com.sun.jms.MapMessageImpl 424
command interpreter 45
command line 155, 161, 189, 195
     building tests 94
command line options 142
command shells 199
Command/Query Separation Principle 419
comments
     appropriate use of 471
common fixture 125, 244
communication
     through good names 17
ComparabilityTestCase 586
Comparable 586-587
ComparableAssert 589
compareTo() 586-587
     consistent with equals() 588
complexity 319, 368
     of EJB 372
     test environment 137
composition 66
<concat> 201
confidence 56, 675
ConfigurableTestCase 159-160
configuration 377
configuration document 303
configuration errors 302
configuration files 145, 266, 401
     XML 147
configuration management 438
configuration tests 145
connections
     cleaning up 335
     pooling 170, 335
consistency 31
console 546
construction
     polymorphic 40
constructor
     testing 37
     testing default values 38
container 385, 409
container-managed persistence 374, 397, 401, 403
container-managed relationships 398, 401
     effect on test complexity 375
     testing meta data 375
containers 409-410, 413, 423, 501, 509, 529
     difficulties testing with 259, 422
     initializing with ServletRunner 454
     minimizing use of 439
     security 535
     simulating 387, 396
     testing EJBs with 372, 374-376, 394-399, 401, 413, 417
     testing EJBs without 378, 396, 401, 411, 415
     testing JMS components with 438
     testing JMS components without 444, 474, 480
     testing with 396, 413, 418, 505
     testing without 417-418,
420, 526
     trusting 484, 536
context root 454
continuous build 407
continuous integration 375
contract 5, 53
Controller 246, 371, 374, 376, 379, 444, 451, 490, 496, 498, 500, 509, 514
Cooley, Curtis 366
copy and paste reuse 433
CountingAssert 225
coupling 9, 20, 60, 70, 107, 145, 193, 301, 309, 312, 321, 334, 374-375, 415, 429, 437, 445, 448, 451, 479, 483, 491, 545, 559, 563, 607, 684
     effect of test data 137
     excessive 293
     tests and environment 143-144
     with Singletons 558
coverage 9
Craig, Philip 318, 690, 698
createControlInstance() 65
creation method 40, 49, 562
CredentialProvider 527
credentials 526, 530, 533
CRUD 366
Cruise Control 94, 174, 335, 375, 398, 407, 464, 689
Cunningham, Ward 135, 352
custom assertion 60, 90-91, 267, 269, 290, 589, 604, 617
     assertThrows() 58
     design tips 619
custom suite method 108, 128, 134, 238
custom test suite 112, 128, 237
     building programmatically 117
     JUnit ignores 237
Customer Tests 79, 87, 91,
110, 120, 474
     custom file format 135
CVS 121, 274
 
D
 
Dallaway, Richard 172, 309, 697
data access layer 310, 335
Data Bean 496
data components 309-310
Data Definition Language 328
data hiding 38-39
data repository 142
data source 401, 409, 411, 440, 478
data transfer document 304
database administrators 327, 350
database connection 161
     as test resource 170
database fixture 341
database meta data 334
     alternatives to 331
     making assertions on 329
database schema 327, 329, 366, 406
     dependency on 333
     enabling change 328
database servers 165
DatabaseMetaData.getSchemas() 330
databases 249, 309
     and entity beans 375
     and message-driven beans 421
     and test data 137, 139, 157, 170, 346, 597
     as a test resource 586, 593
     collective ownership 327
     connection parameters 142
     development 352
     exclusive access 406
     four for testing 309
     free alternatives 350
     integration 310
     issues testing against 334
     large data sets 171
     leftover data 332
     legacy 363
     meta data 329
     minimizing tests against 261, 312
     multiple schemas 363
     ownership issues 350
     problems using 157, 401
     reducing dependency on 261
     referential integrity 406
     resetting state between tests 138
     shared 309, 349
     stored procedures 366
     testing entity beans without 389, 409
     testing the schema 328, 352
     testing with 333, 360, 398, 557, 596, 599, 672, 681
     testing without 317, 322, 332, 357-359, 599
DatabaseTestCase 170
data-driven tests 103, 127, 133
     and Cactus 132
dataset 361, 364
DataSource 162, 325, 594
DbUnit 91, 138, 170, 360, 363, 365, 399, 596
     flat XML format 360
     limitations 362
dbunit.qualified.table.names 363
DDL. See Data Definition Language
deadlock 177-178, 600
debug mode 5
debug(Object message, Throwable t). See Log4Unit
debugger 4-5, 7, 74
debugging 4, 20, 178, 190, 334, 500, 536, 676
declarative security 525, 535
     how not to test 529
declarative transactions 536
default test suite 235, 237, 243
DefaultConsole 601
DefaultDataSet 362
defects 8, 36, 474, 614, 675
     caused by missing test 38, 56, 110
     come back 4, 182
     diagnosing 297, 305
     hiding 351, 478, 616
     impact of 371, 451
     in an external library 186
     in J2EE 1.3 412
     in the platform 394
     isolating 20-21, 378, 399
     low-priority 186
     mean time to find 114, 607
     pattern 352
     recurring 302, 397
delegate 379
delegation 676
DELETE_ALL 170
dependency 259, 282,
310, 312, 333, 371
     avoiding 485
     checking 204
     database tables 334
     eliminated 613
     on file system 604
deployed component
     alternatives to testing 272
deploying 513
     database schema objects 352
     JSP tag library 474
     tests 590
deployment 372, 399, 506
     complexity of 378
     simulating 423
deployment descriptors 266, 415, 529, 536, 538
     and ServletUnit 445, 454-455
     forgetting to write 474
     testing 272, 399, 475, 477
deployment information
     hard coding 513
deployment problems 513
deployment script 591
Deployment Tests 280, 409, 439, 477, 536, 591
design
     indicator of good 460
     testable 452
design improvement 66, 108
     See also refactoring
design pattern 162, 544
     Abstract Factory 544
     Action 45
     Bridge 373, 376
     Command 45, 55, 663
     Composite 544
     Decorator 162, 179, 427, 544, 665, 676
     Event Listener 545, 576
See also design pattern, Observable
     Event Source 545, 550
See also design pattern, Observer
     Factory 562
     Front Controller 490
     Model View Controller 371
     Null Object 691
     Observable 544, 550, 555, 574, 621
     Observer 215, 544-545, 548, 621
     Prototype 580
     refactoring towards 544
     Registry 593
     Remote Facade 379, 386
     Singleton 68, 169-170, 181-184, 440, 544, 556-557, 559, 561
     Strategy 509
     suggested by tests 544
     Template Method 566
     Wrapper. See design pattern, Decorator
design problem 346
destroy() 480
DetailedDiff 288
Diasparsoft Toolkit
     CollectionUtil 331
     EntityBeanMetaDataTest 403
     ExceptionalClosure 59
     FakeHttpSession 490
     FileSystemWebConnection 491
     FileSystemWebResponse 491
     ForwardingServlet 459
     GoldMasterFile 462
     HttpUtil 516
     JDBC utilities 330, 660
     RequestDispatcherAdapter 490
     ValueObjectEqualsTest 64
DiFalco, Robert 181
Diff
     XMLUnit 275
Diff engine
     XMLUnit 281
Difference 284
DifferenceConstants 283
     ATTR_VALUE 283
     TEXT_VALUE 283
differenceFound() 284-285
DifferenceListener 272, 280, 282, 285, 287
differences
     ignoring in XML documents 272, 281
     in XML documents 274, 289
     multiple in XMLUnit tests 288
DirectorySuiteBuilder 119, 175, 590, 596
     compared to RecursiveTestsuite 119
disable 185
distribution 386
doAfterBody() 470
DocBook 273, 276
Doctor Dobbs Journal 159
Document Object Model 278, 283, 294, 476
     custom 287
Document Type Definition 272, 303, 403, 521
     network connectivity 279
     using locally 280
doEndTag() 470
doFilter() 503
doGet() 456
DOM 220, 291
     See Document Object Model
Domain Model 27, 379, 381, 383-384, 386, 587
domain object 318
     converting to database object 314
DOMParser 295
don?t test the platform
     EJB container 375, 397, 399
     Java compiler 40
     JDBC 310
     JMS server 433
     web container 505, 525, 529
doPost() 447, 456, 488-490, 499
doRunTest() 215
doStartTag() 470
downloading JUnit 10
DTD 304, 401, 477
     See also Document Type Definition
DuplicateKeyException 399
duplication 9, 59, 248, 309, 316, 420, 548
     and shared test resources 593
     eliminating 25, 35, 89, 617
     extracting into test fixture 73, 83
     in database tests 310, 337, 362
     in production code 318, 446
     in test names 92, 110
     in tests 92, 113, 127, 432, 637
     of assertions 301, 403, 604, 617
     of production code in tests 563-565
     of production logic in fake objects 692
dynamic content 496
dynamic invocation handler 576
 
E
 
Eames, Mark 444
*.ear 395
EAR file 143
EasyMock 67, 318, 409, 437, 560, 690, 695
     alternative to Self-Shunt 555
     examples of use 436, 438, 488, 549, 626-627, 669
Eclipse 99, 140, 180, 251, 596, 610
     Java Build Path 235
ed bar 174
EJB 162, 259, 420
     failure when narrowing 253
     suitability 371
     why we use it 386
     See also Enterprise JavaBeans
EJB container 385, 392, 397, 399, 410, 530
     avoiding 372-373, 392
     live 374, 377, 398, 414, 672
     mocking 392
     simulate 374, 386, 392
     testing without 400
EJB implementation class
     instantiating directly 392, 411
EJB server. See EJB container
EJB specification 382, 399
ejbCreate() 385, 427
ejbLoad() 410
EJBQL 398, 401, 406
emacs 200
email 199
encapsulation 37, 45
endo-testing 690
End-to-End Tests 7, 262, 494, 510, 519
     alternatives to 446, 457, 470, 474, 491
     as safety net 335
     CMP entity beans 375, 399, 407
     for legacy code 455
     for security 525
     HtmlUnit 513
     organizing 79, 101, 120, 123
     purpose of 509
     test fixtures 87
Enterprise JavaBeans 253, 371, 496
     as thin as possible 372
     lifecycle methods 393, 408, 659
entity beans 374, 386, 397, 400, 408, 440, 536, 653
     BMP 376, 408
     reducing the cost of testing 406
     testing meta data 401
     trade-off between BMP and CMP 374
EntityContext 409-411
environment setup 164
environment variables 138,
142-144, 147, 235
equality 25-26, 31
     approximating with appears equal 581
     of XML documents 269
equals() 25-29, 32, 586-587, 677
     and compareTo() 588
     and EventCatcher 576
     and JavaBeans.
See appearsEqual() 581
     and object cloning 573, 579-580
     and testSerliaization() 578
     and TestUtil.testClone() 573
     and XML documents 287
     description of contract 27
     for collections 62
     for Value Objects 27
     implementing correctly 26
     not implemented correctly 581
     testing 26
     testing without EqualsTester 29
     when to implement 45
EqualsHashCodeTestCase 32,
63, 65
EqualsTester 28-29, 32-33, 63, 678, 681
     example of using 28
     parameters 28
     special handling of subclasses 28
equivalence relation 27
error 16, 57, 545
     how it occurs 56
     notification 216
     what it indicates 16
     what it means 57
error conditions 490
error handling
     for JMS components 427
error-case testing 437
ERwin 328
Evans, Eric 698
event handler 213
event listener 81, 693
     universal 576
event source 81, 576, 693
EventCatcher 573-576, 582-583
event-handling logic 548
events
     simulating 549
     test execution 213
exception 15
     expected 56
     ignoring expected ones 58
     object-oriented test approach 58
     throwing from tests 105
     throwing the right one 56
     unexpected 57
ExceptionalClosure 59
excluded.properties 250, 252, 254
     location on file system 251
     multiple copies 251
expectations 8, 392
expected result 25
expected value 24, 34, 282
     comparing to actual value 24
expensive tests 681
     isolating 689
exploratory testing 7, 20
extending JUnit 189, 586
external data 346
external library
     class loading problems 250
     handling defects in 186
external resource 249, 593,
613, 681
     avoiding 260, 334, 376, 442, 510, 608
     effect on test execution speed 114
     extracting into test fixture 86
     mitigating the cost of 438
     simulating 415
     tests dependency on 120
 
F
 
factory method 562
fail fast 694
fail() 57, 330
failed assertion. See failure
failed test. See failure
failing status code 528
failing test
     one per incorrect behavior 245
FailingHttpStatusCodeException 528
failure 16, 57, 90, 382, 545
     affecting other tests 106
     determining the cause 293
     how it occurs 56
     message 15, 59, 90, 177, 589
     multiple in test 244
     notification 216
     signaling 15
     what it indicates 16
failure message 59, 131, 271, 287, 333, 442, 554, 618
     customized 620
     misleading 333
     specialized 290
     XMLUnit 288
fake 287, 489, 516, 545, 669, 685, 691-693
fake method 67
fake objects 486
false failures 418, 475, 513, 523, 607, 612
false positive 432
feedback 7-8, 21, 111, 250, 371
file
     cleaning up between tests 604
     reading data from 608
file system 149, 280, 458, 466, 604-605, 607
     cleaning up between tests 605
     load web pages from 491
     scan for tests 117
     testing without 606, 608
file system operations
     asynchronous nature 605
FileAssert 620
filename
     relative 610
<fileset> 201
filter 283
     See also web resource filter
FilterChain 503
finally 336
finder methods 398
finite state machine 514
Fit 135, 509
FitNesse 509-510
fixtures 18, 83, 521, 532, 605, 686
     amount of duplication 89
     and order-dependent tests 123-124
     and Parameterized Test Case 129, 132, 181
     and Self-Shunt 432
     as instance-level fields 109
     as XML documents 134
     changing for each test 128
     common services as 90, 304
     complex 556
     database 340
     duplication 84
     effect on test readability 86
     excessive 683
     expensive to set up 161, 164
     external data in 346
     extracting code into 338, 456
     for database tests 346
     hierarchy 87
     keeping separate 112
     large 87
     one per entity bean 403
     one per method 373
     one per Transaction Script 372
     one-time setup 158, 161, 170, 249
     organizing tests around 20,
73, 92
     setup problems 234, 239
     shared 106, 164, 249, 332, 346, 557, 559-560, 586, 597, 599
     special case tests 18, 92, 372
     splitting 73
     See also setUp()
and tearDown()
foreign key 400
foreign key constraints
     effect on test complexity 334
foreign keys 327
<formatter> 199, 202, 224
formatter type
     for <batchtest> 199
Fowler, Martin 129, 310, 328, 334, 372, 698
frames 204
framework 234, 259, 501, 519
     for unit testing 6
     learning process 239
Freeman, Steve 318, 690, 697-698
functional test 110
 
G
 
Gamma, Eric 6
Gang of Four 215
garbage collection 336, 417-418
garbage-in, garbage-out 304
getDatabaseConnection() 361
getDataSet() 361
getInitParameter() 479
GetMethodWebRequest 454
getName() 178
getPrimaryKey() 410
getProperties() 139
getResourceAsStream() 150-151
getters 41
     when to test 42
     whether to test 674-675
global data 46, 66, 70, 235
     reset between tests 182
global functions
     session bean methods as 373
going dark 242
Gold Master 323-327, 462, 466, 494
     externalizing to file 325
     for page templates 457-459, 461, 468, 475, 494
     other examples of use 280, 354, 578
     when not to use 465
     See also Guru Checks Output
Golden Master. See Gold Master
golden results. See Gold Master
GoldMasterFile 462
good practices 17, 114, 123, 137, 144, 148
Grandma?s Ham 46
graphical user interface 164
green bar 189, 250
GSBase 573, 590, 619-620
     assertCollectionsEqual()
     BaseTestCase 62, 91
     EqualsTester 63, 678
See also EqualsTester
     JDBC resource wrappers 343
     OrderedTestSuite 123
     RecursiveTestSuite 117, 121, 175
See also RecursiveTestSuite
     testing equals() 28
     See also Base Test Case
GUI 106, 164, 399
GUI events 574
Guru Checks Output 326
     See also Gold Master
 
H
 
Haggar, Peter 26
Hall, Stephen 697
happy path 17, 311, 435
hashCode() 322, 576
     consistent with equals() 32
heavyweight 558
Henderson, Anne 699
Hendrickson, Chet 699
here document. See herefile
herefile 147-148
Hibernate 375-376
HierarchyEvent 575
Highsmith, Jim 699
Hollywood Principle 260
Holser, Paul 284
hot deployment 162
HSQLDB 309, 350
HTML 276, 290
     badly-formed 291
     form elements 455
     ID attribute 301
     parsers 291
     parsing as XML 290
     test results as 189, 202, 205, 215
HTMLConfiguration 295
HtmlPage 494, 522
     creating from the file system 491
HTML-tolerant parser 272
HtmlUnit 91, 302, 512-513,
539, 573, 645
     broken links 522
     defect in version 1.2.3 523
     for End-to-End Tests 444, 509
     testing EJB security 530
     testing static web pages 291
     testing web security 526-527
     when to use 455
     without a web server 491
HTTP 445
HTTP request 455, 496, 498
     accessing with ServletUnit 455
     parameters 485
     processing 483
     simulating 486
HTTP response
     accessing with ServletUnit 455
HTTP session 374, 446, 448-449, 452, 490, 496, 501
     interaction 451
HttpClient
     limitations 523
HttpServletRequest 485, 495, 499, 516
HttpServletRequest.getParameterMap() 485
HttpServletResponse 529
HttpSession 452, 455
HttpUnit 91, 444, 454
HttpUtil 516
Hunt, Andrew 42, 697, 699
Husted, Ted 697
Hyslop, Jim 699
 
I
 
IDE 115-116, 165
     effect on organizing source code 78
IDEA 180
identical
     XMLUnit 269, 273
identifier
     for expected exceptions 57
IDENTITY 349, 351, 362
ignorance
     celebrating 241
_ignored 186
ignored tests
     false positives 187
ignoring tests 107, 185
implementation pattern
     testing setter methods 44
     throwing the right exception 57
incremental 9, 245
indices 327
infinite loop 177-178
info(Object message). See Log4Unit
infrastructure 137, 145, 148, 190
inheritance
     drawbacks to 193
init()
     invoking directly 478
InitialContext.lookup() 253
initialization
     and ServletContext 480
initialization parameters 480
<init-param> 277
insane object 54
INSERT 170
installing JUnit 10
integration 509
Integration Tests 79, 123, 137, 162, 625
integrity constraint violation 332
intercept
     method invocations 486
interface
     faking out 67
     multiple 53
     publishing 48
     testing 48
     tests as semantics specification 52
invocation context 455, 499
isolated tests 106-108,
298, 408, 429, 480
     problems with 544, 557
     See also test isolation
isolation 509, 545
     impediments to testing in 66
     testing business logic in 412, 430
     testing entity beans in 399
     testing in 5, 19, 66
     testing message-driven beans in 426
     testing objects in 387
     testing responsibilities in 434, 484, 495
     testing session beans in 391
     testing web components in 444, 457, 468
     testing web pages in 513, 523
isValid() 38, 54
IterationTag 469, 473
 
J
 
J2EE 138, 253, 371, 577
     use of XML 266
J2EE applications 266, 508, 510
J2EE server 162
j2ee.jar 413
Jakarta Commons 59, 523
Jakarta Commons Logging 198
*.jar file
     collect tests from 586, 590
<jar> 591
Jasper 455, 457, 463
<java> 175
Java language specification 40
Java logging API 193
Java system properties 144
Java Virtual Machine 16
java.io.tmpdir 142
java.lang.Cloneable 580
java.lang.System 139
java.logging 190
java.util.Calendar 54
java.util.Properties 148
java.util.ResourceBundle 152
JavaBeans 38, 44, 54, 457, 469, 581, 583
     presentation layer 466
     structure of 54
     testing 54
<javac> 96
Javadoc 204
JavaMail 419, 432
JavaServer Pages 272, 444-445, 491, 514, 520
     alternatives to 267, 298
     and HTTP sessions 455
     forwarding from servlet 455
     rendering 456-457
     tag handler 468
     tag library 474
     testing data passed to 495
     testing in isolation 457
Javassist 185
javax.rmi.Remote 382
jaxen 267
JAXP 223
     test failure using 252
JBoss 185, 386, 401, 403, 413, 434, 441, 530, 534
JDBC
     alternative to 158-159
     common trouble spots 321, 333
     design criticism 322
     duplication in tests 310
     for test data 399
     problems testing 309
     provider 310, 330
     reducing dependency on 261, 312, 314, 317
     testing queries 317
JDBC client code 408-409
JDBC resources 336, 340, 367
     cleaning up 335
     effect on test execution 336
     in production code 343
JdbcResourceRegistry 340, 362
JDO 386
jEdit 180
Jeffries, Ron 135, 259, 699
Jelly 189
Jetty 495
Jini
     alternative to EJB 385
jMock 67, 488, 695
JMS 259, 548
JMS exceptions 437
JMS message consumer 376, 420-421, 426, 430-432
JMS message listeners
     See JMS message consumers
JMS message producer 376,
433-434
JMS server 434, 438
JNDI directory 385, 411-412, 414-415, 427, 439-441,
510, 657
     as common test resource 593
     avoiding 376, 392
     in-memory 440
     mocking. See MockEJB
     testing contents of 393, 430, 442
JNDI lookups 253, 373, 431, 440
     effect on test execution speed 396
     testing in isolation 386
JNDI namespace
     nonglobal 412
jndi.properties 413
JSP engine 457
     simulating 468, 470
     standalone 463
JSP. See JavaServer Pages
JspWriter 473
JTidy 296
JUnit
     alternatives to 675
     design philosophy 245
     when not to use 322, 366
<junit> 175, 189, 198-199,
201-202, 224
     alternative to 215
     custom formatter 214
     forking the JVM 181
     formatter attribute 209
     printsummary attribute 204
     using system properties 140
     See also <junitreport>
JUnit FAQ 253, 255
JUnit Yahoo! group 52, 164, 181, 185, 215, 234, 236, 618
junit.framework 13, 23
junit.framework.AllTests 113
junit.framework.Assert 14
junit.framework. AssertionFailedError 15
junit.framework.Test 216
junit.framework.TestCase 13, 240, 395
     AllTests pattern 113
junit.framework.TestListener 215
junit.jar 95, 175, 223, 234, 250
junit.log4j.LoggedTestCase
194-195
junit.logswingui.TestRunner 195
junit.runner.TestRunner 215
junit.swingui.TestRunner 174
junit.tests.AllTests 112, 115
junit.textui.TestRunner 11, 174
JUNIT_HOME 175
JUnit-addons 586, 592
     assertNotEquals() 31
     ComparabilityTestCase 589
     ComparableAssert 589
     custom assertions 619-620
     DirectorySuiteBuilder 119, 175, 590
     documentation defect 601
     EqualsHashCodeTestCase
32, 64
     ignoring tests 186
     ResourceManager 593
     test runner 176-177, 179, 600
     TestClassValidator 614
     TestSetup 164, 598
JUnitEE 137
junit-frames.xsl 205
junit-noframes.xsl 205
JUnitPerf 161, 539
JUnitPP 138, 159, 592
     default directory 160
<junitreport> 176, 189, 202,
204-206, 208-209, 214-215, 224, 596
     customizing output 205
     junit-frames.xsl 205
     junit-noframes.xsl 205
     with custom stylesheet 207
JunitResultFormatter 209
JUnitX 248, 480, 604, 620,
622, 626
junitx.extensions.Comparability TestCase 587
junitx.framework.TestProxy 621
junitx.runner.Resource 597
junitx.runner.TestRunner 176
junitx.util.ArchiveSuiteBuilder 590
junitx.util.ResourceManager 593
just for testing 81, 384, 624-625
JVM properties.
     See system properties
 
K
 
Kaner, Cem 698
Kay, Michael 297
keep the test 21, 43
Kerievsky, Joshua 544
key properties 65
 
L
 
Laflamme, Manuel 170
Langr, Jeff 117
Latkiewicz, George 313, 326, 385, 407, 478
leaking resources 335
learning
     by writing tests 61
learning curve 234
Learning Test 40, 312, 329, 332, 335, 353, 397, 648
legacy code 108, 323, 357, 389, 422, 626
     assertEquals() 581
     file system 607, 614
     JDBC 341, 349, 357, 359-360
     message-driven bean 422, 429
     no return value 620
     private methods 604, 625
     session bean 387
legacy J2EE components 262
Lesiecki, Nicholas 697
lifecycle
     of JSP tag handlers 468
lightweight container 445, 454
Link, Johannes 697
LinkageError 252
List 24
List.equals() 25
ListAssert 619-620
location
     in a web application 514
log()
     overriding in servlets 479
Log4J 190-191, 194, 196, 198, 509
     extra logging output 197
Log4Unit 194, 196
     default behavior 194
     limitations 198
     using 194
LoggedTestCase 198
logging 194, 196
     configurability 193
     how not to use 190
LogKit 190-191
look-and-feel 299
 
M
 
Mackinnon, Tim 318, 690, 698
Madhwani, Rakesh 164
<mail> 201
mailto 523
maintenance 348
Manaster, Carl 352
manual tests 322, 483
     for EJB security 530
mapping
     for CMP entity beans 398
Massol, Vincent 697
Maven 189
McConnell, Steve 46
memory
     testing entirely in 379
Menard, Jason 36
mental model 17
Message 421
message listener 259
     instantiating directly 427
message-driven beans 376,
417-418, 427, 430, 432
     difficulty testing 420, 426
     legacy code 422
     testing with MockEJB 423
     testing with the container 414
     testing without the container 420
MessageDrivenContext 420
MessageListener 426
message-processing logic 427, 429-430
messaging server 438, 478
     testing without 426, 434, 438
meta data 397, 404
     for CMP entity beans 400
method
     as a unit to test 4
method invocation
     intercepting 488-490, 576
     recording 549
method invocation sequences
     recording and verifying 555
     verifying with EasyMock 411
Method test name not found 236
Mimer 309, 350
mock data source 368
Mock Objects 312, 318, 325, 344, 357, 473, 672, 690, 694-695
     JDBC 357
mock objects 260, 318, 345, 359, 368-369, 386, 392, 409, 426, 430, 432, 518, 568, 649, 681, 689
     effect on complexity 319
     JDBC 358, 368
     JDBC provider 312
     JMS 439
     overuse 439
mock objects approach 260, 351, 409, 420, 442, 484, 510, 613
MockCallableStatement 367
MockConnection2 368
MockContext 411-412, 438
MockDataSource 412
MockEJB 387, 391, 393, 396, 399, 411-412, 420, 423, 425, 438, 440
     supported EJBs 393
MockJspWriter 473
MockMaker 488
MockMultiRowResultSet 318
MockPageContext 471
MockPreparedStatement 313
MockResultSet 321
MockSingleRowResultSet 318
Model 371, 509
Monk, Simon 697
multiple assertions 244
     alternatives to 244
     motivations for 246
multiple failures 245, 247
     for detailed test results 248
multiple test runs 164
multiple tests
     using same data 106
Multiset. See Bag
mutable objects 579
MVC. See design pattern, Model View Controller
MySQL 350
 
N
 
naming conventions 131, 154, 576
     for special case tests 18
     for test case classes 18
     for test packages 80
     for tests 17, 73, 242
naming rules
     for tests 242
narrow() 254
narrowing EJB references 253
navigation 519
navigation engine 511, 514,
518, 520
navigation rules 371, 509-511, 514, 518-520
     modelling 514
     testing in isolation 518-519
NekoHTML 291, 294, 302
     configuration notes 294
     default configuration 295
     HTML DOM configuration 294
     HTMLConfiguration 294
     instantiating parser 295
     Xerces compatibility 296
nekohtml.jar 294
network connection 268, 279, 401
network connectivity 279
No test cases found 236
NoClassDefFoundError
     when executing tests 234
noframes 204
noloading 198
novice programmers 40
null reference 16
nullable 334
nullable columns 327
NullPointerException 479, 499
 
O
 
object model
     for HTML 513
Object Tests 5, 10, 335, 414, 470, 474, 556-557, 593
     alternatives to 625
     and mock objects 690
     automated 7-8
     different from Test Object 67
     for data components 310, 321
     for EJBs 414
     for J2EE applications 509-510
     for legacy code 263
     for web components 455, 465, 468, 474, 484, 494
     importance of Value Objects 26
     object-oriented design 66
     organizing code for 79
     positive feedback 9
     programmer confidence 9
     repeatable 7
     rhythm of 6, 12
     self-verifying 8, 15
     test data for 137, 157
Observer 550
one problem at a time 247
one-time setup 165, 249, 521, 597
onMessage() 414
     invoking directly 423
open source 6, 194, 245, 290
Open/Closed Principle 613, 689
operating system 165
optimize
     test suite 162
order of tests 106
     controlling 108
     JUnit default behavior 109
order-dependent tests 123, 126
     example 124
OrderedTestSuite 124-125
     as a refactoring tool 125
ordering of objects 586
org.apache.catalina.core. StandardWrapper. 479
org.custommonkey.
xmlunit.Diff 274
org.custommonkey.xmlunit. DifferenceListener 282
org.dbunit.DatabaseTestCase
170, 361
org.dbunit.dataset.IDataSet 170
org.w3c.dom 217, 223
orthogonality 245
owning the plug 349, 352
 
P
 
package hierarchy 114
page context 470, 473
page flow 509-510, 513-514
     testing in isolation 511
page templates 267, 514, 520
     testing data passed to 495
Pair Programming 241
parameterize 127, 139
Parameterized Test Case 65,
131-132, 634
     executing a single test 180
     externalizing fixture data 134
     for database tests 327, 345, 356
     for J2EE applications 516, 538
     for JNDI directories 442
     for web components 473, 506
     problem with Cactus 442
     using XML 134-135, 630
Parameterized tests.
     See Parameterized Test Case
parameterizing
     test data 137
<param-name> 277
<param-value> 277
passivation 393
PDF 209
     test results as 205
performance 147, 259, 336,
419, 464, 525
     problem with containers 259
permissions 356
     database objects 352
persistence 376, 386, 388, 408
     pluggable 375
Pettichord, Bret 698
philosophy 107
Plain Old Java Objects 379,
386, 424, 432
     and equals() 287
     and lightweight frameworks 386
     examples 664, 669
     extracting from EJBs 373,
379, 421
     extracting from JMS components 431
     refactoring Singleton
into 558, 560
     with web components 490
plain-vanilla JVM 413
PMD 241, 616
POJO. See Plain Old Java Objects
Poppendieck, Mary and Tom 699
PostMethodWebRequest 454
Postscript 209
PreparedStatement 311-312, 322, 695
     making assertions on 313
presentation engine 267, 272, 304, 465
presentation layer 297, 299, 301, 304, 374, 499
     testing without 510
presentation object 371
Preu¤, Ilja 32, 58
prevalent system. See Prevayler
Prevayler 375, 509, 607
primary key 408-409
primitive values
     comparing 23
printf 20, 330
printsummary 201, 204
private data
     gaining access to 622
private methods 480, 604, 625, 627
     testing 81
PrivateTestCase 621
problems
     common 234
procedure 372-373
production code
     shipping tests with 590
productivity 224
Programmer Test suites 111
Programmer Testing 4-5, 41, 66, 309, 396, 607
     goals of 334
     good practices 106
Programmer Tests 110, 120,
464, 509
     relationship to Customer Tests 111
     simplest 23
progress 224
properties 138, 148, 152, 156, 325, 591
     built-in 142
     for test data 138
     Java system 139
     reading from file 149
     setting 139
properties file 147, 164
     location in source tree 151
     managing multiple 592
     test data as 586
PropertyManager 586, 591
     limitations 592
protected methods 76, 604
public interface
     testing entirely through 37
publisher. See design pattern, Observable
 
Q
 
queries 311
query expressions
     for XML 266
query method
     add for testing 36
quick green 383
 
R
 
rathole 365
readability 158
readable properties 24
     testing a class without 38-39
recompiling
     avoiding 139
RecursiveTestSuite 117-118, 120-121, 175, 590
     compared to DirectorySuiteBuilder 119
     parameters to 117
red bar 250
reducing dependency 260
refactor 19, 302, 337
     unable to 389
     when you cannot 377
refactoring 9, 75, 181-182, 444
     and coupling 19, 80
     and legacy code 360, 389
     assertions 302
     away from containers 259
     away from the database 312, 334, 357
     effect on AllTests 115
     EJBs 376, 395, 408, 413, 430
     Extract Class 507
     Extract Method 619
     fixtures 88, 304
     into a Base Test Case 337
     Move Method 379
     Replace Subclass with Collaborator 490
     tests 159, 341, 604
     tests as safety net 70, 259,
334, 349
     tests as safety net.
See safety net
     to methods instead of constants 325
     towards a Parameterized Test Case 345
     towards a testable design
309-310, 379, 430, 452
     towards design patterns 544
     towards test isolation 123, 125
     without tests 419, 422, 561
referential integrity 406, 597
     arguments for 407
     overuse 400
reflection 105, 131, 243
     to invoke test method 109
registerServlet() 455
regression 7
     test 330
relational data
     converting to objects 317
ReloadedTestCaseDecorator
183, 185
remote connection
     eliminating from tests 280
remote method invocation 577
<report> 202, 205
     defect in 207
     styledir attribute 205
     using frames 204
reporting test results 16, 189
reports
     custom format 189, 205
     customizing 205
     format of 189
request 446
request dispatcher 490, 518
request handler
     behavior of 518
resetFixture() 126
resource references 412
     ResourceBundle 138, 151-153, 164
ResourceBundle.getBundle (String baseName) 153
ResourceManager 586, 596
ResourceManagerTestSetup 596
resources
     order of initialization 597
ResourceTestSetup 593
responsibilities
     separating 548, 550
result
     in a web application 514
result sets 330
     cleaning up 335
ResultPrinter 545
ResultSet 311, 318, 322, 345
     creating domain objects from 317
     hardcoded 319
     mapping data from 319
ResultSetMetaData 331
return on investment 38
     testing setter methods 48
return value 23, 26
     legacy method without 620
     method without 414, 484, 545
     testing a method with 23
     testing a method without one 33
     XML document as 266
revealing intent 17, 55, 59, 75, 128, 403
rhythm
     of a test 105
     of an Object Test 6
rich client 374
ripple effect 111, 556
RMI. See remote method invocation
Ruby 59
rules 56
runBare() 86, 243
runSuite() 215
runTest() 109, 179, 241
     alternatives to overriding 242
     invoking multiple test methods 242
     overriding 132, 234, 241-242, 570, 634
RuntimeException 16, 59
 
S
 
safety net 7, 108, 125, 182, 334, 511, 625-626, 675
     and legacy code 349, 422
     benefits of 259
     changing code without 561
     false sense of security 78
     refactoring without 70, 419
     using Cruise Control 398
     See also refactoring, tests as safety net
sanity check 54
scenario 372
schema-qualified tables 363
scripting 189
     variable 469
ScriptIt 166
security 386, 395, 398, 509-510, 527, 529, 532-533
     EJB 530
     programmatic 409
     web resource 525
security server 478
SecurityException 533-534
SELECT 317
self-documenting 9, 15
sense of completion 114
sequence diagram 421, 427
sequence difference
     in XML documents 281
serial version UID 578
SerializabilityTest 573
Serializable 382
serialization 573, 577
server-side tests 394
service() 455-456
services
     as plug-ins 261
servlet session
     accessing with ServletUnit 453
ServletConfig 479
ServletContext 480-481, 483
ServletRunner 445, 454, 499
servlets 259, 444-445, 451, 484, 494, 507, 513, 518, 613, 637
     and filters 500
     and XSL transformations 304
     design problems 259
     executing server-side tests 396, 442
     extracting business logic from 444
     forwarding to JSP 455
     initialization 454, 477
     initialization parameters 277, 287
     legacy code 263, 452
     multiple 481
     passing data to web pages 496
     processing requests 483, 486
     redeploying 162
     request attributes 277
     session attributes 277
     session data 446, 449, 455-456
     specification 277
     typical behavior 483
ServletTestCase 395, 441
ServletUnit 444-445, 455-456, 460, 488, 495, 499
     and HTTP session 453
     for legacy code 448, 455
     note on Invocation-Context 456
     testing filters 505
     testing J2EE applications 518
     testing ServletContext 481
     URL mapping 456
     when to use 456, 498
     with Jasper 457
ServletUnitClient 455
session
     design issues 446
     reducing interaction with 451
session bean 372, 384, 394,
396, 440
     delegating to domain object 379
     relationship to entity beans 399
     stateful 374, 446
     testing implementation directly 385
     testing methods independently 372
     testing outside the container 378
session data 446, 452
set method
     difficulties testing 45
     See also setters
setEntityContext() 411
     setExpectedCloseCalls() 345
setters 44
     whether to test 674-675
setUp() 84-86, 148-149, 158, 170, 178, 191, 239, 242, 272, 287, 337, 340, 347, 363, 403, 483, 488, 528, 532, 567, 600, 605, 687
     incorrectly overriding 614
     invoking super.setUp() 88, 239
     log messages 196
     once per test suite 161
     one-time 162
     typo 239
shared fixture
     effect on test isolation 106
shared test fixture
     as a design issue 599
shared test setup 346
side effect 35, 484, 545, 549
     invisible 36, 478, 546
     observable 34-36, 38, 45, 548, 620, 625, 649
similar XMLUnit 269, 273
SimpleCredentialProvider 527
simplifying interface 434
simulate 392, 526, 529, 690
     error conditions 69
simulator
     for web container 454
Single Responsibility Principle 81, 548, 555, 608
Singleton
     wise usage 46, 67
Smalltalk 6, 15, 59, 61, 117, 324, 397
SMTP 415
SMTP server 419
source code
     difficult to navigate 111
source control 155
source trees 77
special case tests 18
Specification by Example 65
specifications 5, 392, 468
     and third-party software 471
spreadsheets
     tests as 509
Spring 386
spy 46, 425
     event listener 82
     SQL 158
     parsers for Java 309
     query validator 309
     verifying commands 322
<sql> 157
SQL commands
     manual tests for 322
state diagram 510
stateless session beans
     ease of testing 373
statements
     cleaning up 335
static web page 457
Stobie, Keith 327
stored procedures 158, 355,
366-368
     deployment tests 352