Sign in to follow this  
Followers 0
rahuroy

Generate HTML reports after each autoit script execution

8 posts in this topic

Hi All,

I am new to Autoit Forum

I am writing scripts for installation with different scenarios .Is there way in autoit so that we can generate " HTML "report to each testcase as pass or fail based on successful or unsuccessful installation.Please suggest and guide me.If anyone has already implemented then can you share source code?

As of now i am writing logs but requirement is to generate html report for each test case as pass and fail? can you please help me to how to start for this?

Share this post


Link to post
Share on other sites



If you are already writing logs, then the conversion will be easy for you.

Instead of (for example):

FileWrite("result.log.txt", "Installing component Y of X" & @CRLF)

You can do the following:

FileWrite("result.log.html", "Installing component Y of X<br />")

The difference between writing text log files, and HTML log files is that in HTML log files you can use HTML markup..

Share this post


Link to post
Share on other sites

But how to generate HTML reports for test suite?

Report having all information about all test cases.

Share this post


Link to post
Share on other sites

Hello rahuroy,

I think you'll have to give us more specific information.

What do you mean by test-cases and test-suite?

Do you want a global report for all clients in a specific group?

So far I think that what Manadar said should be sufficient to create a HTML report.

Regards,

Hannes

:)


Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

i have to install application on 200 systems and i want one HTML report which shows on which systems installation was successful and on which installation failed.

With current logs and report will be generated for every system.But i wanted collective report ? Can you please guide me how to achieve this?

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

You could use a file on a server accessible to all the installations.

Application checks to see if it exists; if not create it or use fileinstall to add a pre-prepared template file - perhaps with the headers already written.

Then just write what you need to the file, including both the data and the html code.

I do something similar, and found that if my initial file has a bit of text at the top, I can just replace that string with the new string [which also includes the same text, ready to be replaced the next time round].

In my case, the text is 'Most recent first' - so it informs the reader, and remains constant.

William

[edit] If they're not networked, the take a memory stick round with you to write the log file onto [might need an extra line or two to tell your script the location of the stick, as it may vary between machines].

W.

Edited by saywell

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

i have to install application on 200 systems and i want one HTML report which shows on which systems installation was successful and on which installation failed.

With current logs and report will be generated for every system.But i wanted collective report ? Can you please guide me how to achieve this?

Easiest is probably something like this:

- Install the free version of Kiwi Syslog Daemon on a server computer: http://www.kiwisyslog.com/kiwi-syslog-server-overview/

Client computers must be able to connect to the network server (infrastructure requirement)

- Make the script clients send logs with this function:

UDPStartup()
$logServer = "1.1.1.1"
$port = 514
$socket = UDPOpen($logServer, $port)

; YOUR SCRIPT HERE
_Log("Installation has started")
; do stuff
_Log("Installation has failed")

Func _Log($message)
    UDPSend($socket, $message)
EndFunc

- Now you have all the log files in a central location with very minimum amount of effort.

- Write some code that can parse the log files and determine failure/success of each installation. Make output of this log parser HTML.

You are done. 8)

Edited by Manadar

Share this post


Link to post
Share on other sites

Easiest is probably something like this:

- Install the free version of Kiwi Syslog Daemon on a server computer: http://www.kiwisyslog.com/kiwi-syslog-server-overview/

Client computers must be able to connect to the network server (infrastructure requirement)

- Make the script clients send logs with this function:

UDPStartup()
$logServer = "1.1.1.1"
$port = 514
$socket = UDPOpen($logServer, $port)

; YOUR SCRIPT HERE
_Log("Installation has started")
; do stuff
_Log("Installation has failed")

Func _Log($message)
    UDPSend($socket, $message)
EndFunc

- Now you have all the log files in a central location with very minimum amount of effort.

- Write some code that can parse the log files and determine failure/success of each installation. Make output of this log parser HTML.

You are done. 8)

Thanks Manadar.Used your idea to implement in my scripts.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0