Use Continuous Integration

Automating your build locally with a build tool is really a good start. You can run your tests and build executables whenever you want locally on your developer machine. But in a real development environment, you’ll want more. That’s where Continuous Integration [DMG07] comes in.

When you make a code change locally, of course you should run unit tests to make sure you didn’t break anything before you commit it to version control. But in an enterprise project, the complete set of tests can be huge, and building a fully integrated executable can take a long time. We’re talking about several minutes here, even hours, and that’s not a process you want to trigger for every small code change on your machine.

On top of that, we’ve told you to Use Static Code Analysis Tools. Those tools all operate on a code base and show you potential issues in it. You might fix some issues directly and just ignore false positives. What you’re most interested in is how your last changes affect code quality. Did you introduce new issues that weren’t there before?

All of these things—extensive testing, integration, and code quality checks—can be outsourced to dedicated machines: continuous integration servers. The idea behind it all is very simple: for every commit to the version control system, a dedicated server pulls all code, executes all tests, and builds a fully integrated executable. It runs code quality checks and compares the results to the data from the commits before, thereby building a timeline for the quality of your code. That way, it’s easy to make sure that your project is always buildable and quality doesn’t go down.

There are many different tools you can use here. On your own server, you can install Jenkins,[60] one of the most popular continuous integration systems in the Java world. It can run your tests, and there are many plugins for quality checks. But you can also use a dedicated quality analysis server. Here, the market leader is SonarQube,[61] which you can host yourself or use their cloud solution. That last point is interesting. Many cloud services that you can use for testing and quality analysis, such as Travis CI[62] or Codacy,[63] are available. They’re handy if your code is open source.

But just building and testing your software isn’t all. You also have to deliver.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.148.117.212