Automate tests

- automate 3 TCMS tests
- purge lucene index after deleting test data
- refactor some tests to make it more elegant