1 / 13

Preventing Bugs with Unit Testing Chapter 5 - Coder to Developer by Mike Gunderloy

Preventing Bugs with Unit Testing Chapter 5 - Coder to Developer by Mike Gunderloy Instructor : Dr.James Fawcett Presented by Priyaa Nachimuthu priyaa@syr.edu. Agenda. Types of Testing Testing for Developers Unit Testing Using NUnit

vinaya
Download Presentation

Preventing Bugs with Unit Testing Chapter 5 - Coder to Developer by Mike Gunderloy

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Preventing Bugs with Unit Testing Chapter 5 - Coder to Developer by Mike Gunderloy Instructor : Dr.James Fawcett Presented by Priyaa Nachimuthu priyaa@syr.edu

  2. Agenda • Types of Testing • Testing for Developers • Unit Testing • Using NUnit • Test – Driven Development • Refactoring • Unit Testing Summary

  3. Types of Testing • Unit Testing – testing very small pieces of code • Integration Testing - code doesn't break someone else’s code • System Testing – exercising the entire application to make it fail • Stress Testing – push the limits of the application until it fails • Beta Testing – giving copies of the unfinished code to outside testers for feedback • Acceptance Testing – formal verification of requirements

  4. Testing for Developers • Check out the module • Write the code for the next feature to be implemented • Write unit tests to test the feature • Ensure that the code passes the unit tests • Get the latest code for the entire application • Make sure the whole project passes the integration tests • Check in code and unit tests

  5. Unit Testing • JUnit – by Erich Gamma and Kent Beck for Java development • NUnit – free, open source framework, a .Net unit testing tool.NUnitAddin,TestRunner for NUnit integrates NUnit with VS.Net.NUnitAsp supports NUnit testing of ASP. Net pages. ( http://nunit.org ) • csUnit – free, open-source implementation. Additional features, includes project wizards to build new testing projects easily and a UI with more information. ( http://csunit.org ) • HarnessIt - $199.Pluaggable test engine architecture. Easy testing of web and remote applications using the same tools as local windows applications.( www.unittesting.com/default.aspx ) • X-Unity - $129.VS.Net integration, a development kit for unit tests, and integration ( http://x-unity.miik.com.ua/ ) • .TEST - $900.Writes many unit tests for the user. Uses rules-based engine to ensure code correctness and allows the user to write custom tests.( www.parasoft.com/jsp/products/home.jsp?product=TestNet )

  6. Using NUnit for Unit Testing • A simple test • Debugging NUnit tests • Testing an exception • Testing with mock objects

  7. Test Driven Development • A new testing technique by advocates of Extreme Programming. • Introduction to TDD : “Test-Driven Development” by Kent Beck. • Two simple rules - Write a failing automated test before writing any code - Remove duplication

  8. TDD – Plan of Action • Quickly add a test • Run all tests and see the new one fail • Make a little change • Run all tests and see them all succeed • Refactor to remove duplication

  9. TDD in Action • Code Sample

  10. Refactoring • Martin Fowler’s Refactoring : Improving the Design of the existing Code • The process of changing a software system in such a way that it doesn't alter the external behavior of the code yet improves its internal structure. • Refactoring patterns • Code Thrashing – developers with different ideas

  11. Refactoring Tools • dotEasy – free ( www.doteasy.com.uy/ ) • The C# Refactoring Tool - $110 ( http://dotnetrefactoring.com/ ) • C# Refactory - $99 ( www.xtreme-simplicity.net/CSharpReFactory.html ) • FlyWheel - $449 ( www.velocitis.com/ )

  12. Unit Testing Checklist • Write unit tests for all code • Don’t postpone the tests • Ensure that the code passes unit tests and integration tests before check-ins • Use automated tools such as NUnit • Check the tests and any other setup files into SCC • Consider using TDD for 100% coverage • Refactor code only when there are thorough set of tests for the code

  13. Thank you!

More Related