当先锋百科网

首页 1 2 3 4 5 6 7

在这里插入图片描述
/@!Encoding:936/
includes
{

}

variables
{

}

Init_Test_Condition()
{
@Debug::WarningFlag=0;
@Gateway::Drvdoor=0;
@Gateway::Psgdoor=0;
@Gateway::LRdoor=0;
@Gateway::RRdoor=0;
@Gateway::Turnsignal=0;
@HUT::LeftTurnCondition=0;
@HUT::RightTurnCondition=0;
@Gateway::UnlockButton=1;
testWaitForTimeout(100);
@Gateway::UnlockButton=0;
testWaitForTimeout(100);
@Gateway::LockButton=1;
testWaitForTimeout(100);
@Gateway::LockButton=0;
@Tbox::`Message=0;
testWaitForTimeout(400);
}

Lock_Button_Press()
{
@Gateway::LockButton=1;
testWaitForTimeout(100);
@Gateway::LockButton=0;
}

Unlock_Button_Press()
{
@Gateway::UnlockButton=1;
testWaitForTimeout(100);
@Gateway::UnlockButton=0;
}
———————————————————————————
/@!Encoding:936/
includes
{
#include “Tester.cin”
}

variables
{
const long kTIMEOUT=500;
}

void Maintest()
{
testModuleTitle(“Function Test”);
testModuleDescription(“Function tests for sample system”);

testGroupBegin(“Event Function Test”,“Test for liner response function”);
Init_Test_Condition();
Test_Unlock_Lock_Function();
Test_Drvdoor_Indicator_Function();
Test_PassengerDoor_Indicator_Function();
Test_LRDoor_Indicator_Function();
Test_RRDoor_Indicator_Function();
Init_Test_Condition();
Test_Anti_Mislock_Function();
Init_Test_Condition();
Test_TI_Failure_Warning_Msg_Function();
Test_Stolen_Warning_Function();
testGroupEnd();

testGroupBegin(“Cyclic Fucntion Test”,“Test for cyclic response function”);
Init_Test_Condition();
Test_Unlock_Double_Flash_Function();
Init_Test_Condition();
Test_TurnIndicator_Function();
Init_Test_Condition();
testGroupEnd();
}

//单事件型测试函数参数如下
//(测试用例号,测试用例标题,步骤1名称,步骤2名称,条件系统变量a,条件系统变量b,条件1数值,条件2数值,检测信号,检测信号数值1,检测信号数值2)
Test_EventType_Function(char item[],char title[],char teststep1[],char teststep2[],sysvarIntConDa,sysvarIntConDb,int CD1,int CD2,signal*output,int op1,int op2)
{
dword CheckId1,CheckId2;
char itemB[10],titleB[100],teststep1P[100],teststep1F[100],teststep2P[100],teststep2F[100],ts1I[10],ts2I[10],titleP[100],titleF[100];
snprintf(itemB,elcount(itemB),“TC-%s”,item);
snprintf(titleB,elcount(titleB),“TC-%s:%s”,item,title);
snprintf(teststep1P,elcount(teststep1P),"%s Pass",teststep1);
snprintf(teststep1F,elcount(teststep1F),"%s Fail",teststep1);
snprintf(teststep2P,elcount(teststep2P),"%s Pass",teststep2);
snprintf(teststep2F,elcount(teststep2F),"%s Fail",teststep2);
snprintf(ts1I,elcount(ts1I),"%s.1",item);
snprintf(ts2I,elcount(ts2I),"%s.2",item);
snprintf(titleP,elcount(titleP),"%s Pass",title);
snprintf(titleF,elcount(titleF),"%s Fail",title);

testCaseTitle(itemB,titleB);
testStep(ts1I,teststep1);
@ConDa=CD1;
CheckId1=ChkStart_MsgSignalValueInvalid(output,op1,op1);
testWaitForTimeout(kTIMEOUT);
@Debug::WarningFlag=ChkQuery_EventSignalValue(CheckId1);
if(ChkQuery_EventSignalValue(CheckId1)==op1)
{
testStep(ts1I,teststep1P);
}
else
{
testStep(ts1I,teststep1F);
}
testStep(ts2I,teststep2);
@ConDb=CD2;
CheckId2=ChkStart_MsgSignalValueInvalid(output,op2,op2);
testWaitForTimeout(kTIMEOUT);
if(ChkQuery_EventSignalValue(CheckId2)==op2)
{
testStep(ts2I,teststep2P);
}
else
{
testStep(ts2I,teststep2F);
}
if((ChkQuery_EventSignalValue(CheckId1)==op1)&&(ChkQuery_EventSignalValue(CheckId2)==op2))
{
testStepPass("",titleP);
}
else
{
testStepFail("",titleF);
}
ChkControl_Destroy(CheckId1);
ChkControl_Destroy(CheckId2);
}

//TC-1 Test Unlock Lock Function
testcase Test_Unlock_Lock_Function()
{
dword CheckId1,CheckId2;
testCaseTitle(“TC-1”,“TC-1:Test Unlock Lock Function”);

testStep(“1.1”,“Test Unlock Function”);
Unlock_Button_Press();
CheckId1=ChkStart_MsgSignalValueInvalid(DoorLockSts,3,3);
testWaitForTimeout(kTIMEOUT);
if(ChkQuery_EventSignalValue(CheckId1)==3)
{
testStep(“1.1”,“Test Unlock Function Pass”);
}
else
{
testStep(“1.1”,“Test Unlock Function Fail”);
}

testStep(“1.2”,“Test Lock Function”);
Lock_Button_Press();
CheckId2=ChkStart_MsgSignalValueInvalid(DoorLockSts,1,1);
testWaitForTimeout(kTIMEOUT);
if(ChkQuery_EventSignalValue(CheckId2)==1)
{
testStep(“1.2”,“Test Lock Function Pass”);
}
else
{
testStep(“1.2”,“Test Lock Function Fail”);
}
if((ChkQuery_EventSignalValue(CheckId1)==3)&&(ChkQuery_EventSignalValue(CheckId2)==1))
{
testStepPass("",“Test Unlock Lock Function Pass”);
}
else
{
testStepFail("",“Test Unlock Lock Function Fail”);
}
ChkControl_Destroy(CheckId1);
ChkControl_Destroy(CheckId2);
}

//TC-2 Test Drvdoor Indicator Function
testcase Test_Drvdoor_Indicator_Function()
{
dword CheckId1,CheckId2;
testCaseTitle(“TC-2”,“TC-2:Test Drvdoor Indicator Function”);

testStep(“2.1”,“Test Door Open Function”);
@Gateway::Drvdoor=1;
CheckId1=ChkStart_MsgSignalValueInvalid(DrvDoorSts,1,1);
testWaitForTimeout(kTIMEOUT);
if(ChkQuery_EventSignalValue(CheckId1)==1)
{
testStep(“2.1”,“Test Door Open Function Pass”);
}
else
{
testStep(“2.1”,“Test Door Open Function Fail”);
}

testStep(“2.2”,“Test Door Close Function”);
@Gateway::Drvdoor=0;
CheckId2=ChkStart_MsgSignalValueInvalid(DrvDoorSts,0,0);
testWaitForTimeout(kTIMEOUT);
if(ChkQuery_EventSignalValue(CheckId2)==0)
{
testStep(“2.2”,“Test Door Close Function Pass”);
}
else
{
testStep(“2.2”,“Test Door Close Function Fail”);
}
if((ChkQuery_EventSignalValue(CheckId1)==1)&&(ChkQuery_EventSignalValue(CheckId2)==0))
{
testStepPass("",“Test Drvdoor Indicator Function Pass”);
}
else
{
testStepFail("",“Test Drvdoor Indicator Function Fail”);
}
ChkControl_Destroy(CheckId1);
ChkControl_Destroy(CheckId2);
}

//TC-3 Test PassengerDoor Indicator Function
testcase Test_PassengerDoor_Indicator_Function()
{
Test_EventType_Function(“3”,“Test PassengerDoor Indicator Function”,“Test Door Open Function”,“Test Door Close Function”,sysvar::Gateway::Psgdoor,sysvar::Gateway::Psgdoor,1,0,PassengerDoorSts,1,0);
}

//TC-4 Test LRDoor Indicator Function
testcase Test_LRDoor_Indicator_Function()
{
Test_EventType_Function(“4”,“Test LRDoor Indicator Function”,“Test Door Open Function”,“Test Door Close Function”,sysvar::Gateway::LRdoor,sysvar::Gateway::LRdoor,1,0,LRDoorSts,1,0);
}

//TC-5 Test RRDoor Indicator Function
testcase Test_RRDoor_Indicator_Function()
{
Test_EventType_Function(“5”,“Test RRDoor Indicator Function”,“Test Door Open Function”,“Test Door Close Function”,sysvar::Gateway::RRdoor,sysvar::Gateway::RRdoor,1,0,RRDoorSts,1,0);
}

//TC-6 Test Anti Mislock Function
testcase Test_Anti_Mislock_Function()
{
dword CheckId;
int a=0,b=0,c=0,d=0,failflag=0;
char failcomment[100];
testcasetitle(“TC-6”,“TC-6:Test Anti Mislock Function”);
Unlock_Button_Press();
for(;a<2;)
{
@Gateway::Drvdoor=a;a++;
for(;b<2;)
{
@Gateway::Psgdoor=b;b++;
for(;c<2;)
{
@Gateway::LRdoor=c;c++;
for(;d<2;)
{
@Gateway::RRdoor=d;d++;
testWaitForTimeout(100);
Lock_Button_Press();
CheckId=ChkStart_MsgSignalValueInvalid(DoorLockSts,3,3);
testWaitForTimeout(kTIMEOUT);
if((a1)&&(b1)&&(c1)&&(d1)&&(ChkQuery_EventSignalValue(CheckId)!=3))
{
Unlock_Button_Press();
}
else
{
if(ChkQuery_EventSignalValue(CheckId)!=3)
{
failflag=1;
snprintf(failcomment,elCount(failcomment),“Test Under Door Condition Drv:%i,Psg:%i,LR:%i,RR:%i Fail”,(a-1),(b-1),(c-1),(d-1));
testStep("",failcomment);
Unlock_Button_Press();
}
}
}d=0;
}
if(c2)
{
c=0;
}
}
if(b
2)
{
b=0;
}
}
if(failflag==0)
{
testStepPass("",“Test Anti Mislock Function Pass”);
}
else
{
testStepFail("",“Test Anti Mislock Function Fail”);
}
ChkControl_Destroy(CheckId);
}

//TC-7 Test TI Failure Warning Msg Function
testcase Test_TI_Failure_Warning_Msg_Function()
{
dword CheckId;
testCaseTitle(“TC-7”,“TC-7:Test TI Failure Warning Msg Function”);
$AudioMuteSts=1;
CheckId=ChkStart_MsgSignalValueInvalid(sysvar::Tbox::`Message,1,1);
testWaitForTimeout(kTIMEOUT);
if(ChkQuery_EventSignalValue(CheckId)==1)
{
testStepPass("",“Test TI Failure Warning Msg Function Pass”);
}
else
{
testStepFail("",“Test TI Failure Warning Msg Function Fail”);
}
ChkControl_Destroy(CheckId);
}

