| /////////////////////////////////////////////////////////////////////////////// |
| // // |
| // Copyright (c) 2000-2019 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_Base_restartPart1_Test_Testcases |
| // |
| // Purpose: |
| // This module contains testcase for testing the restart functionality of EPTF Base. |
| // |
| // Module Parameters: |
| // - |
| // Module depends on: |
| // <EPTF_CLL_Base_Definitions> |
| // <EPTF_CLL_Base_Functions> |
| // |
| // Current Owner: |
| // Zoltan Zsichla (ezolzsi) |
| // |
| // Last Review Date: |
| // - |
| // |
| // Detailed Comments: |
| // tc_EPTF_Base_Test_restartPart1() can be found in EPTF_Base_restartPart1_Test project. |
| // tc_EPTF_Base_Test_restartPart2() can be found in EPTF_Base_restartPart2_Test project. |
| // |
| /////////////////////////////////////////////////////////// |
| module EPTF_Base_restartPart1_Test_Testcases { |
| |
| //========================================================================= |
| // Import Part |
| //========================================================================= |
| import from EPTF_CLL_Base_Definitions all; |
| import from EPTF_CLL_Base_Functions all; |
| //========================================================================= |
| //Component Types |
| //========================================================================= |
| type component Base_restartPart1_Test_CT extends EPTF_Base_CT {} |
| //========================================================================= |
| // Testcases |
| //========================================================================= |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_EPTF_Base_Test_restartPart1 |
| // |
| // Purpose: |
| // Check if the <f_EPTF_Base_restart> restarts the test case |
| // |
| // Requirement: |
| // It must run before tc_EPTF_Base_Test_restartPart2 of EPTF_Base_restartPart2_Test project. |
| // The file /tmp/EPTF_Base_Test_restart.log must not exist. |
| // |
| // Detailed Comments: |
| // It creates a file then triggers the restart. The restarted test case (when it runs second time) waits |
| // until the current process (execution of the control part) finishes, then writes "restart done" string into the file. |
| // The pair of this test case tc_EPTF_Base_Test_restartPart2 (it can be found in EPTF_Base_restartPart2_Test project) will check the content of the file. |
| // |
| // Expected Result: |
| // pass verdict |
| /////////////////////////////////////////////////////////// |
| testcase tc_EPTF_Base_Test_restartPart1() runs on Base_restartPart1_Test_CT { |
| f_EPTF_Base_init_CT("restartPart1"); |
| |
| var charstring vl_stdOut := ""; |
| var charstring vl_stdErr := ""; |
| var charstring vl_command := ""; |
| var charstring vl_filename := "/tmp/EPTF_Base_Test_restart.log"; |
| |
| if(f_EPTF_Base_executeShell("ls "&vl_filename, vl_stdOut, vl_stdErr) == 0){ |
| // write "restart done" to file, which will be checked by the tc_EPTF_Base_Test_restartPart2 |
| vl_command := "echo \"restart done\" >> "&vl_filename; |
| if(f_EPTF_Base_executeShell(vl_command, vl_stdOut, vl_stdErr) != 0){ |
| setverdict(inconc, "Command: "&vl_command&" is not executed, because of: ",vl_stdErr); |
| } |
| setverdict(pass,"restart done string is written to file: ",vl_filename); |
| f_EPTF_Base_stop(none); |
| }else{ |
| vl_command :="touch "&vl_filename; |
| if(f_EPTF_Base_executeShell(vl_command, vl_stdOut, vl_stdErr) == 0){ |
| setverdict(pass, "File: ",vl_filename," created."); |
| f_EPTF_Base_restart(pl_testCases := {%moduleId&"."&%testcaseId}); // it calls f_EPTF_Base_stopAll(none) at the end |
| } else{ |
| setverdict(fail,"File: ",vl_filename," can not be created, because of: ",vl_stdErr); |
| } |
| } |
| f_EPTF_Base_stop(none); |
| } |
| |
| /////////////////////////////////////////////////////////// |
| // Testcase: tc_EPTF_Base_Test_dummy |
| // |
| // Purpose: |
| // It waits for 2.0 sec |
| // |
| // Requirement: |
| // It must run after tc_EPTF_Base_Test_restartPart1 |
| // |
| // Detailed Comments: |
| // It waits for 2.0 sec in order to tc_EPTF_Base_Test_restartPart1 has enough time to restart |
| // |
| // Expected Result: |
| // pass verdict |
| /////////////////////////////////////////////////////////// |
| testcase tc_EPTF_Base_Test_dummy() runs on Base_restartPart1_Test_CT { |
| f_EPTF_Base_init_CT("dummy"); |
| |
| timer t_wait := 2.0; |
| t_wait.start; |
| t_wait.timeout; |
| setverdict(pass); |
| f_EPTF_Base_stop(none); |
| } |
| |
| //========================================================================= |
| // Control |
| //========================================================================= |
| control { |
| execute(tc_EPTF_Base_Test_restartPart1()); |
| execute(tc_EPTF_Base_Test_dummy()); |
| } // end of control |
| } // end of module |