TDD & Continuous Integration with Jenkins
Test-Driven Development (TDD) is a software engineering technique in which the tests are written prior to the source code. It is proposed that TDD is one of the most fundamental practices enabling the development of software in an agile and iterative manner. Both the literature and practice suggest that TDD practice yields several benefits. Essentially, it is claimed that TDD leads to an improved software design, which has a dramatic impact on the maintainability and further development of the system. In TDD unit testing is repeatedly done on source code.
The concept is to “get something working now and perfect it later.”
After each test, refactoring is done and then the same or a similar test is performed again.The process is iterated as many times as necessary until each unit is functioning according to the desired specifications.
The methodical nature of TDD ensures that all the units in an application have been tested for optimum functionality, both individually and in synergy with one another. Because tests are conducted from the very beginning of the design cycle, time and money spent in debugging at later stages is minimized.
The technologies available today allow the recording of test batteries that guarantee the quality of software product, by automatically running at any change of the application.
One of the chief limitations of TDD is the fact that tests can sometimes be incorrectly conceived or applied. This may result in units that do not perform as expected in the real world. Even if all the units work perfectly in isolation and in all anticipated scenarios, end users may encounter situations not imagined by the developers and testers. The final results of TDD are only as good as the tests that have been used, the thoroughness with which they have been done and the extent to which they mimic conditions encountered by users of the final product.
Continuous Integration and Continuous Delivery with Jenkins
Continuous Integration, in its simplest form, involves a tool that monitors your version control system for changes. Whenever a change is detected, this tool automatically compiles and tests your application. If something goes wrong, the tool immediately notifies the developers so that they can fix the issue immediately.
With Continuous Delivery, any and every successful build that has passed all the relevant automated tests and quality gates can be deployed into production via a fully automated one-click process, and be in the hands of the end-users within minutes.
Jenkins, originally called Hudson, is an open source Continuous Integration tool written in java. Continuous Integration (CI) server was created to manage and control development life-cycle processes of all kinds, including build, document, test, package, static analysis and many more. Jenkins is able to watch for any code changes in places like SVN and Git and automatically do a build with tools like Ant and Maven, initiate tests and then take actions like rolling back or rolling forward. Jenkins schedules, monitors and manages externally-run jobs as well and can even handle operations on a remote machine. The tool immediately informs you if something goes wrong, so you can fix the problem right away. As an easy-to-use continuous integration system, Jenkins lets you easily integrate changes to a software project and then automatically initiate a fresh build. By integrating changes as soon as they’re ready, you’ll find problems sooner, reduce integration conflicts and ensure you always have a working build.
RCP Vision adopts daily techniques and technologies for TDD and Continuous Integration. Thanks to the adoption of these tools, the quality of our software is constantly monitored and guaranteed and we are able to monitor and share with our customers on the state of progress of their projects with precision and ease. A closer look at the implemented TDD process we follow:
- The developer writes a failing test, writes the code to pass the test and refactors as necessary.
- Once the developer completes the business features, all necessary unit or integration tests are executed.
- A peer code review is performed starting with the tests. This review process helps ensure that no requirements were overlooked and the code meets the team’s design standards.
- The code is then committed to the source control management system and is merged into the code base.
- The continuous integration server detects the code commit and begins its compilation workflow:
- The latest source is retrieved and compiled from the source control management system.
- All Unit and Integration tests are executed and the results are published.
- The compiled source is deployed to a development/staging area.
- Finally, to make the overall process transparent and visible, a custom-built dashboard displays the results of the entire process, giving the development team immediate visibility into build quality.
For more information, send an email to email@example.com