//TC-8 Test Stolen Warning Function
testcase Test_Stolen_Warning_Function()
{
dword CheckId;
int failflag=0;
testCaseTitle(“TC-8”,“TC-8:Test Stolen Warning Function”);
Init_Test_Condition();
@Gateway::Drvdoor=1;
CheckId=ChkStart_MsgSignalValueInvalid(sysvar::Tbox::Message,2,2); testWaitForTimeout(kTIMEOUT); if(ChkQuery_EventSignalValue(CheckId)==2) { testStep("8.1","DrvDoor Stolen Warning Function Pass"); } else { failflag=1; teststep("8.1","DrvDoor Stolen Warning Function Fail"); } Init_Test_Condition(); @Gateway::Psgdoor=1; CheckId=ChkStart_MsgSignalValueInvalid(sysvar::Tbox::Message,2,2);
testWaitForTimeout(kTIMEOUT);
if(ChkQuery_EventSignalValue(CheckId)==2)
{
testStep(“8.2”,“PassengerDoor Stolen Warning Function Pass”);
}
else
{
failflag=1;
teststep(“8.2”,“PassengerDoor Stolen Warning Function Fail”);
}
Init_Test_Condition();
@Gateway::LRdoor=1;
CheckId=ChkStart_MsgSignalValueInvalid(sysvar::Tbox::Message,2,2); testWaitForTimeout(kTIMEOUT); if(ChkQuery_EventSignalValue(CheckId)==2) { testStep("8.3","LRDoor Stolen Warning Function Pass"); } else { failflag=1; teststep("8.3","LRDoor Stolen Warning Function Fail"); } Init_Test_Condition(); @Gateway::RRdoor=1; CheckId=ChkStart_MsgSignalValueInvalid(sysvar::Tbox::Message,2,2);
testWaitForTimeout(kTIMEOUT);
if(ChkQuery_EventSignalValue(CheckId)2)
{
testStep(“8.4”,“RRDoor Stolen Warning Function Pass”);
}
else
{
failflag=1;
teststep(“8.4”,“RRDoor Stolen Warning Function Fail”);
}
if(failflag
0)
{
testStepPass("",“Test Stolen Warning Function Pass”);
}
else
{
testStepFail("",“Test Stolen Warning Function Fail”);
}
ChkControl_Destroy(CheckId);
}

