javajdbcjmeter

Can JMeter be used to delete records from a database?


I've been working with JMeter to put together some integration tests for a set of Servlets that I'm working on. I've now got several test suites that exercise different scenarios and assert on the responses sent back by the servlets.

The problem I've now got is that the tests don't have a clean database to work from when they are run together, so they are polluting one another and failing.

The documentation suggests that a JDBC PostProcessor should be used to clean up the database after a test runs, however I can't see a way to write a delete statement that will clear the tables down.

Has anyone tried this before?


Solution

  • perhaps it's better to use a tearDown ThreadGroup. In that you can use any Sampler you wish. So you can use a JDBC Sampler to execute your DELETE Statement.

    http://jmeter.apache.org/usermanual/component_reference.html#tearDown_Thread_Group