Refactor integration tests and add some more for issue #29