Exemplo n.º 1
0
Action()
{
	int iDebug;
	
	web_cleanup_cookies( );
		
	lr_start_transaction("_TIVApp_001_My_Test");
	
	lr_save_string("TIVApp_001_001_Homepage", "pTransactionName");
	
	web_reg_find("Fail=NotFound",
		"Search=Body",
		"Text=Test site.",
		LAST);

	web_reg_save_param("cServerName",
	    "LB=Set-Cookie: ROUTEID=.",
	    "RB=;",
	    "Notfound=warning",
	    LAST);
	
	web_reg_save_param("cVersion",
	    "LB=version\">",
	    "RB=<",
	    "Notfound=warning",
	    LAST);
	
	lr_start_transaction(lr_eval_string("{pTransactionName}"));
	
	web_url("Homepage", 
		"URL=http://{pURL}/", 
		"Resource=0", 
		"RecContentType=text/html", 
		"Referer=", 
		"Snapshot=t1.inf", 
		"Mode=HTML", 
		LAST);
	// Log Levels:
	// LR_MSG_CLASS_DISABLE_LOG
	// LR_MSG_CLASS_BRIEF_LOG
	// LR_MSG_CLASS_EXTENDED_LOG
	// LR_MSG_CLASS_RESULT_DATA
	// LR_MSG_CLASS_PARAMETERS
	// LR_MSG_CLASS_FULL_TRACE
	iDebug = lr_get_debug_message();

	lr_output_message("TIVMsg: Msg Level was: %d", iDebug);
	
	lr_set_debug_message(LR_MSG_CLASS_EXTENDED_LOG, LR_SWITCH_ON);
	
	lr_debug_message(LR_MSG_CLASS_EXTENDED_LOG | LR_MSG_CLASS_RESULT_DATA,"TIVMsg: %s loaded via server: %s", lr_eval_string("{pTransactionName}"), lr_eval_string("{cServerName}"));
	
	lr_set_debug_message(iDebug, LR_SWITCH_ON);
	
	lr_end_transaction(lr_eval_string("{pTransactionName}"), LR_AUTO);
	
	lr_end_transaction("_TIVApp_001_My_Test", LR_AUTO);
	
	return 0;
}
Exemplo n.º 2
0
wi_startPrintingInfo(){

		lr_set_debug_message( 542 , LR_SWITCH_OFF ); // to unset all selections.
		lr_set_debug_message( LR_MSG_CLASS_JIT_LOG_ON_ERROR, LR_SWITCH_ON ); // LR_SWITCH_ON (=1) means suppress output.
	if( iVerbosity >= 2 ){
		lr_set_debug_message( LR_MSG_CLASS_JIT_LOG_ON_ERROR, LR_SWITCH_OFF ); // LR_SWITCH_OFF (=0) means stop suppressing output.
		lr_set_debug_message( LR_MSG_CLASS_BRIEF_LOG  , LR_SWITCH_ON ); // (1) (Standard) logging.
	}
	return LR_PASS;
}
Exemplo n.º 3
0
/*! \brief Force all logging off unconditionally, without saving the old state.
 *
 * This is used by various y_log_* functions to get the loglevel to a known state.
 * 
 * \author Floris Kraak
 */
void y_log_turn_off_without_saving()
{
    // Good grief, this debug message interface is terrible.

    // Turn all logging off. Which has the really weird side effect of turning auto logging on again.
    lr_set_debug_message(LR_MSG_CLASS_DISABLE_LOG, LR_SWITCH_ON);

    // Disable the auto logging again, but using a different bit flag.
    lr_set_debug_message(LR_MSG_CLASS_AUTO_LOG, LR_SWITCH_OFF);
    //lr_error_message("All logging turned off, log level now %d", lr_get_debug_message() );
}
Exemplo n.º 4
0
/*! \brief Set the log level to "brief" messages only.
 * 
 * \note Calling y_log_restore() will restore the loglevel to the state it was in before this call. 
 *
 * Useful when you want to, say, not see that big PDF you are downloading somewhere in your logs but *do* want to see the rest of the logging.
 * \author Floris Kraak
 */
