| /////////////////////////////////////////////////////////////////////////////// |
| // // |
| // Copyright (c) 2000-2018 Ericsson Telecom AB // |
| // // |
| // All rights reserved. This program and the accompanying materials // |
| // are made available under the terms of the Eclipse Public License v2.0 // |
| // which accompanies this distribution, and is available at // |
| // https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.html // |
| /////////////////////////////////////////////////////////////////////////////// |
| |
| /////////////////////////////////////////////////////////// |
| // Module: EPTF_LGenBaseStatsUI_Test |
| // |
| // Purpose: |
| // This module tests the statistical GUI of the LGenBase feature |
| // |
| // Module Parameters: |
| // tsp_modulePar_entityTypes - |
| // tsp_modulePar_entityGroups |
| // tsp_modulePar_compactFsmTables |
| // tsp_modulePar_trafficCases |
| // tsp_modulePar_scenarios |
| // tsp_modulePar_Scenarios2Grps |
| // |
| // Module depends on: |
| // |
| // Current Owner: |
| // ELSZSKU |
| // |
| // Last Review Date: |
| // 2008-02-18 |
| // |
| // |
| /////////////////////////////////////////////////////////// |
| module EPTF_LGenBaseStatsUI_Test{ |
| import from EPTF_CLL_LGenBaseStatsUI_Functions all; |
| import from EPTF_CLL_LGenBaseStatsUI_Definitions all; |
| import from EPTF_CLL_LGenBaseStats_Functions all |
| import from EPTF_CLL_UIHandler_Definitions all; |
| import from EPTF_CLL_UIHandler_WidgetFunctions all; |
| import from EPTF_CLL_UIHandlerClient_Definitions all; |
| import from EPTF_CLL_UIHandlerClient_Functions all; |
| import from EPTF_CLL_UIHandler_XULFunctions all; |
| |
| import from EPTF_CLL_LGenBase_Definitions all; |
| import from EPTF_CLL_LGenBase_ConfigDefinitions all; |
| import from EPTF_CLL_Base_Functions all; |
| import from EPTF_CLL_LGenBase_Functions all; |
| import from EPTF_CLL_LGenBase_StepFunctions all; |
| import from EPTF_CLL_LGenBase_ConfigFunctions all; |
| import from EPTF_CLL_LGenBase_TrafficFunctions all; |
| import from EPTF_CLL_LGenBase_EventHandlingFunctions all; |
| |
| import from paramDemoAppLib_Definitions all; |
| import from paramDemoAppLib_Functions all; |
| import from XTDP_PDU_Defs language "ASN.1:2002" all; |
| import from EPTF_CLL_Common_Definitions all; |
| import from EPTF_CLL_Variable_Functions all; |
| //import from EPTF_CLL_Scheduler_Definitions all; |
| import from EPTF_CLL_RBTScheduler_Functions all; |
| |
| modulepar EPTF_LGenBase_TcMgmt_EntityTypeDeclaratorList tsp_modulePar_entityTypes := {}; |
| modulepar EPTF_LGenBase_TcMgmt_EntityGrpDeclaratorList tsp_modulePar_entityGroups := {}; |
| modulepar EPTF_LGenBase_TcMgmt_CompactFsmTableDeclaratorList tsp_modulePar_compactFsmTables := {}; |
| modulepar EPTF_LGenBase_TcMgmt_tcTypeDeclaratorList tsp_modulePar_trafficCases := {}; |
| modulepar EPTF_LGenBase_TcMgmt_ScenarioDeclaratorList tsp_modulePar_scenarios := {}; |
| modulepar EPTF_LGenBase_TcMgmt_Scenarios2GrpList tsp_modulePar_Scenarios2Grps := {}; |
| |
| modulepar float tsp_testDuration := 1.2; |
| modulepar integer tsp_numEntities := 100; |
| modulepar charstring tsp_LGenBaseStatsUI_mainWindow := ""; |
| modulepar charstring tsp_scenariosParentWidgetName := "EPTF_Main_Tabbox"; |
| |
| function f_setVerdictKind(in boolean success){ |
| if(success){ |
| setverdict ( pass ); |
| }else{ |
| setverdict ( fail ); |
| } |
| } |
| |
| function f_LGenBaseRegisterTest_groupRegisterFinishFunction_FT(in integer pl_idx) |
| runs on LGenBaseTest_CT{ |
| log("--- Registration finished.") |
| //log(v_LGenBase_trafficCases) |
| } |
| |
| function f_LGenBaseRegisterTest_doTrafficFinishedFn(in integer pl_idx) |
| runs on LGenBaseTest_CT{ |
| log("--- DoTraffic_finished of TC ",f_EPTF_LGenBase_getTcUniqueNameByTcIdx(pl_idx)) |
| //log(v_LGenBase_trafficCases) |
| } |
| |
| |
| type component StatsUI_CT extends EPTF_LGenBaseStatsUI_CT, LGenBaseTest_CT, EPTF_UIHandler_CT{ |
| } |
| |
| function f_EPTF_LGenBaseStatsUI_exitBtnPressed( |
| in integer pl_idx, |
| in EPTF_IntegerList pl_argList) |
| runs on StatsUI_CT { |
| log("-----------") |
| log("-----------") |
| log("-----------") |
| f_EPTF_Base_stop(); |
| } |
| |
| function f_EPTF_LGenBaseStatsUI_snapshotBtnPressed( |
| in integer pl_idx, |
| in EPTF_IntegerList pl_argList) |
| runs on StatsUI_CT { |
| log(f_EPTF_UIHandler_snapshot()) |
| } |
| |
| const EPTF_LGenBaseStatsUI_columnDescriptorList c_columnDescriptorList := { |
| {"Tc", c_EPTF_LGenBaseStatsUI_tcColTcName, false}, |
| {"En.", c_EPTF_LGenBaseStatsUI_tcColEnabled, false}, |
| {"State", c_EPTF_LGenBaseStatsUI_tcColStateName, false}, |
| {"Info", c_EPTF_LGenBaseStatsUI_tcColUserData, false}, |
| {"Start", c_EPTF_LGenBaseStatsUI_tcColStartBtn, false}, |
| {"Stop", c_EPTF_LGenBaseStatsUI_tcColStopBtn, false}, |
| {"Pause", c_EPTF_LGenBaseStatsUI_tcColPauseBtn, true}, |
| //{"Abort", c_EPTF_LGenBaseStatsUI_tcColAbortBtn, true}, |
| {"CPS", c_EPTF_LGenBaseStatsUI_tcColCpsToReach, true}, |
| {"Weight", c_EPTF_LGenBaseStatsUI_tcColWeight, true}, |
| {"ActCPS", c_EPTF_LGenBaseStatsUI_tcColLastCps, false}, |
| {"Running", c_EPTF_LGenBaseStatsUI_tcColNrOfRunningEntities, false}, |
| {"Available", c_EPTF_LGenBaseStatsUI_tcColNrOfAvailableEntities, false}, |
| {"Not finished", c_EPTF_LGenBaseStatsUI_tcColNrOfNotFinishedEntities, false}, |
| {"Starts", c_EPTF_LGenBaseStatsUI_tcColNrOfStarts, false}, |
| {"Success", c_EPTF_LGenBaseStatsUI_tcColNrOfSuccesses, false}, |
| //{"Fail", c_EPTF_LGenBaseStatsUI_tcColNnrOfFails, false}, |
| {"Max.running", c_EPTF_LGenBaseStatsUI_tcColMaxRunning, false}, |
| {"Min.available", c_EPTF_LGenBaseStatsUI_tcColMinAvailable, false}, |
| {"Max.busy", c_EPTF_LGenBaseStatsUI_tcColMaxBusy, false}, |
| {"Fin.traffic", c_EPTF_LGenBaseStatsUI_tcColReceivedAnswers, false}, |
| {"Range loops", c_EPTF_LGenBaseStatsUI_tcColRangeLoops, false} |
| } |
| |
| const EPTF_LGenBaseStatsUI_scColumnDescriptorList c_scColumnDescriptorList := { |
| {"Scenario", c_EPTF_LGenBaseStatsUI_scColName, false}, |
| {"En.", c_EPTF_LGenBaseStatsUI_scColEnabled, true}, |
| {"State", c_EPTF_LGenBaseStatsUI_scColStateName, false}, |
| {"StartIt", c_EPTF_LGenBaseStatsUI_scColStartBtn, true}, |
| {"Stop", c_EPTF_LGenBaseStatsUI_scColStopBtn, false}, |
| {"Abort", c_EPTF_LGenBaseStatsUI_scColAbortBtn, true}, |
| //{"Restore", c_EPTF_LGenBaseStatsUI_scColRestoreBtn, true}, |
| {"CPS", c_EPTF_LGenBaseStatsUI_scColCPS, true}//, |
| //{"Lock CPS", c_EPTF_LGenBaseStatsUI_scColLockCPS, true} |
| } |
| |
| modulepar boolean tsp_changeGUI := false; |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_EPTF_LGenBaseStatsUIRegister |
| // |
| // Purpose: |
| // Tests the display and GUI management of the register-reregister-traffic generation |
| // scenario. |
| /////////////////////////////////////////////////////////// |
| testcase tc_EPTF_LGenBaseStatsUIRegister() |
| runs on StatsUI_CT{ |
| f_LGenBaseTest_Init_CT("StatsUITest","statsUIEntity#"); |
| f_EPTF_UIHandlerXUL_init_CT("StatsUITest",true,tsp_LGenBaseStatsUI_mainWindow); |
| if(tsp_changeGUI){ |
| f_EPTF_LGenBaseStatsUI_init("StatsUITest", "statsUIEntity#", self, c_scColumnDescriptorList, c_columnDescriptorList); |
| }else{ |
| f_EPTF_LGenBaseStatsUI_init("StatsUITest", "statsUIEntity#", self); |
| } |
| f_EPTF_LGenBase_declareFunction("successGroupRegister", |
| {customFinishFunction := refers(f_LGenBaseRegisterTest_groupRegisterFinishFunction_FT)}); |
| f_EPTF_LGenBase_declareFunction("doTrafficFinished", |
| {customFinishFunction := refers(f_LGenBaseRegisterTest_doTrafficFinishedFn)}); |
| f_EPTF_LGenBase_TcMgmt_declareEntityTypes(tsp_modulePar_entityTypes) |
| f_EPTF_LGenBase_TcMgmt_declareEntityGroups(tsp_modulePar_entityGroups); |
| f_EPTF_LGenBase_TcMgmt_declareCompactFsmTables(tsp_modulePar_compactFsmTables); |
| f_EPTF_LGenBase_TcMgmt_declareTrafficCases(tsp_modulePar_trafficCases); |
| f_EPTF_LGenBase_TcMgmt_declareScenarios(tsp_modulePar_scenarios); |
| f_EPTF_LGenBase_TcMgmt_createScenarios2EntityGroup(tsp_modulePar_Scenarios2Grps); |
| f_EPTF_LGenBase_declareWeightedScenarioType({"scWeight",false,9.5,false,{false},{ |
| { |
| tcName := "reregister", |
| tcWeight := 0.25, |
| enableEntities := true, |
| enable := true, |
| ranges := {}, |
| params := {}, |
| groupFinishConditions := c_EPTF_LGenBase_TcMgmt_emptyGroupFinishConditions2, |
| entityFinishConditions := c_EPTF_LGenBase_TcMgmt_emptyEntityFinishConditions, |
| entityFinishActions := {}, |
| tcFinishActions := {} |
| }, |
| { |
| tcName := "doTraffic", |
| tcWeight := 0.75, |
| enableEntities := true, |
| enable := true, |
| ranges := {}, |
| params := {}, |
| groupFinishConditions := c_EPTF_LGenBase_TcMgmt_emptyGroupFinishConditions2, |
| entityFinishConditions := c_EPTF_LGenBase_TcMgmt_emptyEntityFinishConditions, |
| entityFinishActions := {}, |
| tcFinishActions := {} |
| } |
| }}) |
| f_EPTF_LGenBase_createScenario2EntityGroup({"eg1","scWeight"}, false); |
| //Init GUI |
| log("---- basic window structure added"); |
| log(tsp_scenariosParentWidgetName) |
| f_EPTF_LGenBaseStatsUI_prepareGUI(tsp_scenariosParentWidgetName); |
| log("----- - - - Snapshot"); |
| log(f_EPTF_UIHandler_snapshot()); |
| var integer vl_temp; |
| f_EPTF_Var_newInt( |
| "exit_ttcn_btn", 0, vl_temp); |
| f_EPTF_UIHandlerClient_subscribeMe( |
| "exit_ttcn_btn", |
| "GUI.exit_ttcn_btn", |
| "exit_ttcn_btn"); |
| f_EPTF_Var_addPostProcFn( |
| vl_temp, { refers(f_EPTF_LGenBaseStatsUI_exitBtnPressed), {}} ); |
| // |
| //v_EPTF_snapshotTime := T_EPTF_componentClock.read; |
| f_EPTF_SchedulerComp_refreshSnapshotTime(); |
| log("----- - - - Dumptest"); |
| f_EPTF_LGenBase_debugLogListeners() |
| |
| //f_EPTF_LGenBase_startTrafficCase("eg0", "sc1", "register"); |
| //f_EPTF_LGenBase_startTrafficCase("eg0", "sc1", "reregister"); |
| timer t1; |
| t1.start(tsp_testDuration); |
| t1.timeout; |
| |
| //Some checking |
| var integer vl_tcRegIdx := f_EPTF_LGenBase_trafficCaseId("eg0", "sc1", "register"); |
| var integer vl_tcReRegIdx := f_EPTF_LGenBase_trafficCaseId("eg0", "sc1", "reregister"); |
| var integer vl_tcDoIdx := f_EPTF_LGenBase_trafficCaseId("eg0", "sc1", "doTraffic"); |
| if(f_EPTF_LGenBase_getTcSuccesses(vl_tcRegIdx) == tsp_numEntities and |
| f_EPTF_LGenBase_getTcStarts(vl_tcReRegIdx) > 0 and |
| f_EPTF_LGenBase_getTcStarts(vl_tcDoIdx) > 0 |
| ){ |
| setverdict ( pass ); |
| }else{ |
| setverdict ( fail ); |
| log("Traffic started: ",f_EPTF_LGenBase_getTcStarts(vl_tcDoIdx)) |
| log("v_reRegisterCounterStopped == ",v_reRegisterCounterStopped); |
| } |
| |
| f_EPTF_Base_cleanup_CT(); |
| } |
| |
| } |