当前位置:网站首页>Z-Wave CTT usage and test demonstration
Z-Wave CTT usage and test demonstration
2022-07-18 22:47:00 【Eagle115】
Z-Wave CTT brief introduction :
Z-Wave CTT Also called Z-Wave Certification test tool (Z-Wave Certification Test Tool), It's based on Microsoft Windows Applications for , Can be right Z-Wave The equipment is tested automatically or semi automatically , For authentication Z-Wave equipment . The equipment being tested is called DUT(Device Under Test). Authentication is based on CTT The provided test script is also targeted at DUT Run test cases . Each test case is designed to examine a specific set of attributes and requirements . CTT and Z-Wave Any communication between networks is through Z-Wave USB dongle or Z-Wave The development board completes .
Use the test case script file
Z-Wave CTT For most of Z-Wave Command classes provide many predefined standard test cases . We can adjust these test cases Script file , Give Way CTT Help us do auxiliary product function tests . stay Workfolow Click on the Script Test Enter the script test tab , Select the script you want to modify and edit it Script Adjustment . 
Z-Wave CTT Script grammar :
- Test item title : The first line of each test script file is the title of the test project , The first line of code automatically produced when creating a test project . It doesn't need to be modified .
PACKAGE MyTestCase_Rev01_User; // do not modify this line
- Definition of command class : The purpose is to let the script engine know the exact version of the command class used in this script ,USE Statements can be used anywhere in the script , So the definition of the command class can be placed anywhere in the script . If you don't define it with a command class , Then automatically use Version 1.
USE Association CMDCLASSVER = 1;
- Test piece (Test Sequences): One or more test fragments are listed under the test script Title . This is a sub part of the testing project . Each test segment can be tested separately , Test fragments that are not selected will not be executed ."InitialValues" Is the name of the test segment , The string in double quotation marks is a comment . The test fragment is a local scope space , Variables defined in the test segment can only be used in this test segment . stay Test Case Explorer Medium ZWave_CTT_CommandClasses The following contains all Command Class Test template for , You can add it to your test project to modify .
TESTSEQ InitialValues: "Verify Initial Values"
...
TESTSEQ END
- Test statement (Test Statements): The standard test statement is to DUT send out Z-Wave Command Of "SEND" Statement and receive the response and pass "EXPECT" Statement to compare it with the defined expected value . It can also be used. SEND and EXPECT Templates add script statements to scripts .“SEND” and “EXPECT” The format of the statement is as follows :
SEND Association.Get(
GroupingIdentifier = 1);
EXPECT Association.Report (
GroupingIdentifier == 1,
MaxNodesSupported in (0 ... 0xFF),
ReportsToFollow == 0,
NodeID eq (1,2));
Digital variables :
CTT Numeric variables in $ start , You can define global and local variables in the test fragment . Local variables are only visible in the test fragment that defines them . Global variables are globally visible , And keep its value in all subsequent test segments . Defining a global variable with the same name as an existing local variable will cause compilation errors . Defining a local variable with the same name as an existing global variable will update the value of the global variable .
$var = 2012; // creates a local unsigned integer variable
$array = [0x01, 0x02, 0x03]; // creates a local array of unsigned integers
GLOBAL $var = 2012; // creates a global unsigned integer variable
GLOBAL $array = [0x01, 0x02, 0x03]; // creates a global array of unsigned integers
String variable :
CTT Another type of variable in scripting language is string . String variable names begin with “#” Symbol at the beginning :
#var = "test"; // creates a local string variable
#array = ["alpha", "beta", "gamma"]; // creates a local array of strings
GLOBAL #var = "test"; // creates a global string variable
GLOBAL #array = ["alpha", "beta", "gamma"]; // creates a global array of strings
Array :
stay CTT In scripting language , Array variables may contain unsigned integers 、 Bytes or strings , It depends on how they are initialized ( See the section above ). If the variable contains an array , Then you can read the array elements : Array elements from index 0 Start . If the element index used is out of range , Script execution will be aborted due to runtime exceptions . The number of array elements can be accessed as follows :
$nodeIds = [1, 2, 3];
$length = LENGTH($nodeIds);
have access to “==”、“!=” or “eq” The operator in IF Statement to compare numeric array variables :
$a = [1, 2, 3, 4];
$b = [4, 3, 2, 1];
IF ($a == $b) // this is false
IF ($a eq $b) // this is true
Array variables can be initialized with a fixed length :
$array = ARRAYINIT(10); // creates an unsigned integer array with 10 elements set to 0
#strarray = STRARRAYINIT(10); // creates a string array with 10 emtpy string elements
You can append... To an existing array variable 、 Insert and delete array elements :
$array = ARRAYAPPEND($array, 2); // appends an array element with value 2
#strarray = STRARRAYAPPEND(#strarray, "test"); // appends an array element with value "test"
$array = ARRAYINSERT($array, 1, 2); // inserts an array element with value 2 at array index 1
#strarray = STRARRAYINSERT(#strarray, 2, "test"); // inserts an array element with value "test" at array index 2
$array = ARRAYREMOVE($array, 2); // removes the array element with index 2 from the array
#strarray = STRARRAYREMOVE(#strarray, 2); // removes the array element with index 2 from the array
If the given index value exceeds the number of elements in the array , Will throw a runtime exception .
Use the following code to test whether a value exists in the array :
$uintArray = [1, 2 ,3];
#stringArray = ["1", "2", "3"];
IF (INARRAY($uintArray, 1) == true)
{
MSGPASS("UInt Array Test 1: Pass");
}
IF (INARRAY(#stringArray, "1") == true)
{
MSGPASS("String Array Test 1: Pass");
}
Operator :
The following list contains CTT Supported arithmetic 、 All operators of logical or Boolean expressions . List item 1 The operator in has the highest priority during Script Compilation :
1. *, /, %
2. +, -
3. <<, >>
4. <, >, <=, >=
5. ==, !=, eq
6. &
7. |
8. &&
9. ||
Conditional control statements :
CTT The general form of conditional statements in is as follows ,
IF ( $i > 0 )
{
...
}
ELSEIF ( $i == 0 )
{
...
}
ELSE
{
...
}
Loop statement :
LOOP($i; 0; 10)
{
IF ($i > 6)
{
//CONTINUE; BREAK;
}
}
The basic format of the loop statement is as follows , The first parameter of the loop statement is the counter variable . The second parameter is the starting value , The third parameter is the end value of the counter variable . In each iteration of the loop , The counter variable is incremented 1, When the counter variable is equal to the final value, the last cycle is completed . The second and the third LOOP Parameters can also use variables . have access to CONTINUE or BREAK End the current loop or jump out of the loop .
Test Demo :
Now we use CTT Script to create an endless loop , To realize long-term automatic aging test (On/Off).
PACKAGE MyTestCase_Rev10_User; // do not modify this line
USE Basic CMDCLASSVER = 2;
USE SwitchBinary CMDCLASSVER = 2;
TESTSEQ TurnOnOff: "Turn on and off"
$delay1 = 3500; // Delay after OFF command. This value MAY be changed.
$delay2 = 3500; // Delay after ON command. This value MAY be changed.
LOOP($i; 1; 999999)
{
SEND Basic.Set(Value = 0);
WAIT ($delay1);
SEND Basic.Get( );
EXPECT Basic.Report(
$value = CurrentValue == 0);
MSG ("Set the level in a device");
SEND Basic.Set(Value = 99);
WAIT ($delay2);
SEND Basic.Get( );
EXPECT Basic.Report(
$value = CurrentValue == 99);
}
TESTSEQ END // TurnOnOff
CSDN The blog is only used as my notes after work and study , No business purpose , If it violates your privacy or rights , Please feel free to contact the author , I will delete relevant contents in time
边栏推荐
- Nature Aging | 激活FOXM1基因人类寿命或翻倍
- Deep understanding of C language pointer and array
- Arduino window garbled
- Leetcode46. Full arrangement
- [UCOS III source code analysis] - mutually exclusive semaphores (mutually exclusive locks)
- Botu PLC Fuzzy PID control (quantitative factor and proportional factor)
- Remember once, ants were abused on all sides. The water was too deep. Have you built the ferry across the river?
- The author of surging issued the pressure test results
- 安全测试之逻辑漏洞
- leetcode--49字母异位词分组
猜你喜欢

leetcode--49字母异位词分组

创新中心首发!恭喜佳华物链云获MindSpore认证!

Can't go on, mend the foundation -- C thread develops output string program

Wonderful review of usability sig technology sharing activities on July 7

第3章业务功能开发(查看市场活动明细)

Leetcode 49. Alphabetic heterotopic word grouping

Topic selection recommendation of the latest information security graduation project
![[UCOS III source code analysis] - mutually exclusive semaphores (mutually exclusive locks)](/img/82/4f15e59c9e1679b24b350cebfa7935.png)
[UCOS III source code analysis] - mutually exclusive semaphores (mutually exclusive locks)

NPM installation tutorial

leetcode--两个数组交集2
随机推荐
程序员成长第二十篇:刚晋升管理者,有哪些方面要注意?
Transfer function
Why is there an error during ucosiiv2.93 migration? The error message is undefined symbol '_ OSTaskReturnHook‘
1. Shell echo > and echo > >
Byte 3 finally landed. Please keep this hot noodle Sutra "including free information"
Alicloud3 build WordPress
[play with es] es batch / full import data
Error in WordPress establishing database connection
The position of the lines drawn by canvas is disordered
训练过程中出现loss为nan的问题
Nike, the leader of sports, is "red and black" in the trend of consumption recovery
Open source ten questions, a quick start guide for community newcomers
(板子)AcWing841. 字符串哈希
北大&微软联合提出超强时间序列表示学习框架,显著提升多项时间序列任务效果
Definition and usage of several special standards of C language
(赛后补题)(伟大的dfs)K - Counting Time
leetcode--242. 有效的字母异位词
7月7日易用性SIG技术分享活动精彩回顾
【大型电商项目开发】缓存-分布式锁-Redisson简洁&整合-lock锁-Redisson解决死锁-读写锁-闭锁-信号量-44
员工管理系统编写过程中摘要