Platzhalter für Bild, Bild auf Titelfolie hinter das Logo einsetzen
- Prof. Dr.-Ing. Ina Schaefer – SFM:ESM - Bertinoro - 18 June 2014
Model-based Testing Part 1 Prof. Dr.-Ing. Ina Schaefer SFM:ESM - - - PowerPoint PPT Presentation
Platzhalter fr Bild, Bild auf Titelfolie hinter das Logo einsetzen Model-based Testing Part 1 Prof. Dr.-Ing. Ina Schaefer SFM:ESM - Bertinoro - 18 June 2014 Contents Part 1: Foundations of Testing and Model-based Testing Fundamental
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 2
Part 1: Foundations of Testing and Model-based Testing
Part 2: Model-based Testing of Software Product Lines
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 3
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 4
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 5
Specification
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 6
public { public { if(weekend) { return true; } else { return false; } } } public class foo boolean bar()
public class foo { p boolean bar() { if(weekend) { return true; } else { return false; } } }
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 7
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 8
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 9
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 10
Co.
Advanced Lectures. Springer, Berlin Heidelberg
610.121990
Glossary Working Party
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 11
Part 1: Foundations of Testing and Model-based Testing
Part 2: Model-based Testing of Software Product Lines
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 12
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 13
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 14
Platform Environment
centered around test model
basis for test case selection and coverage measure abstract test case selection
test case concretization
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 15
Part 1: Foundations of Testing and Model-based Testing
Part 2: Model-based Testing of Software Product Lines
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 16
implementation relation: 𝒋 ≃ 𝒕 with implemetation i and formal behavioral specification s preorder relation: 𝒋 ⊑ 𝒕 implementation shows at most the behaviors of the specification intentional conformance: 𝒋 ¡𝒅𝒑𝒐𝒈𝒑𝒔𝒏𝒕 ¡𝒕 ∶⇔ ¡ 𝒋 ⊆ 𝒕 where ⋅ ¡defines sets of all observable behaviors extensional conformance: 𝒋 ¡𝒅𝒑𝒐𝒈𝒑𝒔𝒏𝒕 ¡𝒕 ∶⇔ ∀𝒗 ∈ 𝓥 ∶ 𝒑𝒄𝒕 𝒗, 𝒋 ≈ 𝒑𝒄𝒕(𝒗, 𝒕) where 𝒱 defines sets of all observers
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 17
systems with reactive, non-deterministic behaviors
as test models AND implementation models
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 18
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 19
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 20
𝑈𝑠 𝑟 = {? 1€, ? 1€ ⋅ ! 𝑑𝑝𝑔𝑔𝑓𝑓, ? 1€ ⋅ ! 𝑢𝑓𝑏} 𝑈𝑠 𝑟 = ? 1€, ? 2€
? ¡1€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 ! 𝑢𝑓𝑏 𝑟 ? ¡1€ ? 2€ 𝑟
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 21
𝑡 𝑡 ⋅⋅⋅ 𝑡 𝑡
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 22
𝑈𝑠 𝑟 = ? 1€, ? 2€, ? 1€ ⋅ ! 𝑑𝑝𝑔𝑔𝑓𝑓, ? 2€ ⋅ ! 𝑑𝑝𝑔𝑔𝑓𝑓 𝑈𝑠 𝑟 = ? 1€, ? 2€, ? 1€ ⋅ ! 𝑑𝑝𝑔𝑔𝑓𝑓, ? 1€ ⋅ ! 𝑢𝑓𝑏, ? 2€ ⋅ ! 𝑑𝑝𝑔𝑔𝑓𝑓, ? 2€ ⋅ ! 𝑢𝑓𝑏
? ¡1€ ? 2€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 𝑟 ? ¡1€ ? 2€ 𝜐 ! 𝑑𝑝𝑔𝑔𝑓𝑓 ! 𝑢𝑓𝑏 𝑟 𝜐
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 23
⋅⋅⋅ 𝑡 ≔ ¡∃𝑡, … , 𝑡 ∶ 𝑡 = 𝑡 𝑡 ⋅⋅⋅ 𝑡 = 𝑡
⋅⋅⋅ ≔ ¡∃𝑡′ ∶ 𝑡 = 𝑡 ⋅⋅⋅ 𝑡
⋅⋅⋅ ¡≔ ∄𝑡 ∶ 𝑡 ⋅⋅⋅ 𝑡′
𝑡 𝑡 𝑡
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 24
⋅⋅⋅ 𝑡
⋅⋅⋅ 𝑡 ≔ ¡∃𝑡, … , 𝑡 ∶ 𝑡 = 𝑡
𝑡 = 𝑡
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 25
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 26
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 27
𝑈𝑠 𝑟 = ? 1€, ? 2€, ? 1€ ⋅ ! 𝑑𝑝𝑔𝑔𝑓𝑓, ? 2€ ⋅ ! 𝑢𝑓𝑏 𝑈𝑠 𝑟 = ? 1€, ? 1€ ⋅ ! 𝑑𝑝𝑔𝑔𝑓𝑓
? ¡1€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 𝑟 ? ¡1€ ? 2€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 ! 𝑢𝑓𝑏 𝑟
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 28
𝑈𝑠 𝑟 = ? 1€, ? 1€ ⋅ ! 𝑑𝑝𝑔𝑔𝑓𝑓 𝑈𝑠 𝑟 = {}
? ¡1€ ? 1€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 𝑟 𝑟
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 29
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 30
? ¡1€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 ! 𝑢𝑓𝑏 𝑟 ?2€ ?1€, ?2€ ?1€, ?2€ ?1€, ?2€ ? ¡1€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 ! 𝑢𝑓𝑏 𝑟
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 31
𝑟
Solution: explicit notion of quiescent behavior Solution: distinguish input and output behaviors in traces
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 32
𝑞 𝑞 𝑞 𝑞
? ¡1€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 ! 𝑢𝑓𝑏
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 33
𝑞 𝑞 𝑞 𝑞
? ¡1€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 ! 𝑢𝑓𝑏
δ δ δ
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 34
𝑞 𝑞 𝑞 𝑞
? ¡1€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 ! 𝑢𝑓𝑏
δ δ δ
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 35
𝑞 𝑞 𝑞 ? ¡1€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 ! 𝑢𝑓𝑏 δ δ δ
= {𝑞 ¡𝒃𝒈𝒖𝒇𝒔 ¡𝜀} = 𝑞
= {𝑞 ¡𝒃𝒈𝒖𝒇𝒔 ¡𝜀} = 𝑞
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 36
𝑞 𝑞 𝑞 ? ¡1€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 ! 𝑢𝑓𝑏 δ δ δ
= {𝑞 ¡𝒃𝒈𝒖𝒇𝒔 ¡𝜀} = 𝑞
= {𝑞 ¡𝒃𝒈𝒖𝒇𝒔 ¡𝜀} = 𝑞
) = 𝜀
) = {𝜀}
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 37
𝑞 𝑞 𝑞 𝑞 ? ¡1€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 ! 𝑢𝑓𝑏 δ δ δ
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 38
? ¡1€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 ! 𝑢𝑓𝑏 𝑟
? ¡1€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 ! 𝑢𝑓𝑏 𝑟 δ δ δ
add delta transitions
? ¡1€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 𝑟 ? ¡1€ ? 1€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 𝑟
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 39
∗ ∶ 𝑝𝑣𝑢 𝑗 ¡𝒃𝒈𝒖𝒇𝒔 ¡𝜏 ⊆ 𝑝𝑣𝑢(𝑡 ¡𝒃𝒈𝒖𝒇𝒔 ¡𝜏)
Subclass of input-enabled I/O LTS Class of I/O LTS labeled over I and U
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 40
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 41
𝑝𝑣𝑢 𝑟 ¡𝑏𝑔𝑢𝑓𝑠 ¡𝜏 = 𝑑𝑝𝑔𝑔𝑓𝑓, 𝑢𝑓𝑏 , 𝑝𝑣𝑢 𝑟𝑏𝑔𝑢𝑓𝑠 ¡𝜏 = 𝑑𝑝𝑔𝑔𝑓𝑓, 𝑢𝑓𝑏
? ¡1€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 ! 𝑢𝑓𝑏 𝑟 ? ¡1€ ? 2€ 𝜐 ! 𝑑𝑝𝑔𝑔𝑓𝑓 ! 𝑢𝑓𝑏 𝑟 𝜐 δ δ δ δ
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 42
𝑝𝑣𝑢 𝑟 ¡𝑏𝑔𝑢𝑓𝑠 ¡𝜏 = 𝑑𝑝𝑔𝑔𝑓𝑓}, 𝑝𝑣𝑢(𝑟 ¡𝑏𝑔𝑢𝑓𝑠 ¡𝜏) = {𝑑𝑝𝑔𝑔𝑓𝑓 𝑝𝑣𝑢 𝑟 ¡𝑏𝑔𝑢𝑓𝑠 ¡𝜏 = 𝑑𝑝𝑔𝑔𝑓𝑓}, 𝑝𝑣𝑢(𝑟 ¡𝑏𝑔𝑢𝑓𝑠 ¡𝜏) = {𝑢𝑓𝑏
? ¡1€ ? 2€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 𝑟 ? ¡1€ ? 2€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 ! 𝑢𝑓𝑏 𝑟 δ δ δ δ δ
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 43
𝑝𝑣𝑢 𝑟 ¡𝑏𝑔𝑢𝑓𝑠 ¡𝜏 = 𝜀}, 𝑝𝑣𝑢(𝑟 ¡𝑏𝑔𝑢𝑓𝑠 ¡𝜏) = {𝜀 𝑝𝑣𝑢 𝑟 ¡𝑏𝑔𝑢𝑓𝑠 ¡𝜏 = 𝑑𝑝𝑔𝑔𝑓𝑓}, 𝑝𝑣𝑢(𝑟 ¡𝑏𝑔𝑢𝑓𝑠 ¡𝜏) = {
? ¡1€ ? 2€ 𝑟 ? ¡1€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 𝑟 δ δ δ δ
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 44
𝑝𝑣𝑢 𝑟 ¡𝑏𝑔𝑢𝑓𝑠 ¡𝜏 = 𝑑𝑝𝑔𝑔𝑓𝑓, 𝜀}, 𝑝𝑣𝑢(𝑟 ¡𝑏𝑔𝑢𝑓𝑠 ¡𝜏) = { 𝑝𝑣𝑢 𝑟 ¡𝑏𝑔𝑢𝑓𝑠 ¡𝜏 = }, 𝑝𝑣𝑢(𝑟 ¡𝑏𝑔𝑢𝑓𝑠 ¡𝜏) = {
? ¡1€ ? 1€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 𝑟 𝑟 δ δ δ δ
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 45
∗ ∶ 𝑝𝑣𝑢 𝑗 ¡𝒃𝒈𝒖𝒇𝒔 ¡𝜏 ⊆ 𝑝𝑣𝑢(𝑡 ¡𝒃𝒈𝒖𝒇𝒔 ¡𝜏)
Problem: this is quite a lot!
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 46
Focus on specified behaviors only
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 47
?but ! 𝑚𝑗𝑟 ?but ?but ?but ?but ?but ?but ! 𝑑ℎ𝑝𝑑 ?but ! 𝑚𝑗𝑟 ?but ?but ?but ?but ?but ?but ?but ! 𝑚𝑗𝑟 ?but
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 48
Still infinite in case of loops
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 49
∗
∗ and 𝒋𝒑𝒔 = 𝒋𝒑𝒅𝒑() holds.
This is still an intentional characterization of
prove this by testing?
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 50
Observers (testers) are characterized by a finite sets of test cases they perform on an SUT
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 51
denotes observation of quiescence
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 52
Test case for specification 𝑟 Stimulated input
Expected output
Observable errors
¡
? ¡1€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 ! 𝑢𝑓𝑏 𝑟 𝑢 ! ¡1€ ? 𝑑𝑝𝑔𝑔𝑓𝑓 pass ? 𝑢𝑓𝑏 pass θ fail
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 53
Test case for specification 𝑟 Stimulated input
Expected output
Observable errors
¡
𝑢 ! ¡1€ ? 𝑑𝑝𝑔𝑔𝑓𝑓 pass ? 𝑢𝑓𝑏 fail θ pass ? ¡1€ ? 1€ ! 𝑑𝑝𝑔𝑔𝑓𝑓 𝑟
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 54
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 55
Part 1: Foundations of Testing and Model-based Testing
Part 2: Model-based Testing of Software Product Lines
June 18th, 2014 | Ina Schaefer | Model-based Testing – Part 1 | Seite 56
FMORMATS‘08. ¡vol. ¡5215, ¡pp. ¡250-164, Springer, 2012
4262, pp. 70-84, Springer, 2006
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 2
Part 1: Foundations of Testing and Model-based Testing
Part 2: Model-based Testing of Software Product Lines
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 11
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 12
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 13
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 14
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 15
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 16
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 17
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 18
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 19
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 20
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 21
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 22
1. Create Feature Model 2. Generate a subset of variants based on the FM, covering relevant combinations of features 3. Apply single system testing to the selected variants
Trade-Off
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 23
SPL features
valid product configurations
minimal CA
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 24
1. = Ø 2. = Ø, , 1, 2, … , . , # 3. 4. 2
contains only subsets with different elements
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 25
Finding core and dead features quickly Early identification of invalid t-sets Parallelization and several more
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 26
be several hours
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 27
Kowal, M., Schulze, S., Schaefer, I.: Towards Efficient SPL Testing by Variant Reduction. In: VariComp. pp. 1–6. ACM (2013)
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 28
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 29
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 30
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 31
Institut für Softwaretechnik und Fahrzeuginformatik
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 32
Institut für Softwaretechnik und Fahrzeuginformatik
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 33
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 34
defined [Lity13]
not every product as a whole
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 35
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 36
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 37
Institut für Softwaretechnik und Fahrzeuginformatik
Test cases Vn Test cases V2 Test cases V1
Retest V2
Variant 1 Variant 2 Variant n
[…] Invalid V2
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 38
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 39
Institut für Softwaretechnik und Fahrzeuginformatik
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 40
For more information see [BCS12]
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 41
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 42
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 43
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 45
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 46
Part 1: Foundations of Testing and Model-based Testing
Part 2: Model-based Testing of Software Product Lines
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 47
150% SPL specification 150% SPL implementation
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 48
Implementation freedom in single system IOCO testing
specified output behavior for specified input behaviors
for unspecified input behaviors Implementation variability in SPL IOCO testing
input/ouput behaviors
? 1€ ! !
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 49
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 2
Institut für Softwaretechnik und Fahrzeuginformatik
Part 1: Foundations of Testing and Model-based Testing ! Fundamental Notions and Concepts of Software Testing ! Model-based Testing ! A Theoretical Perspective on Model-based Testing Part 2: Model-based Testing of Software Product Lines ! Sample-based Software Product Line Testing ! Regression-based Software Product Line Testing ! Variability-Aware Software Product Line Testing
18 June 2014 | Ina Schaefer | Model-based Testing – Part 2 | Slide 70
Line Test Models - The Body Comfort System Case Study, Technische Universität Braunschweig, 2012
Spencer Peterson - Feature-Oriented Domain Analysis (FODA) Feasibility Study, Technical Report, 1990