DB backend webapp testing in java [tool needed] -


i want create test suit java web application. jsp applications jdbc connectivity . requirements follows,

1 - should able test database logic (queries etc) through models.

2 - great if test .jsp pages (if possible)

after doing research found dbunit database backend system testing, unfortunately couldnt find resource starter

what think testing options have , great if post links resources/ examples well

edit:

and have come across mock objects (like jmock..), wonder use replacement dbunit ?

thanks in advance

cheers

sameera

it's not clear question if want run integration tests (front end + end) or unit tests against database layer.

if need tool allows write integration tests, should definitively @ selenium. selenium can generate functional tests navigating web site (jsp pages) , asserting stuff on page exists or it's equal values.

selenium comes firefox plugin generate code you. can replay test in browser or export them java code , make them part of test suite. selenium invaluable tool.

the drawback of using tool selenium application need deployed somewhere before can run test suite. may limitation if plan run automated tests generated using selenium.

if interested in testing database access code (dao, data access layer) dbunit perfect tool. generally, dbunit used initialize database tables before testing and, less often, run assertions on database content. dbunit uses xml based format represent data inserted database.

the xml files containing data pre-populate db triggered build script (ant, maven, etc.) or directly in unit test code. have used both approaches, depends on how code structured , how access database (hibernate, spring+hibernate, jdbc...).

if database not big, i'd recommend populate before running test suite. alternatively, can populate tables interested in testing prior every test.

here link unitils, additional library can used on top of dbunit simplify database testing strategy. think can used reference started: http://www.unitils.org/tutorial.html#database_testing

here anoter link (quite old, 2004) showing basic mechanics of dbunit:

http://onjava.com/pub/a/onjava/2004/01/21/dbunit.html


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -