Improve integration tests

Ref #1148.