Testing Batch API usage with Simpletest
Running batch API in tests should work just fine, although there is an issue with the testbot.

Make sure you are always using curly braces for your tables, that's the usual issue when something like this happens. So for example SELECT * FROM {node}.

Edit: 

Two things wrong with your code, as written in the comments.


You are not calling batch_process() in your code, so the batch is never executed within the tests.
My initial answer was not 100% correct. You can not trigger batch runs directly within your test code. A batch requires direct interaction with the browser and it is not possible to run tested batches (simpletest is already running as a batch run). What you need to do is create a test module, implement hook_menu() with a page callback and then call batch_set()/batch_process() there.