Forum Discussion

sasa_salamon's avatar
13 years ago

TestExecute supress log file opening

I'm trying to add TestExecute to nightly build process.

All works well, but each build opens up web browser showing log file.

I need to suppress this, as logs are being uploaded to another place and I don't need them to open on this machine.
  • gmccord's avatar
    gmccord
    Occasional Contributor
    Right-Click the TestExecute icon in the task bar,  Options-Engines-Log



    Turn it off there.
  • Is there a possibility or a chance, to supress the opening of the log file only if there are no errors ? Or in other words, to open it just in the case, that there is any error in the log ?
  • TanyaYatskovska's avatar
    TanyaYatskovska
    SmartBear Alumni (Retired)

    Hi Sasa,


     


    You can implement the OnLogError event handler (or OnStopTest) where you can check whether errors were posted to TestLog during the test execution). If there were errors, save the test results to a file and open it from script. Here is how it may look like:


     




    //JScript


    function Main()


    {


    // Executing your test


    }


     


     


    function GeneralEvents_OnLogError(Sender, LogParams)


    {


      var ErrCount = Log.ErrCount;


      


      if ( ErrCount > 0 ) 


        { 


           Log.SaveResultsAs(<FileName>, lsMHT); 


           RunMHT(<FileName>);


        }


      else


        Log.Message("There are no errors in the test log."); 


    }


     


    function RunMHT(MHTpath)


    {


      var WshShellObj = new ActiveXObject("WScript.Shell");


       var WshShellExecObj = WshShellObj.Run(MHTpath);