//TC-9 Test Unlock Double Flash Function
testcase Test_Unlock_Double_Flash_Function()
{
dword CheckId,CheckId2;
testCaseTitle(“TC-9”,“TC-9:Test Unlock Double Flash Function”);
Unlock_Button_Press();
CheckId=ChkStart_MsgSignalValueInvalid(sysvar::HUT::LeftTI,1,1);
CheckId2=ChkStart_MsgSignalValueInvalid(sysvar::HUT::RightTI,1,1);
testwaitfortimeout(3000);
@Debug::WarningFlag=ChkQuery_NumEvents(CheckId);
if((ChkQuery_NumEvents(CheckId)==2)&&(ChkQuery_NumEvents(CheckId2)==2))
{
testStepPass("",“Test Unlock Double Flash Function Pass”);
}
else
{
testStepFail("",“Test Unlock Double Flash Function Fail”);
}
ChkControl_Destroy(CheckId);
ChkControl_Destroy(CheckId2);
}

//TC-10 Test TurnIndicator Function
testcase Test_TurnIndicator_Function()
{
dword CheckId;
int failflag=0;
testCaseTitle(“TC-10”,“TC-10:Test TurnIndicator Function”);
@Gateway::Turnsignal=1;
CheckId=ChkStart_MsgSignalValueInvalid(sysvar::HUT::LeftTI,1,1);
testWaitForTimeout(3000);
if(ChkQuery_NumEvents(CheckId)>2)
{
testStep(“10.1”,“Left TurnIndicator Function Pass”);
}
else
{
failflag=1;
testStep(“10.1”,“Left TurnIndicator Function Fail”);
}
@Debug::WarningFlag=ChkQuery_StatProbeIntervalMax(CheckId);
if((400<ChkQuery_StatProbeIntervalMax(CheckId))&&(ChkQuery_StatProbeIntervalMax(CheckId)<500))
{
testStep(“10.2”,“Left TurnIndicator Frequency Pass”);
}
else
{
failflag=1;
testStep(“10.2”,“Left TurnIndicator Frequency Fail”);
}
@Gateway::Turnsignal=2;
CheckId=ChkStart_MsgSignalValueInvalid(sysvar::HUT::RightTI,1,1);
testWaitForTimeout(3000);
if(ChkQuery_NumEvents(CheckId)>2)
{
testStep(“10.3”,“Right TurnIndicator Function Pass”);
}
else
{
failflag=1;
testStep(“10.3”,“Right TurnIndicator Function Fail”);
}
if((400<ChkQuery_StatProbeIntervalMax(CheckId))&&(ChkQuery_StatProbeIntervalMax(CheckId)<500))
{
testStep(“10.4”,“Right TurnIndicator Frequency Pass”);
}
else
{
failflag=1;
testStep(“10.4”,“Right TurnIndicator Frequency Fail”);
}
if(failflag==0)
{
testStepPass("",“Test TurnIndicator Function Pass”);
}
else
{
testStepFail("",“Test TurnIndicator Function Fail”);
}
ChkControl_Destroy(CheckId);
}