hongji.li
2023-11-07 1a1ba3ad5ed9e4380185aa1ccad20204a0e5f115
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
Quintiq file version 2.0
#parent: #root
Method PTF_ExecuteTest (
  structured[LibPTF_TestScript] testscripts
) id:Method_LibPTF_pnlTestController_PTF_ExecuteTest
{
  #keys: '[105690.0.201964467]'
  Body:
  [*
    // Execute the selected test scripts
    rowDelimiter    := LibPTF_Util::StringListRowDelimiter();     
    columnDelimiter := LibPTF_Util::StringListColumnDelimiter();
    
    validtestscripts := selectset( testscripts,
                                   Elements,
                                   script,
                                   true,
                                   script.IsScriptValid()
                                 );
    
    nrtotal   := testscripts.Size();
    nrvalid   := validtestscripts.Size();
    nrinvalid := nrtotal - nrvalid;
    message   := "There are " + [String]nrinvalid + " invalid test script(s)." + String::NewLine() + String::NewLine()
                 + "Do you want to execute the other " + [String]nrvalid + " valid test script(s)?";
    
    // If all scripts valid or user continues to execute other valid scripts
    if( nrvalid = nrtotal
        or MessageBox::Warning( this, message, '&Yes|&No', 1 ) = 0 )
    {
      //Logs a line in log file as an indication of the beginning of a PTF run
      LibPTF::LogRunStarted();
                                                      
      resultLogFileName := this.PTF_GetResultLogFileName();                                                  
      
      this.vhResultLogFolder().Value( resultLogFileName )
      OS::CreateDirectory( LibPTF_pnlTestController.PTF_GetResultLogPath() );
      this.gt().Enabled( true );
    
      //execute only valid testscript
      ts := validtestscripts.Copy();
      dhSelectedScripts.Data( &ts );
    
      str := "";
    
      traverse( dhSelectedScripts.Data(), Elements, script )
      {
        str := str + script.User() + columnDelimiter
                   + [String]script.TotalNrOfSessions() + columnDelimiter
                   + [String]script.NrOfSimultaneousSessions() + columnDelimiter
                   + "0" + columnDelimiter
                   + "0" + columnDelimiter
                   + [String]script.TotalNrOfSessions() + columnDelimiter
                   + "N/A" + columnDelimiter
                   + "N/A" + columnDelimiter
                   + "N/A" + columnDelimiter
                   + [String]script.Offset() + rowDelimiter ;
      }
    
      lstExecutionTestScript.Strings( str.SubString( 0, str.Length() - 1 ) );
    
    
      
      // Set labels text in panel test controller (start,end,duration)
      now := DateTime::Now();
      nowAsString := LibPTF_pnlTestController.PTF_ConvertDateTimeToString( now );    
      lblStartTime.Text( nowAsString );
      lblEndTime.Text( "N/A" );
      lblDurationTime.Text( "N/A" );
      
      LibPTF_pnlTestController.PTF_GenerateBatchFile();  
    
      // Assign LastTestStartTime attribute and current client timezone offset and timezone ID labels
      // Purpose: For update datetime string value when client timezone is changed (ONLY for timezone mode)
      LibPTF_pnlTestController.PTF_GetPTF().LastTestStartTime( now ); 
      lblClientTimezoneOffset.Text( LibPTF_pnlTestController.PTF_GetClientTimeZoneOffset() );
      lblLastClientTimeZone.Text( Application::SessionTimeZone().ID() );
    }
  *]
}