发布新日志

  • Customized log for better result analysis

    2007-01-05 18:33:33

    Abstract:Customized log solution described below allows you to write your own data and parameters to log files, export results to an Excel spreadsheet and then analyze them using powerful pivot table or other tools.

    We use our custom log function to log data, analyze test results and to get average response times or tps for individual groups, time intervals or parameters – how long it took to display home page for Brasil vs India?
    Custom logs also help you in a case when you are not able to use LR Analysis tool to analyze test results.

    The idea is to write to regular log files only the data you really want/need. In run-time settings we disable logging and use our custom log function to write to log files.
    The sequence in LR scrīpt is:

    1.get transaction start time: using LR parameter of type Date/Time: strcpy(cur_time, lr_eval_string("{pTime}"));

    2.execute the transaction

    3.get:
    a.transaction status: rc=lr_get_transaction_status(tr_name);
    b.response time: tr_duration = lr_get_transaction_duration(tr_name);
    c.message you want to log – usually a parameter used in transaction or transaction results: strcpy(msg, lr_eval_string("{parameter}"));

    4.call function STATUS with all these parameters that writes to the log file to:
    a.save current log settings: msg_class=lr_get_debug_message();
    b.enable logging:: lr_set_debug_message(LR_MSG_CLASS_BRIEF_LOG, LR_MSG_ON );
    c.get vuser and group information: lr_whoami(&vuser_id, &group, &sc_id);
    d.write all your data to the log file: lr_log_message("Status:, %s, %s, %s, %3.3f ...
    e.restore original log level: lr_set_debug_message(msg_class, LR_MSG_ON);

    5.After the test combine all log files from log folder to one file using Windows command prompt: find “Status:” *.log >> trans_log.csv
    6.open the result log file in Excel and use pivot table or other tools to analyze the data

    Attached is the complete scrīpt and scenario.

Open Toolbar