Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

AutoHotkey as an automation testing aid tool


  • Please log in to reply
16 replies to this topic
pdavit
  • Members
  • 6 posts
  • Last active: Mar 13 2009 08:00 PM
  • Joined: 15 Jun 2005
Dear friends,

In my company we use a web-based application written in Java and I'm evaluating if I could potentially use AutoHotkey to create procedures for automation testings in order to schedule and reduce testing run times that require human interaction.

Do you believe this is possible via AutoHotkey and what would you suggest as a starting point?

Thank you in advance for all your time and support.

Carcophan
  • Members
  • 1578 posts
  • Last active: Nov 27 2013 06:46 PM
  • Joined: 24 Dec 2008

Do you believe this is possible via AutoHotkey



Not only possible, but its probably your best option!


Whitebox and blackbox testing is amazing with AHK given the right set up.


There are a million places to start, but we need to know a little more to offer help. The web-page, you can use serveral existing scripts to read and write to web sites. You can use several existing scripts to run, edit, create files and scenarios.

The skys the limit really. Where did you want to start?

quantum2384
  • Members
  • 56 posts
  • Last active: Jun 27 2013 07:13 PM
  • Joined: 26 Jun 2012
I am an intern doing just that. The kid that sits behind me manual tests an application that is used in doctors offices(entering in new patient information, database importing exporting, etc.) while Iuse autohotkey to do that he's doing. It's a time consuming process if you are unfamilliar with AHK (I started 4 weeks ago and had never even heard of it). But once you get the hang of it you can do some pretty crazy things for QA testing. I just finished up a series of scripts that have .ini file settings that can be altered so that only certain tests - that I wrote - are ran and at the end of the tests it produces a .ini file telling which tests passed and which failed and produces a screen shot of where that test failed. It's coupled with a script that monitors the network folder where new builds for the app are dropped daily. So in full the script(s) monitor the folder, when a new build is released, it copies it to a folder, runs the installer, automates through the install wizard, runs the app, performs (right now only a new patient test), produces a .ini file of the test results and emails the file to build team effectively making the kid who sits behind me useless.

I am also only using AHK basic not AHK_L. The company I am working for had somestuff mainstreamed in AHK already and don't want to upgrade (The said if I wanted I could rewrite the thousands of lines of codes so that it'll be compatible with L, but that's not happening -___-)

  • Guests
  • Last active:
  • Joined: --

The company I am working for had somestuff mainstreamed in AHK already and don't want to upgrade

have a look at the code, if you don't spot any DLL calls you can probably just upgrade. But you can simply try by download the ZIP and run it without installing ahk. AHK_L Ansi will defenitely work, unicode version might not if it has said DLL Calls.

Maestr0
  • Members
  • 652 posts
  • Last active: Aug 17 2019 06:07 PM
  • Joined: 18 Oct 2008
Sounds interesting. By the looks of it you've come a long way in 4 weeks.
If you need any script-specific help, please post.

Also what Guest said, you don't need to install autohotkey, you can just "open with" the executable.
You could even make your script .ahkl and just open that always with ahk_L ;)

quantum2384
  • Members
  • 56 posts
  • Last active: Jun 27 2013 07:13 PM
  • Joined: 26 Jun 2012

The company I am working for had somestuff mainstreamed in AHK already and don't want to upgrade

have a look at the code, if you don't spot any DLL calls you can probably just upgrade. But you can simply try by download the ZIP and run it without installing ahk. AHK_L Ansi will defenitely work, unicode version might not if it has said DLL Calls.

I already looked into it, the basis and backbone scripts for the automation they already have in place is DLL Calls. Otherwise I would've upgraded just to make the emailing of test results easier -____-

quantum2384
  • Members
  • 56 posts
  • Last active: Jun 27 2013 07:13 PM
  • Joined: 26 Jun 2012
Well all I do for 40 hours a week is use AHK for automation purposes =p. I took a class in Matlab and had to do Calc3 and 4 projects in Maple last semester, so AHK was pretty easy to pick up. The stuff I'm doing is terribly hard though. It's pretty much "wait till button exists, click button. Did button work? yes? Then write that in an .ini file. No? Then write that in a .ini file. Repeat untill Eyes bleed. Open outlook send .ini file to list of people"

