370 likes | 490 Views
Unit Testing and Continuous Integration in context of IFDK reference product. About this course material. This material if for general training for Test Design and management Material is more supportive in class room Material will be updated during courses
E N D
UnitTesting and ContinuousIntegration in context of IFDK referenceproduct
About this course material • This material if for general training for Test Design and management • Material is more supportive in class room • Material will be updated during courses • FreeNest Portable Project Platform is used to demonstrate things only in practice. This is not limiting usage for material for other training environments (I hope ) Aboutmaterial
Unit/Module/Component Testing Product VALIDATION Customer/Business Requirements Acceptance Testing System Requirements Architecture& Design& Implementation System Testing Sub System Requirements Integration Testing Component Requirements Component / Unit Testing VERIFICATION Yläotsikko
How to Test? What should be tested? How ?
How to verify component implementation -Unit Testing -StaticAnalyze -DynamicAnalyze Yläotsikko
What should be tested? Input ? Output?
Class Diagram http://www.ibm.com/developerworks/rational/library/content/RationalEdge/sep04/bell/
xUnitFramework Implementation Test Framework Implementation http://en.wikipedia.org/wiki/XUnit
Component /Unit Testing Developer Implemented Class Unit Test Frame Work TestClass Class Class Class Class Test Method Call Attributes Attributes Attributes TestMethodCall Method Result Methods Methods A=1 B=2 C=Class.TestMethodCountValues(A+B) C<>3 FAIL C=3 PASS MethodCountValues( int x, int y) z=x+y+1 Return z
Test Driven Development and Unit Testing DEFINE TEST CASES FIRST!!! Developer IMPLEMENT CODE AGAINST TESTS Implemented Class Unit Test Frame Work TestClass Class Class Class Class Attributes Attributes Attributes Test Method Call Methods Methods TestMethodCall Method Result A=1 B=2 C=Class.TestMethodCountValues(A+B) C<>3 FAIL C=3 PASS MethodCountValues( int x, int y) z=x+y+1 Return z
Ideal project team and unit testing Software Product Integration Integration test engineer #1 Integration test engineer #2 Test Sand Box Test Sand Box Test Sand Box Test Sand Box Developer 1 Developer 2 Developer 3 Developer 4 TESTS TESTS TESTS TESTS Implemented Software Component #3 Implemented Software Component #4 Implemented Software Component #2 Implemented Software Component #1
Static Code Analyze Analyzing your implementation? 10 CLS: PRINT TAB(15); "Polysons': PRINT 20 PI=3. 14159: TP=PI*2 30 INPUT "Number of Sides';SD 40 INPUT "Size (5 to 80)';SZ 50 SP=TP/SD 60 SCREEN 1 70 FOR A=0 TO TP+SP/2 STEP SP 90 X=SZ*SIN(A)+100 100 Y=SZ OS(A)+96 110 IF A=0 THEN 130 120 LINE (X0, Y0)-(X, Y) 130 X0=X:Y0=Y 140 NEXT 150 GOTO 150 ? http://www.atarimagazines.com/creative/v10n5/158_Simple_screen_graphics_wi.php
CodeCoverage An analysismethodthatdetermineswhichparts of the software havebeenexecuted (covered) by the testsuite and whichpartshavenotbeenexecuted, e.g. statementcoverage, decisioncoverageor conditioncoverage. http://en.wikipedia.org/wiki/Code_coverage http://www.atlassian.com/software/clover/ http://java.net/projects/hudson/lists/dev/archive/2009-03/message/235 http://en.wikipedia.org/wiki/Cyclomatic_complexity Yläotsikko
CodeCoverage - Branchcoverage The percentage of branchesthathavebeen exercisedby a testsuite. 100% branchcoverage impliesboth 100% decisioncoverage and 100% statementcoverage. http://booster911.hubpages.com/hub/BranchDecisionTesting Yläotsikko
CodeCoverage - Line coverage The percentage of branchesthathavebeen exercisedby a testsuite. 100% branchcoverage impliesboth 100% decisioncoverage and 100% statementcoverage. http://booster911.hubpages.com/hub/BranchDecisionTesting Yläotsikko
Static Code Analyze – HeatMap http://www.statsvn.org/demo/ruby/ Yläotsikko
Product verification/validation and testautomation A Product Release Acceptance Test Engineer System AcceptanceTesting System Test Engineer AcceptanceTesting Test Manager System Testing Project Manager A Load, Stress, performance Designer/Coder Functional System Testing Integration Test Engineer A Regression Testing Test Automation Engineer Feature Unit/Integration Testing A IntegrationTesting Component IntegrationTesting Validation Feature Component Verification A UnitTesting
Continuous Integration One Commit Cycle Build Server Job 6. Report Change Trigger 3. Execute Build 2. 4. Report Source Code Repository Code Commit Build Report 1. CODER
Statical Analyze Dynamical Analyze Builder Make / Ant Gcc Javac Code Checker Unit Tester Complexity Analyze Integration Tester Source Code Interface Tester Heat Map
Advanced Continuous Integration Build Server Job Report Report Build Request Change Trigger Build Slave Source Code Repository Code Commit Test Build Analyze Release Report Release Build
Build Server Job Report Report Build Request Change Trigger Build Slave Source Code Repository Code Commit Test Build Analyze Release Report Release Build
Build Server Job Build Slave Job Report Test Build Windows Job Analyze Report Release Build Request Job Release Build Build Request Report Build Slave Change Trigger Test Build Linux Analyze Report Release Build Request Release Build Source Code Repository Code Commit Build Slave Test Build Mac OS Analyze Report Release Release Build
Integration Test with stubs STUB/MOCK Component STUB/MOCK Component Simulated Interface Log Tested Component/Application Control Interface Messages/Events Control Configure Scripted STUB Interface Yläotsikko
in practice #1 IFDK android setup STUB/MOCK Component WEB SERVER simulating Service interface Simulated Interface Trace/Log Control Interface Activate/Control Tested Component Application Messages/Events Control Configure Scripted STUB Interface Yläotsikko
in practice #2 server component testing Mock Server/Daemon WEB SERVER Simulated Interface Trace/Log Control Interface Activate/Control Tested Component Application Needed Fake Application Messages/Events Operating System Automated Test Interface Junit Scripted Interface Scripted STUB Interface Yläotsikko
Integration Testing with simulated Interfaces Simulated Bluetooth Interface Fake Spotify Server Fake Facebook Server Simulated MIDI Interface
System Testing in Small Appcliation DB What should be tested? How ?