More testing

I've added a base class for the jobqueue tests and moved duplicated code there.

I've removed starting the jobqueue in a separate thread and added a script to start the jobqueue, run the tests and then stop the jobqueue.