Make sure test projects are built before testing

Fix #640.