Posts in Automation
SEED NATALI: GUI Step Automation Heuristic
Whenever you implement automation of GUI steps, suggested heuristic might help you to keep track of operations you need to code.

GUI Step

(click on the picture to see mind map in online version with expanded nodes)

SEED NATALI acronym stands for the following.

  • Synchronize till object

  • Exists

  • Enabled

  • Displayed

  • verify Number of Arguments

  • verify Type of Arguments

  • Log test flow

  • Investigate any issues occurred

Stella
Stella is a handy web application testing tool developed by Solutious Inc, a small software company based in Montreal. Stella is a very lightweight Ruby test tool for functional and performance testing. Like JMeter, Stella doesn't simulate a browser; it generates HTTP requests and parses the responses. Currently, Stella provides support for automatic parsing of HTML, XML, XHTML, YAML and JSON.

A few months ago, I wrote an introductory article on Stella for SearchSoftwareQuality.com - you can find it here.
Bring up your Desktop in double-click!
Today I offer a time-saving tip for those who has to work on multiple test desktops, including virtual machines.

What do you do when preparing for your test session?

  • Opening folders?

  • Opening browsers?

  • Opening test cases?

  • Opening test reports?

  • Starting application-under-test?


If each desktop or VM is configured for a specific testing environment, the steps above probably become even more complicated.

  • Opening folders: "Well.. let's click "My computer"..then Q:\ drive... then "Projects".. then..."

  • Opening browsers: "What ip should I use, again? Is it 13.24.597.68:3397? "


Would you like to have a magic button to bring everything up in one click?

herewego-bat

Today you can create one for yourself and your team.

[sourcecode language="bash"]

@echo off

REM Open mailbox
start "QuickTestingTips" "C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE"

REM Open folders
explorer.exe "C:\Documents and Settings\All Users\Documents"
explorer.exe "c:\project\test cases\module1"
explorer.exe "c:\temp"

REM Open browsers
start "QuickTestingTips" "C:\Program Files\Internet Explorer\iexplore.exe" google.com
start "QuickTestingTips" "C:\Program Files\Mozilla Firefox\firefox.exe" yahoo.com

REM Open bugtracker
start "QuickTestingTips" "C:\Program Files\Internet Explorer\iexplore.exe" jira.com

REM Open documents
start "QuickTestingTips" "C:\Temp\TestReport.doc"
start "QuickTestingTips" "C:\Temp\TestPlan.xls"

REM Start Application Under Test
start "QuickTestingTips" "C:\WINDOWS\system32\calc.exe"

REM Last but not least
start "QuickTestingTips" "C:\Program Files\Internet Explorer\iexplore.exe" softwaretestingclub.com

[/sourcecode]

Instructions


Create a text file on your desktop, and paste the source code.
Save the file and change its extension to ".bat". - You've just created an MS-DOS batch file.
Double-click on it to start it, or right-click and select "Edit" to put relevant parameters.

  • Use REM to comment out a line

  • Use quotes while supplying an extended syntax path (i.e. with long names and space characters between words)

  • Study extended MS-DOS batch file syntax if you want to make your scripts even more powerful

  • Store scripts in a shared folder to make them accessible by teammates


Downloads


herewego.bat
Throw away code can be ugly code
Recently, I needed to do a bunch of test setup in a web application. I had to manipulate around 5,000 records, and due to a time crunch and few people around over the holidays, it was easier for me to get at the GUI than it was the database. So I decided to write a quick Watir script to do the edits for me.

I had a spreadsheet with all the changes I needed, so I decided to let Excel write the bulk of my code. Using the CONCATENATE() function, I inserted the following into the first row:

CONCATENATE("ii == ", A1, " ? temp = ", A6, A3, A6, " : temp = temp")

That creates something that looks like this:

ii == 1 ? temp = "Some Value" : temp = temp

All I had to do was drag that down to fill each row and I was able to copy and paste a very large block of code from Excel into a loop in Ruby:

for ii in (1..5005)
#do some setup using Watir
ii == 1 ? temp = "Some Value" : temp = temp
ii == 2 ? temp = "Some Value" : temp = temp
ii == 3 ? temp = "Some Value" : temp = temp
ii == 4 ? temp = "Some Value" : temp = temp
#...etc...
ii == 5005 ? temp = "Some Value" : temp = temp
#do something afterward using Watir
end


Now, this is REALLY UGLY code. I know it's ugly, and you know it's ugly, but I'm defending it because it only took me five minutes to get my script running. It ran for a couple hours, and I was done. All of my test setup complete. I deleted the script and moved on.

While my solution wasn't elegant, it worked. Someone later told me about an Excel library I could have used, and I didn't feel bad about not using it. Sometimes you need to resist the urge to write an elegant solution if you're just hacking away at a simple problem.
Test ideas that come from test automation
I know it's not fashionable to like GUI-level test automation any longer. But whatever, I still like it. I'm unfashionable in more ways than one. I still like GUI-level automation for reproducing bugs, automated acceptance testing, and to support my performance and exploratory testing. I also like non-GUI tests, but I've never disliked GUI automation.

One reason I still write GUI-level test automation is because it helps me learn about the product. I'm still amazed at how many times I say "Wow, really?" when I'm writing my tests. Because I'm always picking at the GUI with tools like FireBug and Web Developer while I'm testing, I'm seeing things I don't normally see when I'm just clicking around.

For example, today I noticed:

  • One of the applications I'm testing doesn't remove fields from the screen when they aren't active, it just hides them. I had never noticed until I counted on it not being there in my code.

  • One of the applications I'm testing sometimes shows a parent child relationship using icons, and sometime doesn't.  I had never noticed until I coded a rule expecting it to always be there.

  • One of the applications I'm testing appears to have a relationship between fields that I wouldn't have expected. I discovered this based on field naming conventions.


All of these give me new test ideas completely unrelated to my automated tests. Anytime I'm surprised, I use that as an indicator that I have more tests to run. When I automate at the GUI-level, I often get surprised. I rarely get surprised when I'm automating against an API.