XML测试模块
<testmodule title="NetworkTester_XML" version="1.0">
<testgroup title="DTC920723 test 使用继电器Channel3">
<nettestcase name="testcase1" title="TC-1 连接时间为1.0S,不应记录DTC"
class="NetLibrary" assembly="NetTestLib">
</nettestcase>
<nettestcase name="testcase2" title="TC-2 连接时间为1.8S,不应记录DTC"
class="NetLibrary" assembly="NetTestLib">
</nettestcase>
<nettestcase name="testcase3" title="TC-3 连接时间为2.5S,应记录DTC"
class="NetLibrary" assembly="NetTestLib">
</nettestcase>
<nettestcase name="testcase4" title="TC-4 连接时间为3.0S,应记录DTC"
class="NetLibrary" assembly="NetTestLib">
</nettestcase>
</testgroup>
</testmodule>
检查DUT发出的报文周期
using System;
using Vector.Tools;
using Vector.CANoe.Runtime;
using Vector.CANoe.Sockets;
using Vector.CANoe.Threading;
using Vector.Diagnostics;
using Vector.Scripting.UI;
using Vector.CANoe.TFS;
using Vector.CANoe.VTS;
using NetworkDB;
public class TestModuleDome: TestModule
{
public override void Main()
{
Title = "C# Test Module";
TestGroupBegin("CycleTime Test ", "");
ChkCycleTime(0x134, 8, 20, 0.1);
ChkCycleTime(0x1D0, 8, 50, 0.1);
ChkCycleTime(0x1D1, 8, 20, 0.1);
ChkCycleTime(0x4F4, 8, 1000, 0.1);
ChkCycleTime(0x3D0, 8, 50, 0.1);
TestGroupEnd();
}
[TestCase("ChkCycleTime Test")]
public static void ChkCycleTime(int ID, int DLC, float CycleTime, double diff)
{
int kTIMEOUT;
int minAbsoluteCycleTime;
int maxAbsoluteCycleTime;
double minAbsoluteCycleTime_f = CycleTime * (1 - diff);
double maxAbsoluteCycleTime_f = CycleTime * (1 + diff);
byte DLC2;
DLC2 = (byte)DLC;
minAbsoluteCycleTime = (int)minAbsoluteCycleTime_f;
maxAbsoluteCycleTime = (int)maxAbsoluteCycleTime_f;
kTIMEOUT = 10 * maxAbsoluteCycleTime;
CANFrame frame = new CANFrame(ID, DLC2);
ICheck check = new AbsoluteCycleTimeCheck<CANFrame>(frame, CheckType.Condition, minAbsoluteCycleTime, maxAbsoluteCycleTime);
check.Activate();
Execution.Wait(kTIMEOUT);
check.Deactivate();
check.Dispose();
}
}