Book Image

Jenkins Continuous Integration Cookbook

By : Alan Mark Berg
Book Image

Jenkins Continuous Integration Cookbook

By: Alan Mark Berg

Overview of this book

<p>Jenkins is a highly popular continuous integration server. Its correct use supports a quality software development process. Jenkins is great at finding issues in software early and communicating it to a wide audience. Jenkins is also easily extendable with a simple framework for writing plugins. Currently there are over 400 plugins available for inclusion.<br /><br /><em>Jenkins Continuous Integration Cookbook</em> has over 80 recipes describing practical ways to use Jenkins and expanding its feature set by selective use of the best of breed plugins. Jenkins has a simple framework for writing plugins. There are over 400 plugins available. Therefore, it is easy to get lost in possibilities. Using practical recipes, this book will guide you through the complexities. The recipes are bundled into themes including security, maintainability, communication, building software, the valid use of code metrics, testing remotely, and writing your first plugin.<br /><br /><em>Jenkins Continuous Integration Cookbook</em> includes problem solving and how to do recipes for many common and less common tasks. A wide range of topics are covered from integrating, securing, and maintaining Jenkins in your organization to writing your first extension.<br /><br />The book begins with common maintenance tasks followed by securing Jenkins and enabling SSO. Then it explores the relationship between Jenkins builds and the Maven pom.xml. You will then learn ways to effectively communicate with various target audiences (developers, project managers, the public). You will then explore source code metrics with related recipes, and set up and run remote stress and functional tests. The book finally lists a series of 11 interesting plugins with a concluding recipe on how to create your first plugin.<br /><br /><em>Jenkins Continuous Integration Cookbook</em> describes solutions and optimizations to problems commonly found.</p>
Table of Contents (15 chapters)
Jenkins Continuous Integration Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Considering test automation as a software project


If you see automated testing as a software project and apply well-known principles, then you will save on maintenance costs and increase the reliability of tests.

The Don't Repeat Yourself (DRY) principle is a great example. Under time pressure, it is tempting to cut-and-paste similar tests from one area of the code base to another DON'T. Projects evolve bending the shape of the code base, and the tests need to be re-usable to adapt to that change. Fragile tests push up maintenance costs. One concrete example discussed briefly in Chapter 6, Testing Remotely is the use of page objects with Selenium Webdriver. If you separate the code into pages, then when the workflow between pages changes, most of the testing code remains intact.

See the Activating more PMD rulesets recipe in Chapter 5, Using Metrics to Improve Quality.

The Keep It Simple Stupid (KISS) principle implies keeping every aspect of the project as simple as possible. For example, it is possible to use real browsers for automated functional tests or use the HtmlUnit framework to simulate a browser. The second choice avoids the need to set up an in-memory X server (or VNC— http://en.wikipedia.org/wiki/Virtual_Network_Computing) and will also keep a track of browser versioning. These extra chores decrease the reliability of running a Jenkins Job, but do increase the value of the tests. Therefore, for small projects, consider starting with HtmlUnit. For larger projects, the extra effort is worth the cost.

See the Triggering failsafe integration tests with Selenium Webdriver recipe in Chapter 3, Building Software.

Consider if you need a standalone integration server or if you can get away with using a Jetty server called during the integration goal in Maven. For an example recipe, see the Configuring Jetty for integration tests recipe in Chapter 3, Building Software.