I am creating several test forests around an existing project. This includes some integration tests using JUnit and DbUnit. I also installed a Jenkins installation for continuous integration.
My problem is related to changing database connections between development and testing environments. I have my own product stack installed locally for quick ad hoc testing and research. When I develop, I run tests against my private database, since it is faster, and I will not destroy anyone else with a work in progress code error.
Once the code is verified, Jenkins will run my tests. Now it still points to my local dB. I would prefer Jenkins to run tests against another database that is in a test environment.
Is there a best practice / strategy / technology / etc. to change database connections for testing without having to change code? Bonus points if the solution allows Jenkins to run the same tests with multiple databases (should be possible because DbUnit is agnostic).
Editing for more information:
The product is large, with dozens of different interacting components (usually in separate vms / processes). In a living system, different processes are usually linked through a database . IE, a user interface process writes changes to a table, and internal process requests process this table for changes. Yes, that’s terrible. To test the integration, I configure the system using the user interface and fix this state with DbUnit. Then I can run tests against this "input".
maven. DB . DbUnit ; , , , , Jenkins .