void y_log_set_brief()
{
    //lr_log_message("Log level set to BRIEF.\n");
    y_log_turn_off();
    lr_set_debug_message(LR_MSG_CLASS_BRIEF_LOG, LR_SWITCH_ON);
    //lr_log_message("Log level set to brief, from %d to %d", _y_log_level, lr_get_debug_message() );
}
Exemplo n.º 5
0
wi_stopPrinting(){

	lr_set_debug_message( 542 , LR_SWITCH_OFF ); // to unset all selections.
	// Using bit-wise compare. See http://www.jds.net.au/tech-tips/loadrunner-log-options/
	if( original_log_option & LR_MSG_CLASS_JIT_LOG_ON_ERROR ){
		// Send messges only when an error occurs:
		lr_set_debug_message( LR_MSG_CLASS_JIT_LOG_ON_ERROR, LR_SWITCH_ON ); // to ON = 1; 
	}else{
		// Send messges only when an error occurs:
		lr_set_debug_message( LR_MSG_CLASS_JIT_LOG_ON_ERROR, LR_SWITCH_OFF );
	}

	// Revert to specifications in Run-time Settings:
	lr_set_debug_message( original_log_option, LR_SWITCH_ON );

	return LR_PASS;
}
Exemplo n.º 6
0
/*! \brief Set the log level to show all messages, including extended result data, parameters, and tracing information.
 * \note Calling y_log_restore() will restore the loglevel to the state it was in before this call. 
 *
 * Useful when you want to debug a particular step in the script.
 *
 * \author Floris Kraak
 */
void y_log_set_extended()
{
    //lr_log_message("Log level set to EXTENDED.\n");
    y_log_turn_off();
    lr_set_debug_message(
        LR_MSG_CLASS_EXTENDED_LOG | LR_MSG_CLASS_RESULT_DATA | LR_MSG_CLASS_PARAMETERS | LR_MSG_CLASS_FULL_TRACE,
        LR_SWITCH_ON);
    //lr_log_message("Log level extended from %d to %d", _y_log_level, lr_get_debug_message() );
}
Exemplo n.º 7
0
wi_startPrintingTrace(){

		lr_set_debug_message( 542 , LR_SWITCH_OFF ); // to unset all selections.
		lr_set_debug_message( LR_MSG_CLASS_JIT_LOG_ON_ERROR, LR_SWITCH_ON ); // LR_SWITCH_ON (=1) means suppress output.
	if( iVerbosity >= 4 ){
		lr_set_debug_message( LR_MSG_CLASS_JIT_LOG_ON_ERROR, LR_SWITCH_OFF ); // LR_SWITCH_OFF (=0) means stop suppressing output.
		lr_set_debug_message( LR_MSG_CLASS_BRIEF_LOG  , LR_SWITCH_ON ); // (1) (Standard) logging.
		lr_set_debug_message( LR_MSG_CLASS_RESULT_DATA, LR_SWITCH_ON );
		lr_set_debug_message( LR_MSG_CLASS_FULL_TRACE , LR_SWITCH_ON ); 
		// No LR_MSG_CLASS_PARAMETERS because
	}
	if( iVerbosity >= 5 ){
		lr_set_debug_message( LR_MSG_CLASS_JIT_LOG_ON_ERROR, LR_SWITCH_OFF ); // LR_SWITCH_OFF (=0) means stop suppressing output.
		lr_set_debug_message( LR_MSG_CLASS_EXTENDED_LOG, LR_SWITCH_ON ); // (16) Extended logging.
	}
	return LR_PASS;
}
Exemplo n.º 8
0
/*! \brief Restore the loglevel to previous state.
 * To be exact, it will restore it to the state it was in before the last call to y_log_set_{off|on|brief|extended}() or y_log_save().
 *
 * \note Multiple calls to y_log_set_* functions in a row will overwrite the previous saved state, making the first state potentially unrecoverable.
 *
 * \author Floris Kraak
 */
