UML Testing Profile and TTCN-3
Download
Report
Transcript UML Testing Profile and TTCN-3
Software test automation
with UML2.0
TestingProfile & TTCN-3
Maili Markvardt
Topics for Master’s thesis!
Topics for master’s thesis in the Institute of
Computer Science are introduced Februrary
21st at 13.30 in VI-224
We will learn..
Introduction to software test automation
What is UML 2.0 testing profile
What is TTCN-3 – brief overview
UML2TP and TTCN-3 tools
Introduction
Manual testing – human tester conducts
testing activities
Automated tests – tests are “written” in a
(test) programming language and are
conducted by special test automation tools
Automating must be carefully considered,
because it can in some cases be less
effective than manual testing
Test automation tools
Many different tools for functional and
performance testing
Jmeter, Fitnesse, Mercury tools, Rational tools
…
XUnit = unit testing tools for different
languages
UML2.0 Testing Profile – language for
modeling testing
TTCN-3 – language for automating testing
Why UML2.0 TP and TTCN-3?
UML – de facto standard in software engineering
UML is a LANGUAGE, not a method or a tool!
Besides that, UML is a very powerful language
TTCN-3 and UML2.0 TP - created to support each
other, but
They don’t require each other – separate usage is
possible
UML and profiles
Profiles are meant for tailoring UML for
specific application domains, for example
Profile for CORBA
Profile for QoS and Fault tolerance
Profile for Scedulability, Performance and
Time (Real-Time Profile)
UML Testing profile – since autumn 2005
UML2.0 Testing Profile
A language for designing, visualising,
specifying, analysing and documenting
artifacts concernging testing systems
Test architecture
Test dynamics
Test data
Test timing
Once more: UML TP is a language, not an
method. It provides a notation rather than
specifying the usage!
Meta model?!
Meta model is a
language (set of rules)
for describing models of
some language
Example: book meta
model
class BookMetamudel
Book
+
Title: string
+ Chapters
*
Chapter
+
+
+
nbPages: int
Title: string
Author: string
11
8
10
3
2
5
4
6
1
7
9
Test data =
stimuli + observations
? ->
OCL->
* ->
Test timing
Timer
start(expires: Time)
Stop()
Read(): Time
isRunning: Boolean
TimeOut() : TimeOutMessage
Timezone
GetTimeZone
SetTimeZone
Start(..)
Stop()
timeOut
Diagram types
Package, class, component diagrams for
specifying the test system structure
Sequence and state machine diagrams for
specifying the test system behaviour
Bank exampe – unit, integration and
system tests in UML TP
Unit test
Verify, that SUT (system under test) properly
calculates the amount of money added by the
user
Unit test – Test Case
The same unit test in JUnit
public class MoneyTest extends TestCase {
public void addSameMoney {
Money money1 = new Money(20, “USD”));
Money money2 = new Money(50, “USD”));
money1.add(money2);
}
assertTrue(money1.equals(new Money(70, “USD”))
}
Integration test example
Integration test example (2)
Integration test example (3)
Integration test example (4)
Testi konfiguratsioon
Integration test example (5)
Integration test example (6)
System test example
System test example (2)
System test example (3)
System test example (4)
System test example (5)
System test example (6)
System test example (7)
System test example (8)
Mappings
UML TP -> TTCN-3
Black/grey box unit, integration and system
tests
Concepts used in UML TP and TTCN-3 are
practically the same
UML TP -> JUnit
Only black box unit tests
Partial support of UML TP concepts in JUnit
TTCN-3: The Testing and Test Control
Notation
Jet another test programming language?
For functional, interoperability, regression, unit,
integration and system testing in reactive (feedbackenabled) systems and distributed systems
Telecom, mobile, internet ja CORBA-based systems
Almost full support of UML TP concepts
Founder: European Telecommunications Standards
Institute (ETSI) 1999 – 2001, latest version from 2007
TTCN-3 originates from Tree And Tabular Combined
Notation (TTCN-1 ja TTCN-2)
TTCN-3
Presentation formats:
Core language,
Graphical
representation (MSC),
Table representation,
+ Possibility to define
your own presentation
formats
TTCN-3
Core
Notation
Tabular
Format
Graphical
Format
Presentation
Format n
Example of a function
function invalidPIN_hwe(integer invalidPIN) runs on HWEmulator {
activate(HWEmulator_classifierdefault());
hwCom.call(storeCardData:{current},nowait);
t1.start(2.0);
hwCom.getreply(display_:{"Enter PIN"});
t1.stop;
hwCom.call(isPinCorrect:{invalidPIN},3.0) {
[] hwCom.getreply(isPinCorrect:{?} value false) {}
}
hwCom.getreply(display_:{"Invalid PIN"});
hwCom.getreply(display_:{"Enter PIN again"});
arbiter.send(pass_); // local verdict to the arbiter
}
Example of a Default
altstep HWEmulator_classifierdefault()runs on HWEmulator_CType {
var charstring s;
[] t1.timeout {arbiter.send(fail_);}
[] hwCom.getcall(ejectCard:{}) {arbiter.send(fail_);}
[] hwCom.getcall(display_:{?}) -> param (s) {
if (s == "Connection lost") { arbiter.send(inconc_) }
else {arbiter.send(fail_)} }
}
}
Tools
UML TP
SparxSystems Enterprise Architect 6.0
Eclipse Hyades Project CASE tool
Theoretically possible to use any CASE tool providing
stereotyping (?)
TTCN-3
Elvior’s MessageMagic (commercial)
Eclipse Framework plug-ins - TTCN-3 core laguage
editor and compiler (commercial)
OpenTTCN Tester for TTCN-3 (commercial)
Conformiq QTronic – TTCN-3 test generator (from
UML models)
Further reading
1.
2.
3.
4.
TTCN-3 Home Page [ www.ttcn3.org]
www.fokus.fraunhofer.de/u2tp
OMG Unified Modeling Language [
http://www.uml.org ] – UML 2.0 Testing Profile
Specification
Schieferdecker, Grabowski, Rennoch. 2003. The
UML 2.0 Testing Profile and its relation to TTCN-3 [
http://www.swe.informatik.unigoettingen.de/publications/IS_ZD_JG_AR/TestCom
2003_UTP_Final.pdf ]