Add test for incremental build, refactor test code