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 -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 ) About material
TESTING LEVELS
Unit/Module/Compone nt Testing Customer/Business Requirements Customer/Business Requirements Sub System Requirements Sub System Requirements Component Requirements Component Requirements Component / Unit Testing Component / Unit Testing Integration Testing Integration Testing System Testing System Testing Acceptance Testing Acceptance Testing System Requirements System Requirements Architecture& Design& Implementatio n Architecture& Design& Implementatio n Product VALIDATION VERIFICATION Yläotsikko
What should be tested? How ?
How to verify component implementation -Unit Testing -Static Analyze -Dynamic Analyze -Unit Testing -Static Analyze -Dynamic Analyze Yläotsikko
Input ? Output?
/library/content/RationalEdge/sep04/bell/
xUnit Framework Implementation Test Framework
Component /Unit Testing Class Attributes Class Methods Class Attributes Class Methods Attributes TestClass TestMethodCall Unit Test Frame Work Test Method Call Method Result A=1 B=2 C=Class.TestMethodCo untValues(A+B) C<>3 FAIL C=3 PASS Implemented Class MethodCountValues( int x, int y) z=x+y+1 Return z Developer
Test Driven Development and Unit Testing Class Attributes Class Methods Class Attributes Class Methods Attributes TestClass TestMethodCall Unit Test Frame Work Test Method Call Method Result A=1 B=2 C=Class.TestMethodCo untValues(A+B) C<>3 FAIL C=3 PASS Implemented Class MethodCountValues( int x, int y) z=x+y+1 Return z Developer DEFINE TEST CASES FIRST!!! DEFINE TEST CASES FIRST!!! IMPLEMENT CODE AGAINST TESTS IMPLEMENT CODE AGAINST TESTS
Implemented Software Component #1 Implemented Software Component #1 Implemented Software Component #3 Implemented Software Component #3 Implemented Software Component #4 Implemented Software Component #4 Implemented Software Component #2 Implemented Software Component #2 Software Product Integration Software Product Integration Developer 1 Developer 2 Developer 3 Developer 4 Test Sand Box TESTS Integration test engineer #2Integration test engineer #1
Analyzing your implementation? 10 CLS: PRINT TAB(15); "Polysons': PRINT 20 PI= : 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) Y=SZ OS(A) IF A=0 THEN LINE (X0, Y0)-(X, Y) 130 X0=X:Y0=Y 140 NEXT 150 GOTO graphics_wi.php ?
Code Coverage An analysis method that determines which parts of the software have been executed (covered) by the test suite and which parts have not been executed, e.g. statement coverage, decision coverage or condition coverage. Yläotsikko lexity
Code Coverage - Branch coverage The percentage of branches that have been exercised by a test suite. 100% branch coverage implies both 100% decision coverage and 100% statement coverage. Yläotsikko
Code Coverage - Line coverage The percentage of branches that have been exercised by a test suite. 100% branch coverage implies both 100% decision coverage and 100% statement coverage. Yläotsikko
Static Code Analyze – Heat Map Yläotsikko
Feature Component Feature Component Project Manager Designer/Coder Integration Test Engineer Integration Test Engineer Test Manager System Testing Feature Unit/Integration Testing System Acceptance Testing System Test Engineer System Test Engineer Test Automation Engineer Test Automation Engineer Acceptance Test Engineer Acceptance Test Engineer Validation Verification Product verification/validation and test automation Regression Testing Integration Testing Functional System Testing Acceptance Testing Unit Testing Product Release Component Integration Testing A A A A A Load, Stress, performance Load, Stress, performance
Continuous Integration
Source Code Repository Build Server Build 6. Report Code Commit Change Trigger Execute Build CODER Continuous Integration Job Report 4. Report One Commit Cycle
Analyzing & Unit Testing & CI
Code Checker Builder Make / Ant Gcc Javac Integration Tester Unit Tester Complexity Analyze Heat Map Source Code Interface Tester Statical AnalyzeDynamical Analyze
Source Code Repository Build Server Build Test Report Release Analyze Release Build Report Code Commit Report Change Trigger Build Request Build Slave Advanced Continuous Integration Job
Source Code Repository Build Server Build Test Report Release Analyze Release Build Report Code Commit Report Change Trigger Build Request Build Slave Job
Source Code Repository Build Server Build Test Report Release Analyze Release Build Report Code Commit Report Change Trigger Build Slave Build Test Report Release Analyze Release Build Build Slave Build Test Report Release Analyze Release Build Build Slave Build Request Windows Linux Mac OS Job
Integration Testing
Integration Test with stubs Tested Component/Application Log STUB/MOCK Component Scripted STUB Interface Control Configure Control Configure Simulated Interface Simulated Interface Messages/Events STUB/MOCK Component Control Interface Yläotsikko
in practice #1 IFDK android setup Tested Component Application Tested Component Application Activate/Control STUB/MOCK Component Scripted STUB Interface Control Configure Control Configure Simulated Interface Simulated Interface Messages/Events WEB SERVER simulating Service interface WEB SERVER simulating Service interface Control Interface Trace/Log Yläotsikko
in practice #2 server component testing Tested Component Application Tested Component Application Trace/Log Activate/Control Mock Server/Daemon Scripted STUB Interface Automated Test Interface Automated Test Interface Simulated Interface Simulated Interface Messages/Events WEB SERVER Control Interface Operating System Needed Fake Application Needed Fake Application Junit Scripted Interface Yläotsikko
Integration Testing with simulated Interfaces Fake Spotify Server Fake Spotify Server Fake Facebook Server Fake Facebook Server Simulated Bluetooth Interface Simulated Bluetooth Interface Simulated MIDI Interface Simulated MIDI Interface
What should be tested? How ? DB Appcliation
Yläotsikko