CANoe学习笔记-第十四章节-CANoe自动化测试

前言:利用CANoe的Test Step 功能实现自动化测试,是学习CAPL语言的一个重要目的及目标

新建一个Test工程

第二步骤

3.鼠标右击Test1,选择Configuration,打开CAPL TEST Module Configuration对话框,给Test Script 添加NetworkTester.can文件,文件程序如下:程序来源《CANoe入门到精通教材》

includes
{
  
}

variables
{
  dword gCycCheckId;
  
  int gUndifnedMsgCheckResult;
  
  const long kMIN_CYCLE_TIME = 40;
  const long kMAX_CYCLE_TIME = 60;
  const long Light_MIN_CYCLE_TIME = 490;
  const long Light_MAX_CYCLE_TIME = 510;
  const long kTIMEOUT = 4000;
}

void MainTest()
{
  TestModuleTitle ("NetworkTester");
  TestModuleDescription ("Message Specication Test and Function Test Demo.");
  TestGroupBegin("Check msg cycle time", "Check the differ message cycle time");
    Init_Test_Condition();
    CheckMsgEngineData();
    CheckMsgVehicledata();
    CheckMsgGear_Info();
    CheckMsgIgnition_Info();
    CheckMsgLight_Info();
  TestGroupEnd ();
  
  TestGroupBegin("Check msg DLC", "Check DLC of a message"); 
    CheckDLCLock_Info();
  TestGroupEnd ();
  
  TestGroupBegin("Check undefined msg", "Check the undefined message"); 
    CheckUndefinedMessage();
  TestGroupEnd ();
  
  TestGroupBegin("Function Test", "Check the engine speed after setup"); 
    CheckEngine_Speed();
  TestGroupEnd();
}
Init_Test_Condition()
{
  @Vehicle_Key::Unlock_Car =1;
  @Vehicle_Key::Car_Driver=0;
  @Vehicle_Key::Key_State=2;
  testWaitForTimeout(500);
}
testcase CheckMsgEngineData()
{
  float lCycMinCycleTime;  // Minimum relative distance 
  float lCycMaxCycleTime;  // Maximum relative distance
  
  lCycMinCycleTime = kMIN_CYCLE_TI
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值