Can JMeter be used to delete records from a databa

2019-07-24 12:10发布

问题:

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?

回答1:

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



回答2:

You must choose Callable Statement in JDBC Request as delete from Stocks where StockIdent=1



标签: java jdbc jmeter