################################################################################
# TEST:	grund
################################################################################
# $Revision: 1.2 $
# $Author: drajovic $
# $Date: 2002/12/16 19:23:16 $
# $Source: d:/Archive/CVS_QS/EMOS/EMOS_FRM_EXAMPLES/FlightDemo/Scripts/DRV/main/script,v $
# $NoKeywords: $
################################################################################
#/***
#*	This is an example of an old-fashined driver script that we were using before
#*	EMOS Framework Version 7.01.00.04. We do not recomend this style any more.
#*   (see DRV/main_lib)
#*	<p>
#*	From now on the original comments
#*	<p>
#*	This main test implements a "dummy" step driver which you may use to
#*	implement the real one.
#*
#*	The purpose of a step driver is to interpret the corresponding "Teststep"
#*	cell of each test case. With "interpreting" we mean the process of splitting
#*	the cell (Teststep) into individual steps and individually processing
#*	each of them either by a built-in FRM functionality (e.g. LNK or EXE steps)
#*	or by calling the specialised function.
#*
#*	This "dummy" template implements all the necessary interractions with the
#*	emos_FRM_STP_lib and very carefully handles the return code in order to
#*	produce correct WinRunner test results. All you need to do is to load the
#*	apropriate libraries and handle the individual keywords (step names).
#*
#*	You should be aware of the fact	that this scripts typically call themselves
#*	recursively and very much care is necessary in order to properly propagate 
#*	the return code (i.e. indication of failure) up the call chain. Therefore
#*
#*	<p>DO NOT MODIFY THE CODE OUTSIDE OF DESIGNATED AREAS UNLESS
#*	<ul> 
#*	<li>you know what you are doing,</li>
#*	<li>you have to fix a bug (in this case please let us know) or</li>
#*	<li>you are prepared to live with the consequences.</li>
#*	</ul>
#* <p>REQUIREMENTS/PREREQUISITES:
#*	The rest of the test suite should be developed according to FRM-principles
#*	in order to make any use of this script.
#*
# <p>PARAMETERS:
#*	<ul>
#*	<li><b>table</b>:		the name of the opened data table</li>
#*	<li><b>test</b>:		the name of the individual test case</li>
#*	<li><b>reset_rc</b>:	flag indicating whether this is the first or a recursive
#*				invocation of this script.<li>
#*</ul>
#* <p>RETURN VALUE:
#*	<ul>
#*	<li><b>0</b>:		successfull completion</li>
#*	<li><b>&gt;0</b>:		unsuccessfull comletion</li>
#*	</ul>
#*
#* @see drv/main_lib
#*/

# WARNING:  MODIFY THE CODE ONLY IN DESIGNATED AREAS!

static step, mode, comment;
static rc, frm_rc;

if ( reset_rc ) frm_rc = 0;

# IMPLEMENT YOUR OWN REPORTING HERE
# -->>-->>-->>
report_msg( "=====================" );
report_msg( "Table: " & FRM_get_name( table ) );
report_msg( "Test: " & test );
if ( FRM_get_cell( table, test, "Description", comment ) == E_OK )
{
	wrlog_test_data( "DESCRIPTION", comment );
	report_msg( "Description: " & comment );
}
report_msg( "=====================" );
# <<--<<--<< END OF REPORTING

rc = FRM_STP_init_steps( table, test, "Testsequence" );
if ( rc != E_OK ) 
	treturn rc;

# LOAD THE NECESSARY LIBs & GUIs HERE
# Use FRM_load_XXX() and you need not worry when to unload them.
# -->>-->>-->>
FRM_load_gui( table, GUI_HOME & "\\" & "FlightInfo.gui" );
FRM_load_lib( table, "LIB/FRM/FRM_flight_lib", 0, 0 );
# <<--<<--<< END OF LOADING

while( FRM_STP_has_more_steps( table, test ) )
{
	rc = FRM_STP_get_next_step( table, test, step, mode );
	if ( rc == E_FILE_EOF )
		break;
	if ( rc != E_OK )
	{
		frm_rc++;
		continue;
	}
	switch( tolower( step ) )
	{
# PROCESS YOUR TEST STEPS HERE
# -->>-->>-->>
	case "prolog":
		rc = FRM_Prolog( table, test, step, mode ); break;
	case "prolog2":
		rc = FRM_Prolog2( table, test, step, mode ); break;
	case "login":
		rc = FRM_Login( table, test, step, mode ); break;
	case "main":
		rc = FRM_Main( table, test, step, mode ); break;
	case "popup":
		rc = FRM_PopUp_Message( table, test, step, mode ); break;
	#
	case "flight schedule":
		rc = FRM_FlightSchedule( table, test, step, mode ); break;
	case "order information":
		rc = FRM_OrderInformation( table, test, step, mode ); break;
	case "order action":
		rc = FRM_OrderAction( table, test, step, mode ); break;
	case "flights table":
		rc = FRM_FlightsTable( table, test, step, mode ); break;
	case "open order":
		rc = FRM_Open_Order( table, test, step, mode ); break;
#	case "not-implemented-yet step":
#		FRM_DRV_handle_unimplemented_block( step, frm_rc );
#		continue;
# <<--<<--<< END OF TEST STEPS
	default:
		FRM_DRV_handle_unknown_block( step, frm_rc );
		continue;
	} # end switch

	if ( FRM_DRV_handle_processed_block( step, test, rc, frm_rc ) )
		break;
} # end while
	
treturn (frm_rc=="" ? 0 : frm_rc);