void y_log_restore()
{
    //lr_log_message("Restoring log level to %d, current level %d.", _y_log_level, lr_get_debug_message());

    y_log_turn_off_without_saving();

    lr_set_debug_message(_y_log_level, LR_SWITCH_ON);

    // None of this debug code does what we want. Only y_log_turn_off_without_saving() (above) seems to work ..
    //lr_set_debug_message(~Y_ALL_LOG_FLAGS, LR_SWITCH_OFF);
    //lr_set_debug_message(~_y_log_level, LR_SWITCH_OFF); 
    //lr_set_debug_message(~_y_log_level & Y_ALL_LOG_FLAGS, LR_SWITCH_OFF);

    //lr_error_message("Attempted to restore loglevel to %d, now it is %d", _y_log_level, lr_get_debug_message());
    // Of course if the previous state was "OFF" the user will never see this either ;-)
}
Exemplo n.º 9
0
wi_setPrinting(){
	// Use RTS to determine what to store during runs.
		lr_set_debug_message( debug_message_level_in_rts , LR_SWITCH_ON );

	// But actually output only if the verbosity is high enough:
	if( iVerbosity >= 0 ){ // nothing but lr_output_message() after wi_startPrintingError();
		lr_set_debug_message( LR_MSG_CLASS_JIT_LOG_ON_ERROR, LR_SWITCH_ON ); // LR_SWITCH_ON (=512) means suppress output.
		lr_set_debug_message( LR_MSG_CLASS_BRIEF_LOG  , LR_SWITCH_ON ); // (1) (Standard) logging.
	}else
	if( iVerbosity >= 1 ){ // nothing but lr_output_message() after wi_startPrintingInfo();
		lr_set_debug_message( LR_MSG_CLASS_JIT_LOG_ON_ERROR, LR_SWITCH_OFF ); // LR_SWITCH_OFF (=0) means stop suppressing output.
		lr_set_debug_message( LR_MSG_CLASS_BRIEF_LOG  , LR_SWITCH_ON ); // (1) (Standard) logging.
	}else
	if( iVerbosity >= 2 ){ // nothing but lr_output_message() after wi_startPrintingTrace() but no Data returned by server
		lr_set_debug_message( LR_MSG_CLASS_JIT_LOG_ON_ERROR, LR_SWITCH_OFF ); // LR_SWITCH_OFF (=0) means stop suppressing output.
		lr_set_debug_message( LR_MSG_CLASS_BRIEF_LOG  , LR_SWITCH_ON ); // (1) (Standard) logging.
	}else
	if( iVerbosity >= 3 ){ // nothing but lr_output_message() after wi_startPrintingDebug() AND Data returned by server.
		lr_set_debug_message( LR_MSG_CLASS_JIT_LOG_ON_ERROR, LR_SWITCH_OFF ); // LR_SWITCH_OFF (=0) means stop suppressing output.
		lr_set_debug_message( LR_MSG_CLASS_BRIEF_LOG  , LR_SWITCH_ON ); // (1) (Standard) logging.
		// No LR_MSG_CLASS_PARAMETERS because
	}else
	if( iVerbosity >= 4 ){ // nothing but lr_output_message() after wi_startPrintingTrace() but no Data returned by server.
		lr_set_debug_message( LR_MSG_CLASS_JIT_LOG_ON_ERROR, LR_SWITCH_OFF ); // LR_SWITCH_OFF (=0) means stop suppressing output.
		lr_set_debug_message( LR_MSG_CLASS_BRIEF_LOG  , LR_SWITCH_ON ); // (1) (Standard) logging.
		lr_set_debug_message( LR_MSG_CLASS_RESULT_DATA, LR_SWITCH_ON );
		lr_set_debug_message( LR_MSG_CLASS_FULL_TRACE , LR_SWITCH_ON ); 
		// No LR_MSG_CLASS_PARAMETERS because
	}else
	if( iVerbosity >= 5 ){ // nothing but lr_output_message() after wi_startPrintingDebug() AND Data returned by server.
		lr_set_debug_message( LR_MSG_CLASS_JIT_LOG_ON_ERROR, LR_SWITCH_OFF ); // LR_SWITCH_OFF (=0) means stop suppressing output.
		lr_set_debug_message( LR_MSG_CLASS_EXTENDED_LOG, LR_SWITCH_ON ); // (16) Extended logging.
		lr_set_debug_message( LR_MSG_CLASS_RESULT_DATA, LR_SWITCH_ON );
	}

	return 0;
} // wi_setPrinting