What Is Unit Testing? Testing done by developers during and after code construction. Could be of type: 1- White Box 2- Black Box
More Explanation: Unit testing is a development procedure where programmers create tests as they develop software. The tests are simple short tests that test functionality of a particular unit or module of their code, such as a “class” or “function”. Using open source libraries like cunit, cppunit and nunit (for C, C++ and C#) these tests can be automatically run and any problems found quickly. As the tests are developed in parallel with the source code, when the particular unit is completed, a successful unit test demonstrates its correctness.
Why Unit Test? Reveals bugs that may escape “black box” testing Simplifies Integration Facilitates Change Documentation Encourages good design, such as separation of interface from implementation
The Why, The What, The How It has to do with Quality! Your software has to meet customer requirements functional and non-functional requirements How do you ensure that your software does what it should?
The Why, The What, The How It has to do with Safety! You often have to change your existing code because of new requirements, improvements, and bug fixes How do you ensure, that your changed software still does what it did before?
The Why, The What, The How It has to do with Sustainability! You still have to fix bugs How do you ensure, that a fixed bug nevershows up again?
The Why, The What, The HowYou have to show that The product works as expected But also its individual parts, like services components classes methods
The Why, The What, The How You can do this manually Writing test specifications and protocols Or (much better) automated Let the system do it for you (at least part of it)
Best Practices:Have a Process and Stick to It! Have a process Any process is better than none Make sure it is not “shelfware” ALL processes say you should unit test (they’re just not that specific about how) Developers should feel the process is helping, not hindering them Managers should support the team and the process
Best Practices:Test Early and Test Often Consider writing the tests first (Test-Driven Development) Start testing as soon as you start writing the code (if not before) Make sure the tests are run frequently The earlier you know about a problem the earlier you can fix it
Best Practices:Refactor, Refactor, Refactor Avoid complexity Break large classes into smaller ones Break large methods into smaller ones Simplifying the code makes it easier to understand.
Best Practices:Use “Extreme Feedback” Try to fix bugs as soon as they are identified If not possible, make a plan for when to fix “Don’t live with Broken Windows” If you can’t measure you can’t manage it If you can’t manage it, you can’t improve it
Web UI issue - screen 1Issue: Menu’s are Not displayed in single line and Text is displayed out ofBanner.Mockup Screen is at Next Slide…
Cross Browser Issue:TinyMCE Editor is Not displayed correctly in IE, working fine in others.
Mobile App UI issue 1Issue:First Alphabet is Notcapital in “Cancel”button text.
Mobile App UI issue 2Issue:Text alignment is Notcorrect with screen.
Mobile App UI issue 3Issue:Buttons are NotCentrally aligned withScreen.
Enhancement Unit Testing IssueEnhancement: Display company introduction video at Job Board.Issue: Video is displayed but other sections that were visible before this change are Not visible now.See the Job Board screen before this change on Next Slide…
Unit Testing Checklists (Mobile App & Website)
Unit Testing Checklist - Mobile Application (I-Phone/I-Pod Devices, Android Device, Windows Phone, Blackberry, Symbian OS)Generic Testing: Yes No N/ADoes the page layout consistent from page to page according to the mockups/PSDs?Functional Testing:Does App Installation & Un-installation working correctly?GUI & Usability Testing:Navigation to Screens working fine?Page Scrolling working fine?Compliance/Compatibility Testing:Verify the Behavior of Mobile App in Low resources (Memory/Space)?Web Services/Backend Testing:Connection with DB is made successfully through web service?Data successfully Posted through web services?See the full checklist available at below Engineering Wiki link:https://sites.google.com/a/confiz.com/software-engineering/guides/unit-test-check-list?pli=1
Unit Testing Checklist - WebsiteGeneric Testing: Yes No N/ADoes the page layout consistent from page to page according to the mockups/PSDs?Functional Testing:Check that all the links under Main Menu’s are working properly?Check that all the Header or Footer links are working properly?GUI & Usability Testing:Does all text properly aligned?Does all graphics properly aligned?Compliance/Compatibility Testing:Does all supported browsers been tested?Does the HTML version being used compatible with appropriate browser versions?Web Services/Backend Testing:Connection with DB is made successfully through web service?See the full checklist available at below Engineering Wiki link:https://sites.google.com/a/confiz.com/software-engineering/guides/unit-test-check-list?pli=1