Download - Testing Telecoms Software with QuickCheck
![Page 1: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/1.jpg)
Testing Telecoms Software with QuickCheck
Thomas ArtsJohn HughesChalmers/ITU
Joakim JohanssonUlf Wiger
Ericsson
![Page 2: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/2.jpg)
Session Border Gateway
Media Proxy
Opens media pin-holes for calls in
progress
2x10G Ethernet
Hardware for packet forwarding
Media Gateway Controller
Monitors signalling
traffic; opens and closes pinholes
2x1G Ethernet
Linux ”blade” processor
![Page 3: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/3.jpg)
Session Border Gateway
Media Proxy
Media Gateway Controller
ITU standard protocol H.248
(Megaco) 150KLOC Erlang
1.5MLOC C
![Page 4: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/4.jpg)
A QuickCheck Property
prop_reverse() -> ?FORALL(Xs,list(int()), lists:reverse(lists:reverse(Xs)) == Xs).
6> eqc:quickcheck(rev:prop_reverse()).....................................................................................................OK, passed 100 teststrue
![Page 5: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/5.jpg)
A Wrong Property
prop_reverse_wrong() -> ?FORALL(Xs,list(int()), lists:reverse(Xs) == Xs).
10> eqc:quickcheck(rev:prop_reverse_wrong())......................Failed! After 22 tests.[-2,4,0]Shrinking......(6 times)[1,0]false
![Page 6: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/6.jpg)
Testing the Media Proxy Control Software
Media Proxy
QuickCheckSend
random command sequences
Check the responses
Generate random messages in a random command sequence
But not completely random!
![Page 7: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/7.jpg)
MediaDescriptor ::= SEQUENCE{
termStateDescr TerminationStateDescriptor OPTIONAL,streams CHOICE{
oneStream StreamParms,multiStream SEQUENCE OF StreamDescriptor
} OPTIONAL,…
}
Message Example: ASN.1 Description
• A media descriptor contains a list of streams
![Page 8: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/8.jpg)
…with IWD Restrictions
• A media descriptor contains a list of streams
MediaDescriptor ::= SEQUENCE{
termStateDescr TerminationStateDescriptor OPTIONAL,streams CHOICE{
oneStream StreamParms,multiStream SEQUENCE OF StreamDescriptor
} OPTIONAL,…
}
![Page 9: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/9.jpg)
QuickCheck Generator for Erlang Records
mediadescriptor(Streams) when Streams=/=[]-> {mediaDescriptor, #'MediaDescriptor'{ streams = case Streams of [{Id,Mode}] -> oneof([{oneStream,streamParms(Mode)}, {multiStream,[stream(Id,Mode)]}]); _ -> {multiStream, [stream(I,M) || {I,M}<-Streams]} end}}.
stream(I,Mode) -> #'StreamDescriptor'{ streamID = I, streamParms = streamParms(Mode)}.
Generators can be embedded in any data
structure
Message constructionLogic from the IWD
QuickCheck
![Page 10: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/10.jpg)
Local Control DescriptorsAdd Request
Desc. Desc. Desc. Properties, Package M Comment
Media M
Stream M Multiple Stream descriptors can be included.
Localcontrol
O LocalControl will be included in all cases except when no media (m-line) is defined in the remote SDP.
mode O The default value of the mode property is “Inactive”, the property is not mandatory if the wanted value is “Inactive”.
StreamParms ::= SEQUENCE{
localControlDescriptor LocalControlDescriptor OPTIONAL,localDescriptor LocalRemoteDescriptor OPTIONAL,remoteDescriptor LocalRemoteDescriptor OPTIONAL,…,statisticsDescriptorStatisticsDescriptor OPTIONAL
}
![Page 11: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/11.jpg)
streamParms(Mode) -> ?LET(RemoteMediaDefined, probably(), if RemoteMediaDefined ->
#'StreamParms'{ localControlDescriptor = localControl(Mode),
localDescriptor = localDescriptor(RemoteMediaDefined),
remoteDescriptor = remoteDescriptor(RemoteMediaDefined)}; true -> …… end).
Random boolean with
high probability
Two Cases: With and Without Remote Media
![Page 12: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/12.jpg)
Megaco Commands
ContextContext
![Page 13: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/13.jpg)
Megaco Commands
Context
ContextContext
Termination
Add
Returns Context ID &
Termination ID
![Page 14: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/14.jpg)
Megaco Commands
Context
ContextContext
TerminationTermination
Add
Uses context ID
![Page 15: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/15.jpg)
Megaco Commands
Context
ContextContext
TerminationTermination
StreamStream
Modify
Uses termination ID
![Page 16: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/16.jpg)
Megaco Commands
Context
ContextContext
TerminationTermination
StreamStream
Subtract
![Page 17: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/17.jpg)
Megaco Commands
Context
ContextContext
Termination
StreamStream
Subtract
![Page 18: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/18.jpg)
Megaco Commands
ContextContext
![Page 19: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/19.jpg)
Symbolic Test Cases
• Generated wrt an abstract state machine tracking contexts, terminations & streams
[{set,1,…,send_add, [?choose_cxt_id,Streams,Req]}, {assert,…,check_add,[{var,1}], {set,2,…,send_add, [{call,…,get_reply_cxt,[{var,1}]}, Streams2,Req2]}, {assert,…,check_add,[{var,2}]}]
![Page 20: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/20.jpg)
Encode/Decode Error
• Recall the stream parameters…
StreamParms ::= SEQUENCE{
localControlDescriptor LocalControlDescriptor OPTIONAL,localDescriptor LocalRemoteDescriptor OPTIONAL,remoteDescriptor LocalRemoteDescriptor OPTIONAL,…,statisticsDescriptor StatisticsDescriptor OPTIONAL
}
![Page 21: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/21.jpg)
Add/Modify Error
Add
Modify
![Page 22: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/22.jpg)
Add/Subtract Error
• There one day, gone the next…
Add
Subtract
![Page 23: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/23.jpg)
Add/Add/Modify Error
• If the terminations have different numbers of streams
Add
Modify
Add
![Page 24: Testing Telecoms Software with QuickCheck](https://reader035.vdocuments.us/reader035/viewer/2022062816/56814a7d550346895db791ad/html5/thumbnails/24.jpg)
Add/Add/Sub/Add… Error
• Extracted from a test case 160 commands long
Add
Subtract
Add
Add
Add
Subtract
Subtract