A simple scenario:
- 2 projects are in version control
- The application
- The test(s)
- A significant number of checkins are made to the application daily.
- CI builds and runs all of the automation nightly.
In order to write and/or run tests you need to have built the application (to reference/load instrumented assemblies). Now, consider the application to be massive, such that building it is prohibitive in time (an entire day to compile). The obvious side effect here, is that once you’ve performed a build locally, it is immediately inconsistent with latest.
For instance:
If I were to sync with latest, and open up one of the test projects, it would not locally build until I built the application. This is the same when syncing to another branch/build/tag. So, in order to even start working, I need to wait a day to build the application locally, so that the assemblies could be loaded – and then those assemblies wouldn’t be latest.
How do you organize the repository or (ideally) your development environment such that you can continually develop tests against whatever the current build is, or a given specific build, while minimizing building the application as much as possible?
2
On a side, FIX YOUR BUILDTIME!! This is fighting symptoms not the core problem!
Your tests should come together with your code, as in the same repository. Whenever you build the tests are build also. When you run the tests it of the same generation as the code it runs against.
You check out code to build, this checkout includes the tests. These tests you run.
Again don’t waste spending time trying to build less often. If it hurts do it more often! Break up the monolith, get a handle on dependencies. Use your build system to help you not touch/rebuild unchanged stuff. You need to modularize for this. Dependency inversion helps a lot here.
Package repositories like Artifactory and package management systems like Ivy and NuGet are good answers to this sort of problem. Build the packages you want to build, download the rest through a local-hard-drive cache of current versions, and you’re good to go.