Predefined HTML Templates

Predefined templates are located in

C:\Program Files (x86)\Inflectra\Rapise\Extensions\TrpExporter

The templates are written in T4 format. 

Customizing HTML Templates

You may copy existing templates to the root folder of your testing framework and change them.  Notice that templates may reference each other. For example FullReportTpl.tt includes GenericReportTpl.tt.

Generating HTML Report

To generate a report define SeSOnTestReportReady callback.

SeSOnTestReportReady(function(){
	Log("Test done with status: "+g_testPassed);
	Log("Report file: "+g_reportFileName);
	
	// Generate HTML
	var htmlName = "CustomReport.html";
	var ldr = new ActiveXObject("Rapise.LogLoader");
	ldr.LoadTrp(g_reportFileName);
	ldr.ExportAsHtml("FullReportTpl.tt", htmlName);
});

In this example Rapise uses FullReportTpl.tt from the root folder of a framework to generate CustomReport.html.

Converting HTML to PDF

If you have Chrome browser installed you may use it to convert HTML report to PDF format. Change SeSOnTestReportReady like this:

SeSOnTestReportReady(function(){
	Log("Test done with status: "+g_testPassed);
	Log("Report file: "+g_reportFileName);
	
	// Generate HTML
	var htmlName = "CustomReport.html";
	var ldr = new ActiveXObject("Rapise.LogLoader");
	ldr.LoadTrp(g_reportFileName);
	ldr.ExportAsHtml("FullReportTpl.tt", htmlName);
	
	// Convert to PDF
	var pdfName = "CustomReport.pdf";
	var cmdLine = '"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe" --headless';
	cmdLine += ' --no-pdf-header-footer --print-to-pdf="' + Global.GetFullPath(pdfName) + '"';
	cmdLine += ' --user-data-dir="C:\\ProgramData\\Inflectra\\Rapise\\Temp\\Chrome"'
	cmdLine += ' file:///' + encodeURI(Global.GetFullPath(htmlName).replace(/\\/g, "/"));
	Global.DoLaunch(cmdLine);
});

This function generates CustomReport.html and then converts it to CustomReport.pdf.