﻿<?xml version="1.0" encoding="utf-8"?>
<!--Vector Test Automation Editor 2.1.34.0-->
<testmodule title="CANSystemDemo XML Test Module" version="1.1" xmlns="http://www.vector-informatik.de/CANoe/TestModule/1.18">
  <description>For execution of the test module ensure that no macro is running!</description>
  <sut>
    <info>
      <name>CANSystem</name>
      <description>Engine</description>
    </info>
  </sut>
  <engineer>
    <info>
      <name>Editor</name>
      <description>Vector Informatik - Version 1.1</description>
    </info>
  </engineer>
  <templates>
    <testcasetemplate name="Light Test">
      <paramdef name="LightState" default="None" />
      <preparation>
        <initialize title="Switch off the lights" wait="200">
          <cansignal name="Active">None</cansignal>
        </initialize>
      </preparation>
      <assure title="Ensure that the warning flushers are off" terminate="testcase">
        <cansignal name="Active">
          <ne>$LightState$</ne>
        </cansignal>
      </assure>
      <statechange wait="500" title="On activation on console warning flusher is turned on ">
        <in>
          <sysvar name="TurnIndicationLeft" namespace="LightSystem">1</sysvar>
        </in>
        <expected>
          <cansignal name="Active">$LightState$</cansignal>
        </expected>
      </statechange>
      <completion>
        <initialize title="Switch off the light">
          <cansignal name="Active">None</cansignal>
        </initialize>
      </completion>
    </testcasetemplate>
  </templates>
  <testcase title="Start engine" ident="">
    <preparation>
      <initialize title="Start engine" wait="1000">
        <sysvar name="GatewaySwitchIgnition" namespace="ComfortBus">Kl15</sysvar>
        <sysvar name="GatewayStarter" namespace="ComfortBus">1</sysvar>
      </initialize>
    </preparation>
    <conditions>
      <isalive time="1000" title="Ensure engine running">
        <node name="Engine" />
      </isalive>
    </conditions>
    <wait time="2000" title="Wait" />
  </testcase>
  <testgroup title="PowerTrain test">
    <testcase title="Brake test" ident="">
      <description>This test case tests the car speed after braking.</description>
      <preparation>
        <initialize title="Accelerate car" wait="2000">
          <cansignal name="IdleRunning">Running</cansignal>
          <cansignal name="Gear" node="Engine">Gear_1</cansignal>
          <sysvar name="PedalPosition" namespace="PowerTrain">50</sysvar>
        </initialize>
        <initialize title="Accelerate car" wait="2000">
          <cansignal name="Gear" node="Engine">2</cansignal>
        </initialize>
        <initialize title="Accelerate car" wait="2000">
          <cansignal name="Gear" node="Engine">3</cansignal>
        </initialize>
        <awaitvaluematch timeout="5000" title="Wait until car speed reached">
          <cansignal name="CarSpeed" node="Engine">
            <ge>40</ge>
          </cansignal>
        </awaitvaluematch>
      </preparation>
      <statechange wait="1000" title="Brake for 1 sec">
        <in>
          <sysvar name="BrakeActive" namespace="PowerTrain">Break_Active</sysvar>
          <sysvar name="PedalPosition" namespace="PowerTrain">0</sysvar>
        </in>
        <expected>
          <cansignal name="CarSpeed" node="Engine">
            <lt>30</lt>
          </cansignal>
        </expected>
      </statechange>
      <completion>
        <initialize title="Stop braking and accelerate again" wait="1000">
          <sysvar name="BrakeActive" namespace="PowerTrain">Break_Passive</sysvar>
          <sysvar name="PedalPosition" namespace="PowerTrain">50</sysvar>
        </initialize>
      </completion>
    </testcase>
    <testcase title="Window position on driver's door" ident="">
      <description>This test case tests the different positions of the driver's window.</description>
      <preparation>
        <testerconfirmation title="Hint: Disable Signal Generators" passedbutton="yes" timeoutresult="failed" wait="60s">
          <question>To ensure the correct execution of this test case, please go to the panel 'Window Position' and disable the Signal Generators (see screenshot below). Are they disabled?  </question>
          <resource>Testmodul\SignalGenerators.png</resource>
        </testerconfirmation>
        <initialize title="Reset window position" wait="2000">
          <cansignal name="WN_left_down">0</cansignal>
          <cansignal name="WN_left_up">1</cansignal>
        </initialize>
      </preparation>
      <conditions>
        <value_valid title="Ensure allowed values">
          <cansignal name="WN_Position" node="DOOR_le">
            <range><from>0</from><to>15</to></range>
          </cansignal>
        </value_valid>
      </conditions>
      <assure title="Check if driver's window is closed" terminate="testcase">
        <cansignal name="WN_Position" node="DOOR_le">0</cansignal>
      </assure>
      <statechange wait="1000" title="Check window position on opening">
        <in>
          <cansignal name="WN_left_down">1</cansignal>
          <cansignal name="WN_left_up">0</cansignal>
        </in>
        <expected>
          <cansignal name="WN_Position" node="DOOR_le">
            <range><from>9</from><to>11</to></range>
          </cansignal>
        </expected>
      </statechange>
      <statechange wait="1200" title="Check window position on closing">
        <in>
          <cansignal name="WN_left_down">0</cansignal>
          <cansignal name="WN_left_up">1</cansignal>
        </in>
        <expected>
          <cansignal name="WN_Position" node="DOOR_le">
            <eq>0</eq>
          </cansignal>
        </expected>
      </statechange>
      <statechange wait="2000" title="Check window position on complete opening">
        <in>
          <cansignal name="WN_left_up">0</cansignal>
          <cansignal name="WN_left_down">1</cansignal>
        </in>
        <expected>
          <cansignal name="WN_Position" node="DOOR_le">
            <eq>15</eq>
          </cansignal>
        </expected>
      </statechange>
      <statechange wait="2000" title="Check window position on complete closing">
        <in>
          <cansignal name="WN_left_down">0</cansignal>
          <cansignal name="WN_left_up">1</cansignal>
        </in>
        <expected>
          <cansignal name="WN_Position" node="DOOR_le">
            <eq>0</eq>
          </cansignal>
        </expected>
      </statechange>
    </testcase>
  </testgroup>
  <testgroup title="Console test">
    <description>This test group checks some base functionality of the console.</description>
    <testgroup title="Lights test">
      <description>This test group tests the basic functionality of the lights.</description>
      <templateinstances template="Light Test">
        <testcaseinstance title="Turn light left" ident="">
          <paramvalue name="LightState">Turn_left</paramvalue>
        </testcaseinstance>
      </templateinstances>
    </testgroup>
    <testcase title="Head Lights" ident="">
      <description>This test case tests the display of the state of the head lights in the console.</description>
      <initialize title="Switch the head lights on" wait="500">
        <cansignal name="Light">1</cansignal>
      </initialize>
      <testerconfirmation title="Ensure that the state of the head lights is displayed in dashboard" passedbutton="yes" timeoutresult="failed" wait="60s">
        <question>Is the 'head light' symbol is displayed in the dashboard?</question>
        <resource>Panels\Bitmaps\DashboardSwitchLight.bmp</resource>
      </testerconfirmation>
      <completion>
        <initialize title="Switch the head lights off" wait="500">
          <cansignal name="Light">0</cansignal>
        </initialize>
      </completion>
    </testcase>
    <testcase title="Change of radio station" ident="">
      <preparation>
        <initialize title="Start radio" wait="1000">
          <sysvar name="RadioOnOff" namespace="ComfortBus">1</sysvar>
        </initialize>
        <initialize title="Set initial radio station" wait="1000">
          <sysvar name="SetRadioChannel_1" namespace="ComfortBus">0</sysvar>
          <sysvar name="SetRadioChannel_2" namespace="ComfortBus">1</sysvar>
        </initialize>
      </preparation>
      <statecheck wait="2000" title="Check correct display of radio station">
        <expected>
          <sysvar name="SetRadioChannelDisplay" namespace="ComfortBus">FM1:         RBL 3                 92.2</sysvar>
        </expected>
      </statecheck>
      <statechange wait="2000" title="Check correct display of radio station (after switch)">
        <in>
          <sysvar name="SetRadioChannel_2" namespace="ComfortBus">0</sysvar>
          <sysvar name="SetRadioChannel_3" namespace="ComfortBus">1</sysvar>
        </in>
        <expected>
          <sysvar name="SetRadioChannelDisplay" namespace="ComfortBus">FM1:         Radio CANoe       90.0</sysvar>
        </expected>
      </statechange>
      <completion>
        <initialize title="Stop radio" wait="1000">
          <sysvar name="RadioOnOff" namespace="ComfortBus">0</sysvar>
        </initialize>
      </completion>
    </testcase>
  </testgroup>
  <testgroup title="Gateway test">
    <description>This test group tests the routing of the gateway node.</description>
    <testcase title="Check the gateway routing by background checks " ident="">
      <conditions>
        <requestresponsecheck timeout="1000" title="Check the routing of the car speed">
          <request>
            <canmsg id="ABSdata" />
          </request>
          <response>
            <canmsg id="Gateway_2">
              <signalref name="CarSpeed" refname="CarSpeed" />
            </canmsg>
          </response>
        </requestresponsecheck>
        <requestresponsecheck timeout="200" title="Check the routing of the engine state">
          <request>
            <canmsg id="GearBoxInfo" />
          </request>
          <response>
            <canmsg id="Gateway_1">
              <signalref name="Gear" refname="Gear" />
            </canmsg>
          </response>
        </requestresponsecheck>
      </conditions>
      <initialize title="Braking down" wait="1000">
        <cansignal name="Gear" node="Engine">Gear_2</cansignal>
        <sysvar name="PedalPosition" namespace="PowerTrain">0</sysvar>
      </initialize>
      <initialize title="Braking down" wait="1000">
        <cansignal name="Gear" node="Engine">Gear_1</cansignal>
      </initialize>
    </testcase>
  </testgroup>
  <testgroup title="Diagnostic functionality">
    <testcase title="Check ECU information" ident="">
      <description>This test case asks the ECU "Engine" for some information:\n- ECU identification\n- Serial Number\n- Coding\nThe return values are checked.</description>
      <preparation>
        <diagservice title="Enable Default Session" ecu="Engine" service="DEFAULT_SESSION_Start" timeout="500" result="pos">
          <diagrequest />
          <diagresponse />
        </diagservice>
      </preparation>
      <diagservice title="Check ECU Identification" ecu="Engine" service="ECU_Identification_Read" timeout="200" result="pos">
        <diagrequest />
        <diagresponse>
          <diagparam qualifier="Diagnostic_Identification">0x01</diagparam>
        </diagresponse>
      </diagservice>
      <diagservice title="Check Serial Number" ecu="Engine" service="Serial_Number_Read" timeout="200" result="pos">
        <diagrequest />
        <diagresponse>
          <diagparam qualifier="Serial_Number">3141528</diagparam>
        </diagresponse>
      </diagservice>
      <diagservice title="Check Coding" ecu="Engine" service="Coding_Read" timeout="200" reportservicedetails="always" result="pos">
        <diagrequest />
        <diagresponse>
          <diagparam qualifier="Code_string.Country_variant">
            <one_of><eq>Europe</eq><eq>USA</eq></one_of>
          </diagparam>
          <diagparam qualifier="Code_string.Vehicle_type">Coupe</diagparam>
        </diagresponse>
      </diagservice>
      <completion>
        <diagservice title="Disable Default Session" ecu="Engine" service="STOP_SESSION_Stop" timeout="200" result="pos">
          <diagrequest />
          <diagresponse />
        </diagservice>
      </completion>
    </testcase>
    <testcase title="Clear / basically check fault memory" ident="">
      <faultmem_status title="Number of DTCs &gt;= 0" ecu="Engine" query="identified" reportservicedetails="always">
        <faultmem_status_lookup>
          <dtcstatus>
            <status_test_failed>true</status_test_failed>
            <status_confirmed>true</status_confirmed>
          </dtcstatus>
        </faultmem_status_lookup>
        <expected_dtccount>
          <ge>0</ge>
        </expected_dtccount>
      </faultmem_status>
      <faultmem_clear title="Clear all DTCs" ecu="Engine" />
      <faultmem_status title="Number of DTCs == 0" ecu="Engine" query="identified">
        <faultmem_status_lookup>
          <dtcstatus>
            <status_test_failed>true</status_test_failed>
            <status_confirmed>true</status_confirmed>
          </dtcstatus>
        </faultmem_status_lookup>
        <expected_dtccount>0</expected_dtccount>
      </faultmem_status>
    </testcase>
  </testgroup>
  <testgroup title="Network Managment">
    <preparation>
      <capltestfunction name="StopTesterPresent" title="Stop Tester Present" />
    </preparation>
    <testcase title="Stop Engine" ident="">
      <preparation>
        <initialize title="Stop engine" wait="1000">
          <sysvar name="GatewaySwitchIgnition" namespace="ComfortBus">Off</sysvar>
        </initialize>
      </preparation>
      <conditions>
        <goessleep time="8s">
          <node name="Engine" />
        </goessleep>
      </conditions>
      <wait time="10s" title="Wait for 10 seconds" />
    </testcase>
    <testcase title="Wake Up for a short time" ident="">
      <conditions>
        <isalive time="2000">
          <node name="Engine" />
        </isalive>
      </conditions>
      <initialize title="Wake up node Engine" wait="500">
        <sysvar name="NMWakeUp27_PT" namespace="NMTester">1</sysvar>
      </initialize>
      <wait time="3s" title="Wait for 3 seconds" />
    </testcase>
    <testcase title="Goes to sleep after a short time" ident="">
      <conditions>
        <goessleep time="8s">
          <node name="Engine" />
        </goessleep>
      </conditions>
      <wait time="10s" title="Wait for 10 seconds" />
    </testcase>
  </testgroup>
</testmodule>