CSC/ECE 517 Fall 2011/ch6 6f jd: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
 
(57 intermediate revisions by 2 users not shown)
Line 4: Line 4:


==Introduction==
==Introduction==
Continuous Integration [http://en.wikipedia.org/wiki/Continuous_integration (CI)] is a software development practice that is commonly used in [http://en.wikipedia.org/wiki/Agile_software_development Agile software development] methodology. <ref name="Agile">"Manifesto for Agile Software Development" http://www.agilemanifesto.org/</ref>Agile is a software development method based on iterative and incremental development. In principle, it works with small team, requires developers to deliver working code in short iterations, and uses Test Driven Development [http://en.wikipedia.org/wiki/Test-driven_development (TDD)], which requires developers to develop tests before writing code. Also it requires all the codes to be reviewed and tested continuously as the development goes, which is where CI fits in.


==What is CI?==
CI is used to ensure that all changes to a software project’s code are successfully built, tested, reported on, and rapidly made available to all parties after they are introduced. <ref name="CIRef1">Enterprise Solution Providers, Inc.  "Why and How to build a Continuous Integration Environment for the .NET platform" http://www.espusa.com/whitepapers/continuous_integration_v1.0.pdf</ref> It is aimed to deliver high quality software using the least amount of time, by applying quality control throughout the whole software development process. Without CI, there is no chance for Agile to succeed in delivering refined products in short release cycles.


==How does CI work?==
[[File:ContinuousIntegration.jpg|center]]


===Definitions===
The above diagram shows an overview of a simple CI environment, which will give us a good idea of how CI works. <ref name="CIRef2">Thomas Jaspers.  "Continuous Integration – Overview" http://blog.codecentric.de/en/2009/11/</ref>.In order to apply quality control throughout the project, CI requires members of the team integrate their work into the main code repository at least daily, which leads to multiple integrations per day. Each developer will first build and run all the tests locally to ensure all the changes are good, then commit the changes to the repository using some version control tools, such as Subversion. Once the CI sever detects the new commits, it will kick out an automated build that runs all the automated tests that could detect compile/integration errors as quickly as possible. If the automated build fails, the team will be notified and required to resolve the error immediately. In addition, at least once every 24 hours, a nightly build will be executed to ensure the quality of the code in the main repository. <ref name="CIRef5">Laurie Williams.  "Scrum + Engineering Practices: Experiences of Three Microsoft Teams" http://collaboration.csc.ncsu.edu/laurie/Papers/ESEM11_SCRUM_Experience_CameraReady.pdf</ref>
====Time To Response (TTR)====
Test-Driven Development (TDD) is the process of writing tests first and foremost.  These tests represent desired improvements and/or new functionality in the system.  Since these changes have yet to be implemented, the tests must fail when initially run. Then code is written until these tests can be passed, assuring that the desired behavior is exhibited by the code.  Finally the code is rewritten to meet acceptable standards.<br>
[[File:EC.jpg]]


====Time Between Failures (TBF)====
==Why Implement CI?==
Most of the major companies producing software for sale are in the business to make money. Companies have discovered that the best way to make money is decrease the number of defects going out to customers. Tons of research has been done on how to make quality software with fewer defects. The usual cost of fixing a defect slipping from one phase to next phase increases by ten times.  So for example if a defect cost $60 to fix during the coding phase will cost $600 if found during validation testing. Moreover if a defect is shipped along with the product to the customers it can certain times cost millions of dollars. Additionally these small defects can have big impact on company’s reputation. Below are some examples <ref name="Bugs">Top Ten Most Infamous Software Bugs Of All Time" http://able2know.org/topic/129489-1</ref>which shows how small defects when slipped or goes out undetected can cost millions of dollars.


==Continuous Integration (CI)==
# In 2007 a single faulty piece of embedded software, on a network card, sends out faulty data on the United States Customs and Border Protection network, bringing the entire system to a halt. Nobody is able to leave or enter the U.S. from the LA Airport for over eight hours. Over 17,000 planes were grounded for the duration of the outage resulting in millions of dollars in damage.
# A forgotten error handling statement which caused the famous ping of death also known as blue screen in 1995.  A lack of error handling in the IP fragmentation reassembly code makes it possible to crash many Windows, Macintosh, and Unix operating systems by sending a malformed “ping” packet from anywhere on the Internet.
# In 2004, EDS software giant introduced a large, complex IT system to the U.K.’s Child Support Agency (CSA). At the exact same time, the Department for Work and Pensions (DWP) decided to restructure the entire agency. The restructure and the new software were completely incompatible, and irreversible errors were introduced as a result. With over 500 bugs still reported as open in the new system, the clash of the two events has crippled the CSA’s network. As a result the system somehow managed to overpay 1.9 million people, underpay another 700,000, had $7 billion in uncollected child support payments, a backlog of 239,000 cases, 36,000 new cases “stuck” in the system, and has cost the UK taxpayers over $1 billion to date.


==Agile Project Development with CI==
The above examples show why testing phase is as important as coding phase. The more you test the better the software becomes as fewer and fewer defects are found. Below are some of the reasons why big companies are leaning more towards adopting agile and CI for software development.
# Many developers work on a software through multiple agile teams. Though the focus of each agile team is a specific module of the software but it is important to make sure the overall integrity of the system is always correct.
# One of the main benefits of agile project development is to have a shippable product at the end of each sprint<ref name="Ready Product">Why Continuous Integration?" http://www.cavdar.net/2009/03/07/why-continuous-integration/</ref>. If testing is kept until the end than you can’t have a shippable product at the end of each sprint. You have to have some automated testing that can test this functionality on daily basis.
# The other problem that used to occur by following traditional software development was that management did not know the exact status of the product which includes the number of bugs in the system until the validation phase. This can cause problem in releasing software on time. CI gives an option to generate various reports to solve these kinds of problems and to give management early indication if the product release can be done on time.
# The main reason for using CI is to cut down on validation cost by finding the bugs early during coding phase.
# CI infrastructure provides way to decrease Time to Response [http://en.wikipedia.org/wiki/Response_time_(technology) (TTR)] for fixing defects.
# Additionally some CI infrastructure provides valuable tools like build management and build acceleration. With build acceleration developers and QA do not have to wait long periods to get a completed builds. Build acceleration decreases the build time by performing non-dependent tasks in parallel resulting in increased productivity.


==Why Implement CI?==
==CI Setup and Reporting==
There are lots of different ways continuous integration can be incorporated with a software product development. The level of automation varies by project to project. Some project might be able to achieve complete automation and continuous integration whereas some project can be restricted by the testing infrastructure. For example when making a software for say airplane controls there is only limited amount of automated testing that you can do to test. It requires some level of manual steps. Whereas for computer application like word you can automate the testing and can achieve 100% continuous integration.
 
There are many different kinds of software that are available out there for implementing continuous integration within a software project. Some of the software includes Electric Commander<ref name="EC">Electric Commander" http://www.electriccloud.com/</ref> by [http://en.wikipedia.org/wiki/Electric_Cloud Electric Cloud], CI server by Hudson, and Team Foundation Server, [http://www.microsoft.com/visualstudio/en-us/scenarios/virtual-lab-management Lab Management], Test Manager by Microsoft.  All of the software listed above can be used as the backbone for setting up the CI infrastructure. Additionally, different reporting services can also be added to achieve additional goals. Below are the usual steps that are performed once the CI infrastructure is incorporated.
 
 
 
[[File:EC.jpg|center]]
 
 
 
# Whenever the new code or functionality is checked into the repository an automated build process is started.
# Once the product is build unit tests are executed to make sure all the unit tests are passing and that the new functionality has not broken the old functionality. Reports are generated for the results.
# Once unit test are completed and passed automated smoke tests are performed. The application is usually deployed on a remote machine as a fresh copy and the system testing is performed. Reports are generated for the results.
# Then additional reporting are performed on the code to see it the code has fulfilled the required criteria (For example, code coverage > 90%, code complexity, Dead code, Duplicate code, Coding standard enforcement)
# Lastly, when all the 4 steps above are passed additional matrix is generated for management to see. For example TTR to fix a bug, Time between Failures (TBF), Error counts, and Warning reports.
 
If any of the above steps fail an automated email is generated and send to targeted user to notify that the new code submitted to the repository needs to be fixed. In this way teams can achieve that quick response instead of waiting to hear from validation team which can take days compared to minutes through CI.
 
===CI Reporting Metrics===
The team can also generate reports that indicate the overall health of the application on the CI environment. This application health can be measured by the CI reporting metrics. Some examples of these metrics are shown below:<ref name="CIRef6">Designing data warehouse for equipment management system" http://www.tandfonline.com/doi/abs/10.1080/00207540701222776?journalCode=tprs20#preview</ref>
 
#'''Time To Response (TTR):''' the elapsed time to fix the most recent broken build
#'''Time Between Failures (TBF):''' the elapsed time between consecutive breakages (non-zero errors) of the same build
#'''Unit Test Count:''' the total number of unit tests on each automated build
#'''Unit Test Passed Count:''' the total number of unit tests that are passed on each automated build
#'''Unit Test Covered Lines:''' the count of the non-commented source lines scanned by the coverage tool that are exercised by statement-level automated unit testing on each automated build
#'''Validation Test Count:''' the total number of validation tests on each automated build
#'''Validation Test Passed Count:''' the total number of validation tests that are passed on each automated build
#'''Error Count:''' the total number of errors occurs on each automated build
#'''Warning Count:''' the total number of warnings occurs on each automated build
#'''Code Base Size:''' the total lines of code of the overall organization <ref name="CIRef7">Code base size, complexity and language choice" http://ayende.com/blog/3070/code-base-size-complexity-and-language-choice</ref>
 
These reporting metrics provide a way to improve the transparency of the project. It helps the team to understand the build, design, and code quality of the overall application; it helps us understand the trend of development process, and eliminate defects before introduction; it also helps developers to understand their individual impact to the project, and improve personal performance.
 
==Advantages and Disadvantages==
===Advantages===
Continuous Integration has the following advantages:<ref name="CIRef1"></ref><ref name="wiki">Wikipedia "Continuous integration" http://en.wikipedia.org/wiki/Continuous_integration</ref>
*Early warning of broken/incompatible code and conflicting changes
*Guarantees successfully compiled software
*Visible program reporting and problem tracking
*Easy to revert the code base to bug-free state
*Reduce development integration effort
*Immediate unit testing for all changes
*Constant availability of functioning code for demo or release purposes
*High impact environment upgrade with low maintenance
*Help developers to understand their individual impact to project, and improve their personal performance
===Disadvantages===
Continuous Integration has the following disadvantages:<ref name="CIRef1"></ref><ref name="wiki"></ref>
*Migration of internal development projects into a CI environment requires a lot of initial setup time and tight planning
*Well-developed test-suite is required for the automated build
*Costs for CI building machines
*Requires a good understanding of CI and discretion when setting up projects


==CI Setup and Reporting==
Assuming that the CI environment is configured the way it supposes to be, it doesn’t matter how experienced the developer is, once he/she understands how to build and commit code he/she will be always benefited from it. For example, they can find out immediately if the build is broken after they commit the code, and learn how to write high-quality code.


==Conclusion==
==Conclusion==
 
In the end continuous integration infrastructure provides that platform for big companies to produce software that is cost effective and profitable with less defects. Combining it with the agile software development methodologies makes sense as it gives big companies options to have shippable product that is well tested at the end of each sprint. Moreover CI also solves the overall integration problem of big software projects were small teams are working individually on small components that includes open source third party software by testing overall system functionality daily. The above reasoning shows why big companies that are adopting agile as their main software development strategy more than often also adopts continuous integration as their system and component integration and testing infrastructure.


==References==
==References==
 
<references/>
* [1] Software Bugs [http://able2know.org/topic/129489-1 Top Ten Software Bugs]
* [2] Electric Cloud [http://www.electriccloud.com/ Electric Commander]


==Expand your knowledge==
==Expand your knowledge==
* Continuous Integration wikipedia [http://en.wikipedia.org/wiki/Continuous_integration CI]
* Continuous Integration Wikipedia [http://en.wikipedia.org/wiki/Continuous_integration CI]
* Why Continuous Integration [http://www.espusa.com/whitepapers/continuous_integration_v1.0.pdf]

Latest revision as of 16:49, 22 November 2011

Continous Integration

Introduction

Continuous Integration (CI) is a software development practice that is commonly used in Agile software development methodology. <ref name="Agile">"Manifesto for Agile Software Development" http://www.agilemanifesto.org/</ref>Agile is a software development method based on iterative and incremental development. In principle, it works with small team, requires developers to deliver working code in short iterations, and uses Test Driven Development (TDD), which requires developers to develop tests before writing code. Also it requires all the codes to be reviewed and tested continuously as the development goes, which is where CI fits in.

What is CI?

CI is used to ensure that all changes to a software project’s code are successfully built, tested, reported on, and rapidly made available to all parties after they are introduced. <ref name="CIRef1">Enterprise Solution Providers, Inc. "Why and How to build a Continuous Integration Environment for the .NET platform" http://www.espusa.com/whitepapers/continuous_integration_v1.0.pdf</ref> It is aimed to deliver high quality software using the least amount of time, by applying quality control throughout the whole software development process. Without CI, there is no chance for Agile to succeed in delivering refined products in short release cycles.

How does CI work?

The above diagram shows an overview of a simple CI environment, which will give us a good idea of how CI works. <ref name="CIRef2">Thomas Jaspers. "Continuous Integration – Overview" http://blog.codecentric.de/en/2009/11/</ref>.In order to apply quality control throughout the project, CI requires members of the team integrate their work into the main code repository at least daily, which leads to multiple integrations per day. Each developer will first build and run all the tests locally to ensure all the changes are good, then commit the changes to the repository using some version control tools, such as Subversion. Once the CI sever detects the new commits, it will kick out an automated build that runs all the automated tests that could detect compile/integration errors as quickly as possible. If the automated build fails, the team will be notified and required to resolve the error immediately. In addition, at least once every 24 hours, a nightly build will be executed to ensure the quality of the code in the main repository. <ref name="CIRef5">Laurie Williams. "Scrum + Engineering Practices: Experiences of Three Microsoft Teams" http://collaboration.csc.ncsu.edu/laurie/Papers/ESEM11_SCRUM_Experience_CameraReady.pdf</ref>

Why Implement CI?

Most of the major companies producing software for sale are in the business to make money. Companies have discovered that the best way to make money is decrease the number of defects going out to customers. Tons of research has been done on how to make quality software with fewer defects. The usual cost of fixing a defect slipping from one phase to next phase increases by ten times. So for example if a defect cost $60 to fix during the coding phase will cost $600 if found during validation testing. Moreover if a defect is shipped along with the product to the customers it can certain times cost millions of dollars. Additionally these small defects can have big impact on company’s reputation. Below are some examples <ref name="Bugs">Top Ten Most Infamous Software Bugs Of All Time" http://able2know.org/topic/129489-1</ref>which shows how small defects when slipped or goes out undetected can cost millions of dollars.

  1. In 2007 a single faulty piece of embedded software, on a network card, sends out faulty data on the United States Customs and Border Protection network, bringing the entire system to a halt. Nobody is able to leave or enter the U.S. from the LA Airport for over eight hours. Over 17,000 planes were grounded for the duration of the outage resulting in millions of dollars in damage.
  2. A forgotten error handling statement which caused the famous ping of death also known as blue screen in 1995. A lack of error handling in the IP fragmentation reassembly code makes it possible to crash many Windows, Macintosh, and Unix operating systems by sending a malformed “ping” packet from anywhere on the Internet.
  3. In 2004, EDS software giant introduced a large, complex IT system to the U.K.’s Child Support Agency (CSA). At the exact same time, the Department for Work and Pensions (DWP) decided to restructure the entire agency. The restructure and the new software were completely incompatible, and irreversible errors were introduced as a result. With over 500 bugs still reported as open in the new system, the clash of the two events has crippled the CSA’s network. As a result the system somehow managed to overpay 1.9 million people, underpay another 700,000, had $7 billion in uncollected child support payments, a backlog of 239,000 cases, 36,000 new cases “stuck” in the system, and has cost the UK taxpayers over $1 billion to date.

The above examples show why testing phase is as important as coding phase. The more you test the better the software becomes as fewer and fewer defects are found. Below are some of the reasons why big companies are leaning more towards adopting agile and CI for software development.

  1. Many developers work on a software through multiple agile teams. Though the focus of each agile team is a specific module of the software but it is important to make sure the overall integrity of the system is always correct.
  2. One of the main benefits of agile project development is to have a shippable product at the end of each sprint<ref name="Ready Product">Why Continuous Integration?" http://www.cavdar.net/2009/03/07/why-continuous-integration/</ref>. If testing is kept until the end than you can’t have a shippable product at the end of each sprint. You have to have some automated testing that can test this functionality on daily basis.
  3. The other problem that used to occur by following traditional software development was that management did not know the exact status of the product which includes the number of bugs in the system until the validation phase. This can cause problem in releasing software on time. CI gives an option to generate various reports to solve these kinds of problems and to give management early indication if the product release can be done on time.
  4. The main reason for using CI is to cut down on validation cost by finding the bugs early during coding phase.
  5. CI infrastructure provides way to decrease Time to Response (TTR) for fixing defects.
  6. Additionally some CI infrastructure provides valuable tools like build management and build acceleration. With build acceleration developers and QA do not have to wait long periods to get a completed builds. Build acceleration decreases the build time by performing non-dependent tasks in parallel resulting in increased productivity.

CI Setup and Reporting

There are lots of different ways continuous integration can be incorporated with a software product development. The level of automation varies by project to project. Some project might be able to achieve complete automation and continuous integration whereas some project can be restricted by the testing infrastructure. For example when making a software for say airplane controls there is only limited amount of automated testing that you can do to test. It requires some level of manual steps. Whereas for computer application like word you can automate the testing and can achieve 100% continuous integration.

There are many different kinds of software that are available out there for implementing continuous integration within a software project. Some of the software includes Electric Commander<ref name="EC">Electric Commander" http://www.electriccloud.com/</ref> by Electric Cloud, CI server by Hudson, and Team Foundation Server, Lab Management, Test Manager by Microsoft. All of the software listed above can be used as the backbone for setting up the CI infrastructure. Additionally, different reporting services can also be added to achieve additional goals. Below are the usual steps that are performed once the CI infrastructure is incorporated.



  1. Whenever the new code or functionality is checked into the repository an automated build process is started.
  2. Once the product is build unit tests are executed to make sure all the unit tests are passing and that the new functionality has not broken the old functionality. Reports are generated for the results.
  3. Once unit test are completed and passed automated smoke tests are performed. The application is usually deployed on a remote machine as a fresh copy and the system testing is performed. Reports are generated for the results.
  4. Then additional reporting are performed on the code to see it the code has fulfilled the required criteria (For example, code coverage > 90%, code complexity, Dead code, Duplicate code, Coding standard enforcement)
  5. Lastly, when all the 4 steps above are passed additional matrix is generated for management to see. For example TTR to fix a bug, Time between Failures (TBF), Error counts, and Warning reports.

If any of the above steps fail an automated email is generated and send to targeted user to notify that the new code submitted to the repository needs to be fixed. In this way teams can achieve that quick response instead of waiting to hear from validation team which can take days compared to minutes through CI.

CI Reporting Metrics

The team can also generate reports that indicate the overall health of the application on the CI environment. This application health can be measured by the CI reporting metrics. Some examples of these metrics are shown below:<ref name="CIRef6">Designing data warehouse for equipment management system" http://www.tandfonline.com/doi/abs/10.1080/00207540701222776?journalCode=tprs20#preview</ref>

  1. Time To Response (TTR): the elapsed time to fix the most recent broken build
  2. Time Between Failures (TBF): the elapsed time between consecutive breakages (non-zero errors) of the same build
  3. Unit Test Count: the total number of unit tests on each automated build
  4. Unit Test Passed Count: the total number of unit tests that are passed on each automated build
  5. Unit Test Covered Lines: the count of the non-commented source lines scanned by the coverage tool that are exercised by statement-level automated unit testing on each automated build
  6. Validation Test Count: the total number of validation tests on each automated build
  7. Validation Test Passed Count: the total number of validation tests that are passed on each automated build
  8. Error Count: the total number of errors occurs on each automated build
  9. Warning Count: the total number of warnings occurs on each automated build
  10. Code Base Size: the total lines of code of the overall organization <ref name="CIRef7">Code base size, complexity and language choice" http://ayende.com/blog/3070/code-base-size-complexity-and-language-choice</ref>

These reporting metrics provide a way to improve the transparency of the project. It helps the team to understand the build, design, and code quality of the overall application; it helps us understand the trend of development process, and eliminate defects before introduction; it also helps developers to understand their individual impact to the project, and improve personal performance.

Advantages and Disadvantages

Advantages

Continuous Integration has the following advantages:<ref name="CIRef1"></ref><ref name="wiki">Wikipedia "Continuous integration" http://en.wikipedia.org/wiki/Continuous_integration</ref>

  • Early warning of broken/incompatible code and conflicting changes
  • Guarantees successfully compiled software
  • Visible program reporting and problem tracking
  • Easy to revert the code base to bug-free state
  • Reduce development integration effort
  • Immediate unit testing for all changes
  • Constant availability of functioning code for demo or release purposes
  • High impact environment upgrade with low maintenance
  • Help developers to understand their individual impact to project, and improve their personal performance

Disadvantages

Continuous Integration has the following disadvantages:<ref name="CIRef1"></ref><ref name="wiki"></ref>

  • Migration of internal development projects into a CI environment requires a lot of initial setup time and tight planning
  • Well-developed test-suite is required for the automated build
  • Costs for CI building machines
  • Requires a good understanding of CI and discretion when setting up projects

Assuming that the CI environment is configured the way it supposes to be, it doesn’t matter how experienced the developer is, once he/she understands how to build and commit code he/she will be always benefited from it. For example, they can find out immediately if the build is broken after they commit the code, and learn how to write high-quality code.

Conclusion

In the end continuous integration infrastructure provides that platform for big companies to produce software that is cost effective and profitable with less defects. Combining it with the agile software development methodologies makes sense as it gives big companies options to have shippable product that is well tested at the end of each sprint. Moreover CI also solves the overall integration problem of big software projects were small teams are working individually on small components that includes open source third party software by testing overall system functionality daily. The above reasoning shows why big companies that are adopting agile as their main software development strategy more than often also adopts continuous integration as their system and component integration and testing infrastructure.

References

<references/>

Expand your knowledge

  • Continuous Integration Wikipedia CI
  • Why Continuous Integration [1]