Unit Testing and Continuous Integration in context of IFDK reference product
-
Upload
tashya-alvarado -
Category
Documents
-
view
41 -
download
0
description
Transcript of 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
Unit/Module/Component Testing
Unit/Module/Component Testing
Customer/BusinessRequirements
Customer/BusinessRequirements
Sub SystemRequirementsSub System
Requirements
ComponentRequirementsComponent
RequirementsComponent / Unit
TestingComponent / Unit
Testing
IntegrationTestingIntegrationTesting
SystemTestingSystemTesting
AcceptanceTestingAcceptanceTesting
SystemRequirements
SystemRequirements
Architecture&Design&
Implementation
Architecture&Design&
Implementation
ProductProduct
VALIDATIONVALIDATION
VERIFICATIONVERIFICATION
Yläotsikko
How to verify component implementation
How to verify component implementation
-Unit Testing-Static Analyze-Dynamic Analyze
-Unit Testing-Static Analyze-Dynamic Analyze
Yläotsikko
Component /Unit TestingComponent /Unit Testing
ClassClass
AttributesAttributes
ClassClass
MethodsMethods
ClassClass
AttributesAttributes
ClassClass
MethodsMethods
AttributesAttributes
TestClassTestClass
TestMethodCallTestMethodCall
Unit Test Frame WorkUnit Test Frame Work
Test Method Call
Method Result
A=1B=2C=Class.TestMethodCountValues(A+B)C<>3 FAILC=3 PASS
Implemented Class
MethodCountValues( int x, int y)z=x+y+1Return z
Developer
Test Driven Development and Unit TestingTest Driven Development and Unit Testing
ClassClass
AttributesAttributes
ClassClass
MethodsMethods
ClassClass
AttributesAttributes
ClassClass
MethodsMethods
AttributesAttributes
TestClassTestClass
TestMethodCallTestMethodCall
Unit Test Frame WorkUnit Test Frame Work
Test Method Call
Method Result
A=1B=2C=Class.TestMethodCountValues(A+B)C<>3 FAILC=3 PASS
Implemented Class
MethodCountValues( int x, int y)z=x+y+1Return z
Developer
DEFINE TEST CASES
FIRST!!!
DEFINE TEST CASES
FIRST!!!
IMPLEMENTCODE
AGAINST TESTS
IMPLEMENTCODE
AGAINST TESTS
Ideal project team and unit testingIdeal project team and unit testing
ImplementedSoftware
Component#1
ImplementedSoftware
Component#1
ImplementedSoftware Component
#3
ImplementedSoftware Component
#3
ImplementedSoftware Component
#4
ImplementedSoftware Component
#4
ImplementedSoftware Component
#2
ImplementedSoftware Component
#2
Software ProductIntegration
Software ProductIntegration
Developer 1 Developer 2 Developer 3 Developer 4
Test Sand Box Test Sand Box Test Sand Box Test Sand Box
TESTS TESTS TESTS TESTS
Integration test engineer #2Integration test engineer #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
?
Code CoverageCode 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.
http://en.wikipedia.org/wiki/Code_coverage
http://www.atlassian.com/software/clover/
Yläotsikko
http://en.wikipedia.org/wiki/Cyclomatic_complexity
http://java.net/projects/hudson/lists/dev/archive/2009-03/message/235
Code Coverage - Branch coverageCode 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
http://booster911.hubpages.com/hub/BranchDecisionTesting
Code Coverage - Line coverageCode 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
http://booster911.hubpages.com/hub/BranchDecisionTesting
Static Code Analyze – Heat MapStatic Code Analyze – Heat Map
Yläotsikko
http://www.statsvn.org/demo/ruby/
FeatureComponentFeatureComponent
Project ManagerProject Manager
Designer/CoderDesigner/Coder
IntegrationTest EngineerIntegrationTest Engineer
Test ManagerTest Manager
System TestingSystem Testing
Feature Unit/Integration TestingFeature Unit/Integration Testing
System Acceptance TestingSystem Acceptance Testing
SystemTest EngineerSystemTest Engineer
Test AutomationEngineerTest AutomationEngineer
AcceptanceTest EngineerAcceptanceTest Engineer
ValidationValidation
VerificationVerification
Product verification/validation and test automation Product verification/validation and test automation
Regression TestingRegression Testing
Integration TestingIntegration Testing
Functional System TestingFunctional System Testing
Acceptance TestingAcceptance Testing
Unit TestingUnit Testing
Product ReleaseProduct Release
Component Integration Testing Component Integration Testing
A
A
A
A
A Load, Stress, performance Load, Stress, performance
Source Code
Repository
Build ServerBuild
6. R
epor
t
Code Commit Ch
ange
Trig
ger
1.
2.
3. Execute Build
CODER
Continuous Integration
Job
Report
4. Report One Commit Cycle
Code Checker
Builder
Make / AntGcc
Javac
Integration Tester
Unit Tester
Complexity Analyze
Heat Map
SourceCode
Interface Tester
Statical Analyze Dynamical Analyze
Source Code
Repository
Build Server
Build
Test
ReportRelease
Analyze
ReleaseBuild
Report
Code Commit
Report
Chan
ge T
rigge
rBuild Request
Build Slave
Advanced Continuous Integration
Job
Source Code
Repository
Build Server
Build
Test
ReportRelease
Analyze
ReleaseBuild
Report
Code Commit
Report
Chan
ge T
rigge
rBuild Request
Build Slave
Job
Source Code
Repository
Build Server
Build
Test
Report
Release
Analyze
Release
Build
Repo
rt
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
Build Request
Build Request
Windows
Linux
Mac OS
Job
Job
Job
Job
Integration Test with stubsIntegration Test with stubs
Tested Component/ApplicationTested Component/Application
LogLog
STUB/MOCK ComponentSTUB/MOCK Component
Scripted STUB InterfaceScripted STUB Interface
ControlConfigureControlConfigure
SimulatedInterfaceSimulatedInterface
Messages/EventsMessages/Events
STUB/MOCK ComponentSTUB/MOCK Component
Control InterfaceControl Interface
Yläotsikko
in practice #1 IFDK android setupin practice #1 IFDK android setup
Tested ComponentApplication
Tested ComponentApplication
Activate/ControlActivate/Control
STUB/MOCK ComponentSTUB/MOCK Component
Scripted STUB InterfaceScripted STUB Interface
ControlConfigureControlConfigure
SimulatedInterfaceSimulatedInterface
Messages/EventsMessages/Events
WEB SERVER simulatingService interfaceWEB SERVER simulatingService interface
Control InterfaceControl Interface
Trace/LogTrace/Log
Yläotsikko
in practice #2 server component testingin practice #2 server component testing
Tested ComponentApplication
Tested ComponentApplication
Trace/LogTrace/Log
Activate/ControlActivate/Control
Mock Server/DaemonMock Server/Daemon
Scripted STUB InterfaceScripted STUB Interface
AutomatedTest Interface
AutomatedTest Interface
SimulatedInterfaceSimulatedInterface
Messages/EventsMessages/Events
WEB SERVERWEB SERVER
Control InterfaceControl Interface
Operating SystemOperating System
NeededFake Application
NeededFake Application
Junit Scripted InterfaceJunit Scripted Interface
Yläotsikko
Integration Testing with simulated Interfaces
FakeSpotifyServer
FakeSpotifyServer
FakeFacebook
Server
FakeFacebook
Server
SimulatedBluetoothInterface
SimulatedBluetoothInterface
SimulatedMIDI
Interface
SimulatedMIDI
Interface
System Testing in SmallSystem Testing in Small
What should be tested?
How ?
DBDB
AppcliationAppcliation