18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

Creation of HTML Report

chandra.santanichandra.santani Members
edited November -1 in Sahi - Open Source
Hi Narayan,

I am totally new to Sahi and have to work on a proof of concept (POC) for our application using Sahi. We need to create an HTML report which provide detailed status of the test suite and test case. Can you please help me on writing a function, which writes the status of the testcase/fucntion to an html document from Sahi code?

Appreciate your support.

Regards,
Chandra Santani

Comments

  • narayannarayan Administrators
    Hi Chandra Santani,

    Have you looked at the logs generated by Sahi when running a suite? It already creates HTML logs.

    If you want your own reporting, you can use the _writeFile(text, filePath[, overwrite]) API to create any kind of logs.

    If you define a function called onScriptEnd, it will be called at the end of a script. From this you can read _scriptStatus() and then write to a file.


    For example, add the code below to any Sahi script, and it will write the results in D:\\allResults.txt
    function onScriptEnd(){
      _writeToFile(_scriptName()  + ": " + _scriptStatus() + "\n", "D:\\allResults.txt", false);
    }
    
    Regards,
    Narayan
  • Thanks Narayan,

    Actually we want our own reporting. I will try this approach you have mentioned above.

    Regards,
    Chandra Santani
Sign In or Register to comment.