diff options
Diffstat (limited to 'runtime/org.eclipse.etrice.modellib.java/model/Tests.room')
-rw-r--r-- | runtime/org.eclipse.etrice.modellib.java/model/Tests.room | 167 |
1 files changed, 1 insertions, 166 deletions
diff --git a/runtime/org.eclipse.etrice.modellib.java/model/Tests.room b/runtime/org.eclipse.etrice.modellib.java/model/Tests.room index cb2097af7..097b72e5e 100644 --- a/runtime/org.eclipse.etrice.modellib.java/model/Tests.room +++ b/runtime/org.eclipse.etrice.modellib.java/model/Tests.room @@ -1,4 +1,4 @@ -RoomModel room.basic.etunit { +RoomModel room.basic.test { import room.basic.service.timing.* from "TimingService.room" import room.basic.types.* from "Types.room" @@ -14,169 +14,4 @@ RoomModel room.basic.etunit { target = { SubSystemClass, ActorClass } } - /** - * Creates an etUnit test suite. Test cases can be added by creating instances of ActorClass <i>TestSuiteActor</i>. - */ - abstract ActorClass TestSuiteActor { - Interface { - SPP timer : PTimer - SPP tcLifecycle : PTestLifecycle - } - Structure { - LayerConnection relay_sap timer satisfied_by timingService.timer - LayerConnection relay_sap tcLifecycle satisfied_by lifecycleActor.fct - ActorRef timingService: ATimingService - ActorRef lifecycleActor : TestLifecycleActor - } - Behavior { - Operation getTestSuiteName() : string { - "return getName();" - } - ctor { - "etUnit_open(\"log/testlog\", getTestSuiteName());" - "etUnit_openTestSuite(getTestSuiteName());" - } - dtor { - "etUnit_closeTestSuite();" - "etUnit_close();" - } - } - } - - abstract async ActorClass TestCaseActor { - Structure { - Attribute tcTimeoutIgnore : boolean - Attribute tcCaseId : int32 - SAP tcLifecycle : PTestLifecycle - SAP tcTimer : PTimer - } - Behavior { - Operation getTestCaseName() : string { - "return getName();" - } - Operation startTimeout(timeMs: int32){ - "tcTimeoutIgnore = false;" - "tcTimer.startTimeout(timeMs);" - } - Operation invalidateTimeout(){ - "tcTimeoutIgnore = true;" - } - StateMachine { - Transition init: initial -> wait4Start { - action { - "invalidateTimeout();" - } - } - Transition trFinish: tpFinish of testing -> finish - Transition trTimeout: testing -> timeout { - triggers { - <timeout: tcTimer guard { - "!tcTimeoutIgnore" - }> - } - action { - "invalidateTimeout();" - } - } - Transition tr0: wait4Start -> testing { - triggers { - <startTestCase: tcLifecycle> - } - } - State testing { - subgraph { - ExitPoint tpFinish - } - } - State timeout { - entry { - "EXPECT_FALSE(tcCaseId, \"timeout\", true);" - "etUnit_closeTestCase(tcCaseId);" - "tcLifecycle.finishedTestCase();" - } - } - State finish { - entry { - "etUnit_closeTestCase(tcCaseId);" - "tcLifecycle.finishedTestCase();" - } - } - State wait4Start { - exit { - "tcCaseId = etUnit_openTestCase(getTestCaseName());" - } - } - } - } - } - - ActorClass TestLifecycleActor { - Interface { - SPP fct: PTestLifecycle - } - Structure { - ServiceImplementation of fct - Attribute entireTestTimeout : int32 = "5000" - Attribute sequentialExecution : boolean = "true" - Attribute tcCurrentIdx : int32 = "0" - SAP timer : PTimer - } - Behavior { - StateMachine { - Transition init: initial -> idle { - action { - "//printf(\"TestLifecycleActor (%s) starting with %d test cases\\n\", getName(), fct.getReplication());" - "if(fct.getReplication() == 0)" - "\tetUnit_testFinished(-1);" - "else" - "\ttimer.startTimeout(entireTestTimeout);" - "" - "if(!sequentialExecution)" - "\tfct.startTestCase();" - } - } - Transition tr1: idle -> cp cp0 { - triggers { - <finishedTestCase: fct> - } - action { - "tcCurrentIdx++;" - } - } - Transition tr2: idle -> terminate { - triggers { - <timeout: timer> - } - } - Transition tr3: cp cp0 -> idle - Transition tr4: cp cp0 -> terminate { - cond { - "tcCurrentIdx >= fct.getReplication()" - } - } - ChoicePoint cp0 - State idle { - entry { - "if(sequentialExecution)" - "\tfct[tcCurrentIdx].startTestCase();" - } - } - State terminate { - entry { - "etUnit_testFinished(-1);" - } - } - } - } - } - - ProtocolClass PTestLifecycle { - incoming { - Message finishedTestCase() - } - outgoing { - Message startTestCase() - } - } - }
\ No newline at end of file |