Forum Discussion

chrisb's avatar
chrisb
Regular Contributor
11 years ago
Solved

Help needed with scripting interface to current test log during test run

I've scripted an event handler for OnStopTest to email the project test run results.  I'd assumed that the log would be compiled before the OnStopTest fires but that does not appear to be the c...
  • Ryan_Moran's avatar
    11 years ago
    I believe you can call a savelogfile method Log.SaveResultsAs() and attach to an email. As a solution to this problem I actually create my own HTML log with just errors/warnings listed by using the onerror and onwarning events (is cleaner than the built in log & I can design it myself this way).

    As far as creating the email in JScript you can use something like this:






    function sendemail(mfrom,mto,msubject,mbody,mattach){



    mconfig = new ActiveXObject('CDO.Configuration');


    mconfig.fields.item(schema + 'sendusing') = 2; //cdoSendUsingPort;


    mconfig.fields.item(schema + 'smtpserver') = //SMTP server


    mconfig.fields.item(schema + 'smtpserverport') = 525; // Port number


    //mConfig.Fields.Item(schema + 'sendusername') = ''; // User name (if needed)


    //mConfig.Fields.Item(schema + 'sendpassword') = ''; // User password (if needed)


    mconfig.fields.update();


    message = new ActiveXObject('CDO.Message');


    message.configuration = mconfig;


    message.from = mfrom;


    message.to = mto;


    message.subject = msubject;


    message.htmlbody = mbody;

    message.addattachment mattach;


    message.send(); //Send Email


    }