TTCN3 o TTCN3 o Data Types o o

  • Slides: 58
Download presentation
TTCN-3简介

TTCN-3简介

o TTCN-3概述

o TTCN-3概述

o 模块定义 Data Types o o Constants 所有定义在整个模块中都是全局的。 类型定义(Data Types)都是基于预定义类 型和结构类型(包括从其他非TTCN-3语言 ASN. 1定义中引入的类型) o

o 模块定义 Data Types o o Constants 所有定义在整个模块中都是全局的。 类型定义(Data Types)都是基于预定义类 型和结构类型(包括从其他非TTCN-3语言 ASN. 1定义中引入的类型) o 模板(Templates)和原型(Signature) 定义测试数据。 o 端口(ports)和 测试组件(Components) 在动态测试配置过程中使用。 o 函数(Functions), 测试步(Altsteps),测 试用例(testcase)用来定义测试行为。 RP Signatures Data Templates Signature Templates Communication Ports Test Components Functions Named Alternatives Test Cases

TTCN 3数据类型定义 �型 简单基本类型 基本串�型 �构�型 关�字 integer range, list char range, list universal

TTCN 3数据类型定义 �型 简单基本类型 基本串�型 �构�型 关�字 integer range, list char range, list universal char range, list float range, list boolean list objid list verdicttype list bitstring list, length hexstring list, length octetstring list, length charstring range, list, length universal charstring range, list, length record,set record of,set of 特殊数据�型 Sub-type list, length enumerated list union list anytype list

o 数据类型定义-整型 /* 整型范围约束定义 */ type integer My. Integer. Range (1. . 100) type

o 数据类型定义-整型 /* 整型范围约束定义 */ type integer My. Integer. Range (1. . 100) type integer My. Integer. Range (0. . infinity) /* 整型列表约束定义 */ type integer My. Integer. List (1 , 2, 3, 4) /* 混合约束定义 */ type integer My. Integer. List. And. Range (1. . 5, 7, 9)

o 数据类型定义-结构类型 // record 结构类型定义 type record My. Message. Type { integer field 1

o 数据类型定义-结构类型 // record 结构类型定义 type record My. Message. Type { integer field 1 optional, boolean field 2 } // record 值定义 var My. Message. Type My. Message : = { field 1 : = 1, field 2 : = true } // 单独的域赋值 My. Message. field 2 : = false

ASN. 1 �型 o 数据类型-与ASN. 1 类型兼容 等效的TTCN-3�型 BOOLEAN boolean INTEGER integer REAL (note

ASN. 1 �型 o 数据类型-与ASN. 1 类型兼容 等效的TTCN-3�型 BOOLEAN boolean INTEGER integer REAL (note 1) float OBJECT IDENTIFIER objid BIT STRING bitstring OCTET STRING octetstring SEQUENCE record SEQUENCE OF record of SET set SET OF set of ENUMERATED enumerated CHOICE union Visible. String char(note 2), charstring IA 5 String char(note 2), charstring Universal. String universal char(note 2), universal charstring

o 数据定义-参数化模板 // 参数化模板 template My. Message. Type My. Message (integer My. Par) :

o 数据定义-参数化模板 // 参数化模板 template My. Message. Type My. Message (integer My. Par) : = { field 1 : = My. Par, field 2 : = true, field 3 : = ‘ 110011’B } // 模板调用 P 1. send(My. Message(1));

o 数据定义-模板继承 template My. Message. Type My. Message 1 { field 1 : =

o 数据定义-模板继承 template My. Message. Type My. Message 1 { field 1 : = 123, field 2 : = true } template My. Message. Type My. Message 2 modifies My. Message 1 { field 2 : = false } // 等效下面的写法 template My. Message. Type My. Message 3 { field 1 : = 123, field 2 : = false }

o 动态测试配置-通信端口定义 // 基于消息的端口定义 type port My. Message. Port. Type message { in Msg.

o 动态测试配置-通信端口定义 // 基于消息的端口定义 type port My. Message. Port. Type message { in Msg. Type 1, Msg. Type 2; out Msg. Type 3; inout integer } // 基于过程的端口定义 type port My. Procedure. Port. Type procedure { out Procedure. Signature 1, Procedure. Signature 2 }

o 动态测试配置-测试组件定义 // 测试组件类型定义 type component My. Component. Type { // 局部变量声明 var integer

o 动态测试配置-测试组件定义 // 测试组件类型定义 type component My. Component. Type { // 局部变量声明 var integer My. Var; timer My. Timer; // 测试组件使用的端口列表 My. Message. Port. Type P 1, P 2; My. Procedure. Port. Type P 3 }

o o o // 函数可以带参数,参数具有几种属性: in, out, inout. 默认属性是in。 function My. Function (in integer

o o o // 函数可以带参数,参数具有几种属性: in, out, inout. 默认属性是in。 function My. Function (in integer My. Par) { : } // 函数可以带返回值,默认为void function My. Function return integer { : }

o o o o o testcase My. Test. Case() runs on My. MTCType system

o o o o o testcase My. Test. Case() runs on My. MTCType system My. Test. System. Type { : // 定义测试行为 } // 该用例只有包含MTC,没有涉及系统接口操作 testcase My. Test. Case()runs on My. MTCType { : // 定义测试行为 }

o o o o Altstep My. Altstep (in integer var 1) runs on My.

o o o o Altstep My. Altstep (in integer var 1) runs on My. Component. Type { [] My. Port. receive(My. Message 1) { setverdict(pass); } [] My. Port. receive(My. Message 2) { repeat; } [] My. Timer. timeout { stop; } }

o o o //在alt语句中可选步的显示调用。 Alt { [] My. Port. receive(My. Message 1) { setverdict(pass);

o o o //在alt语句中可选步的显示调用。 Alt { [] My. Port. receive(My. Message 1) { setverdict(pass); } [] My. Altstep(1) ; [] My. Timer. timeout { stop; } }

o//独立调用的可选步 o. My. Altstep(1) ; o//等效于 o. Alt o{ o [] My. Altstep(1) ;

o//独立调用的可选步 o. My. Altstep(1) ; o//等效于 o. Alt o{ o [] My. Altstep(1) ; o}

o // 执行My. Test. Case 1,不存储返回的测试判定和时间监管 o execute(My. Test. Case 1()); o // 执行My.

o // 执行My. Test. Case 1,不存储返回的测试判定和时间监管 o execute(My. Test. Case 1()); o // 执行My. Test. Case 2,把结果判定存储在变量My. Verdict 中 o My. Verdict = execute(My. Test. Case 2()); o // 执行My. Test. Case 3,把结果判定存储在变量My. Verdict 中, 如果测试例在 500 ms内没有终止,My. Verdict将得到值 'error‘. o My. Verdict = execute(My. Test. Case 3(), 0. 5);

o o o // 测试用例多次执行。 while (x<10) { x: =x+1; execute(My. Test. Case()); }

o o o // 测试用例多次执行。 while (x<10) { x: =x+1; execute(My. Test. Case()); } o // 在特定的条件下,测试用例执行。 o if (My. Selection. Expression) execute(My. Test. Case()) ;

o ANY QUESTIONS?

o ANY QUESTIONS?