generate an HTML report

How can I generate an HTML report or other better UI reports in Eggplant Functional?

Hi Ontor,
There are no pre-packaged reports within Eggplant Functional. There is reporting built-in to DAI, so if you run your scripts via DAI, you may have the reports that you need. If you choose to report directly from Eggplant Functional, I would recommend that you create some handlers similar to those below to generate an HTML file. I would also recommend that you reach out to Arun to determine whether there is TC support available to your company.

// start html file
to startReportFile rptName, scriptName
	// get current results folder
	put the logFile of the last item of scriptResults(scriptname) into myLogFile
	put the folder of myLogFile into global myResultsFolder
	log global myResultsFolder
	
	// set report file name
	put global myResultsFolder&rptName into Global reportHtmlName
	
	(*	set htext to "<html><head><style>table, th, td {border: 1px solid black;background-color:#dbeef3}</style></head><body>"
	set htext2 to "<img src='file:///C:\EggplantData\eggPlantLogo.png' alt='My Logo Here'>"*)
	// header info is in file
	put file ResourcePath("ReportHeader.html") & return into header
	put header into file (global reportHtmlName&".html") 
end startReportFile

// end html file
to endReportFile
	put "</center></body></html>" & return after file (global reportHtmlName&".html") 
	
	// turn html file into PDF file
	// ***** MUST HAVE wkhtmltopdf ALREADY INSTALLED ON THIS MACHINE *****
	// https://wkhtmltopdf.org/
	// "C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf" --enable-local-file-access C:\EggplantData\myReport.html C:\EggplantData\myReport.pdf
	put "C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf" into cmd1
	put "--enable-local-file-access" into cmd2
	put global myResultsFolder&"outputHtmlToPdfConversion.txt" into output
	
	put quote&cmd1&quote && cmd2 && quote&global reportHtmlName&".html"&quote && quote&global reportHtmlName&".pdf"&quote into command
	log "run command line for html to pdf conversion"
	log command //To make sure everything looks correct
	put command &" > " & quote&output&quote & " 2>&1" into CommandExecute //the 2>&1 sends both the STDOUT and STDERR to the output file
	log CommandExecute
	// run the command line
	shell "c:\windows\system32\cmd.exe", " /c" && quote & CommandExecute & quote
end endReportFile

// start table
to startReportTable name
	set header2 to "<h3>Test : "&name&"</h3>"&return
	set header3 to "<b>Execution Time: </b>"&formattedTime("yyyy-MM-dd HH:mm z")&"<br>"&return
	set header4 to "<b>Execution PC: </b>xxPCxx<br><br>"&return
	set startTable to "<table style='width:80%'>"&return
	set tableHeader to "<tr><th><i>Step:</i></th><th>Description:</th><th>Requirement:</th><th>Status:</th><th>Screenshot </th></tr>"
	
	put header2&header3&header4&startTable&tableHeader&return after file (global reportHtmlName&".html") 
end startReportTable

// end table with a summary of the TestCase
to endReportTable summary
	if summary.warnings > 0 or summary.errors > 0 or summary.exceptions > 0 then
		set status to "Failed - "&summary.warnings&" Warnings, "&summary.errors&" Errors and "&summary.exceptions&" Exceptions"
	else
		set status to "Passed"
	end if
	put "</table><p>Status : "&status&"<br>Duration:"&&summary.Duration&&"seconds" & return after file (global reportHtmlName&".html")
end endReportTable

// add a line to the table
to addReportLine step, desc, req, status, screenshot
	if screenshot
		// take a screenshot and set the image to ss
		// TODO set screenshot directory?
		CaptureScreen increment:Yes, imageFormat: JPG, scaleFactor: .75, JPGCompressionQuality: 85
		put the result into ssFilePath -- Stores the full file path of the CaptureScreen screenshot
		// example file path = C:/Users/lindromi/Documents/Screen_Capture_0001.png
		put the lastPathComponent of ssFilePath into ssFileName
		// display the image at 50%
		set ss to "<img src='file:///"&ssFilePath&"' alt='"&ssFileName&"' style='width:450px;height:350px;'>"
	else
		set ss to " " // blank or NA?
	end if
	
	if status then
		// green text P
		set stat to "<th style='color:green'>Passed"
	else
		// red text F
		set stat to "<th style='color:red'>Failed"
		LogWarning "step "&step&" failed"		
	end if
	
	set rptRow to "<tr><td><i>"&step&"</i></td><td>"&desc&"</td><td>"&req&"</td>"&stat&"</th><td>"&ss&"</td></tr>"
	put rptRow & return after file (global reportHtmlName&".html") 
end addReportLine

Hope this helps,
Dave