Maestr0
  • Members
  • 652 posts
  • Last active: Aug 17 2019 06:07 PM
  • Joined: 18 Oct 2008
lol, seems like Autohotkey could be your medication to preserve your sanity ;)

quantum2384
  • Members
  • 56 posts
  • Last active: Jun 27 2013 07:13 PM
  • Joined: 26 Jun 2012
So my testing software is completed. And it works beautifully. My issues comes down to how the hell do I do email. I have the server name, IP, and port number and I need to send a file containing the test results to several emails, but I have no idea how to go about it. I've been poking around the forums for a better part of 9 hours of work time trying to find a solution and I haven't been able to find anything.

Maestr0
  • Members
  • 652 posts
  • Last active: Aug 17 2019 06:07 PM
  • Joined: 18 Oct 2008

So my testing software is completed. And it works beautifully. My issues comes down to how the hell do I do email. I have the server name, IP, and port number and I need to send a file containing the test results to several emails, but I have no idea how to go about it. I've been poking around the forums for a better part of 9 hours of work time trying to find a solution and I haven't been able to find anything.

Have you considered doing a Run mailto:?
Run, mailto:[email protected]?subject=Subject&body=%testresults%
and pick it up from there with an ifwinexist and do the keys needed to send the email.

  • Guests
  • Last active:
  • Joined: --
<!-- m -->https://ahknet.autoh...faq.html#e-mail<!-- m -->

quantum2384
  • Members
  • 56 posts
  • Last active: Jun 27 2013 07:13 PM
  • Joined: 26 Jun 2012
So a coworker sent me a VBS script that he uses, but he was too busy to help, but what I want to do is take this following script

Set objEmail = CreateObject("CDO.Message")
objEmail.From = "[email protected]"
objEmail.To = "[email protected]"
objEmail.Subject = "Testing SMTP email script"
objEmail.Textbody = "email body"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = number
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "server"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = number
objEmail.Configuration.Fields.Update

objEmail.Send

So I have a .ini file containing the email addresses I was to send to. I want to, using AHK read in those email addresses, and then attach the .ini file with the Results and send it. I never used VBS before so I'm currently clueless

Maestr0
  • Members
  • 652 posts
  • Last active: Aug 17 2019 06:07 PM
  • Joined: 18 Oct 2008
Then I'd go with this: <!-- l --><a class="postlink-local" href="http://www.autohotkey.com/community/viewtopic.php?p=403177">viewtopic.php?p=403177</a><!-- l -->

quantum2384
  • Members
  • 56 posts
  • Last active: Jun 27 2013 07:13 PM
  • Joined: 26 Jun 2012
What I ended up actually doing was editing the VBSscript (Yeah for google) so that I could pass email addresses, attachments, and subjects lines through from AHK.

VBSScript = %A_WorkingDir%\sendemail.vbs
	email := "email"
	iniread, BuildName, foldermonitor.ini, foldermonitor, buildname
	subject = %BuildName%
	Attachment = %A_WorkingDir%\TestResults.ini
	loop, 15
	{
		iniread, email, file.ini, Email, name%A_index%
		RunWait, cscript.exe //nologo "%VBSScript%" %email% "%subject%" "%Attachment%",,Hide
	}

The above code in AHK sent to the VBS a list of 15 emails stored in a ini file.

emailTo = WScript.Arguments(0)
emailSubject = WScript.Arguments(1)
emailAttch = WScript.Arguments(2)

Set objEmail = CreateObject("CDO.Message")
objEmail.From = "Email"
objEmail.To = emailTo
objEmail.Subject = emailSubject
objEmail.Textbody = ""


objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = number
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "server"
objEmail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") =number
objEmail.Configuration.Fields.Update

objEmail.AddAttachment emailAttch

objEmail.Send


quantum2384
  • Members
  • 56 posts
  • Last active: Jun 27 2013 07:13 PM
  • Joined: 26 Jun 2012
After 2 weeks, thousands of lines of code, writing and rewriting. Testing and retesting. My script is loaded to the centeral server and trucking along. The kid who sits behind me is now getting moved to a new project because my scripts took his job, and my next project is once again to write scripts to take over his new project.