Submit an automated test that fails along with your bug report
We touched on this one before with this tip from Dave Christiansen, however the topic came up again at last month's IWST. Depending on the tools you use, you might consider attaching automated scripts to your defects. If you can find a bug, and then quickly record a simple script that recreates it, attach that and send it along with the defect report.
This tip was part of a brainstorm developed at the September 2011 Indianapolis Workshop on Software Testing on the topic of "Documenting for Testing." The attendees of that workshop (and participants in the brainstorm) included: Charlie Audritsh, Scott Barber, Rick Grey, Michael Kelly, Natalie Mego, Charles Penn, Margie Weaver, and Tina Zaza.
Review: VBScript vs. JScript
This is the review I stumbled upon. Not a fresh news, but all up to date, brought carefully in one place. The fragment is quoted below.
VBScript and JScript are extremely lightweight ActiveX Scripting languages. ActiveX Scripting Engines may be used in a variety of Microsoft environments: Windows Scripting Host, HyperText Applications, HyperText Components and scripting for Internet Explorer, and classic Active Server Pages. There are other ActiveX Scripting languages, such as ActivePerl and ActivePython, but these tend to be complete languages in contrast to the minimal logic layer that VBScript and JScript provide. In fact, VBS/JS must use ActiveX/COM components to accomplish anything other than trivial tasks. This optimization results in some noteworthy shortcomings in both languages.
VBScript Strengths
- The De Facto Standard
- By Reference Parameters
- Formatting Functions
- Data Conversion
- Date/Time Support
- Built-In Iterator Support
- Constants
- "With" Blocks
Sauce Labs
In his talk on screen recording APIs, Jason Horn mentioned he's an avid fan of Sauce Labs and their hosted Selenium solutions. There are a host of features and pricing starts from free (Linux and FireFox, limited to 500 min/month) and goes up to monthly and enterprise pricing. You can try some of the premium services with a free trial if you want to check it out. While I haven't personally used the product, I really like the idea and I'll have to check them out on an upcoming project.
Data generation on-the-fly
Today's tip comes from Trish Khoo.
In her post "Go faster! Linking data generation to hotkeys" she describes a handy and elegant way of linking data generating Ruby scripts to AutoHotKey.
Windows key + w = Generates 2 random words and copies them to my clipboard.
Windows key + e = Generates a randomized email address that will still point to my account and copies it to my clipboard.
Windows key + c = Randomly selects a URL from a list of test email campaigns and copies it to my clipboard.That’s everything I need to fill out most forms in the application I’m testing. So when I just need safe, unique inputs, I can save a few seconds on each screen while filling in forms. More importantly, I don’t have to break my focus in order to find or generate appropriate test data.
This is an automation of a special kind. The kind that assists in sapient testing.
Automation puzzles
Solve puzzles by using basic programming concepts in a fun way. No record/playback!
Rspec and Generators
A fantastic tip posted by Catherine Powell on Rspec and Generators a couple days ago:
When working in Rails, I use the generators as easy ways to create models with migrations, and whatnot. I got used to running my generators with "--rspec" since that's the test framework I'm using currently.
I can save myself some time by adding this to my application.rb:
config.generators do |g| g.test_framework :rspec end
Don’t blame VBScript
VBScript is a very popular automation language. Microsoft VBScript Engine, which is available for free, is one of the reasons, another - on the surface VBScript is extremely simple. But I admit that switching to VBScript from C was hard at times. It required unlearning approach.
And yet VBScript is powerful enough so that a seasoned programmer used to Object-Oriented paradigm can use the same approach with a little bit of creativity.
Class Constructor
Each VBScript class has a constructor which is automatically called when a new object instance is created.
Private Sub Class_Initialize() ' put your custom initialization code End Sub
Class Destructor
Each VBScript class has also a destructor which is automatically called when life span of the object comes to an end.
Private Sub Class_Terminate() ' put your custom initialization code End Sub
Virtual Properties
Special methods Property Get, Property Let, and Property Set allow using object properties that do not actually exist.
Class Point2D '' Properties Private p_X Private p_Y '---------------------- '' Methods 'Constructor - called automatically Private Sub Class_Initialize() X = 0 Y = 0 End Sub '---------------------- 'Destructor - called automatically Private Sub Class_Terminate() End Sub '---------------------- 'A pair of methods to access private property X Property Get X X = p_X End Property Property Let X(ByVal in_X) p_X = in_X End Property '---------------------- 'A pair of methods to access private property Y Property Get Y Y = p_Y End Property Property Let Y(ByVal in_Y) p_Y = in_Y End Property '---------------------- 'A pair of methods to access virtual properties: 'Point's Polar coordinates Property Get Polar_R Polar_R = Sqr(p_X*p_X + p_Y*p_Y) End Property Property Get Polar_Phi Polar_Phi = Atn(p_Y/p_X) End Property '---------------------- End Class
Inheritance through Delegation
VBScript does not allow declaring a class through derivation. However, a programmer can declare a property (or multiple properties) and initialize it (them) with reference(s) of ancestor object(s). That will give the desired access to the properties and methods of ancestor objects.
Class ScreenPoint '' Properties 'Ancestor Point2D Private P2D 'Point color Private Color '---------------------- '' Methods 'Constructor - called automatically Private Sub Class_Initialize() Set P2D = new Point2D End Sub '---------------------- 'Destructor - called automatically Private Sub Class_Terminate() Set P2D = Nothing End Sub '---------------------- 'A pair of methods to access private property X Property Get X X = P2D.X End Property Property Let X(ByVal in_X) P2D.X = in_X End Property '---------------------- 'A pair of methods to access private property Y Property Get Y Y = P2D.Y End Property Property Let Y(ByVal in_Y) P2D.Y = in_Y End Property '---------------------- End Class
Dynamic Code and Callbacks
To demonstrate this feature, I first prompt you to read about Eval function and ExecuteGlobal statement in VBScript.
Public Function CTZ() sGlobalValue = "ExecuteGlobal successful" End Function Public sGlobalValue Public Function TestExecuteGlobal() Dim sCallName, sLocalValue Dim intRC, boolRC sGlobalValue = "Testing ExecuteGlobal" sCallName = "CTZ()" boolRC = True On Error Resume Next ExecuteGlobal sCallName intRC = Err.Number On Error GoTo 0 If intRC <> 0 Then boolRC = False If Not boolRC Then sGlobalValue = "ExecuteGlobal failed" End If MessageBox(sGlobalValue) End Function
Thus, you can add functions and any definitions (including class definitions) dynamically, during run-time - which allows referring undefined methods and objects!
There are also other magic tricks, as overloading and access to external class libraries. Hopefully this post has been a useful introduction to ignite your interest to automation tricks with VBScript.
Surplus is an asset
Today's tip comes from Peter Kartashov's article in his AT4QA blog.
One day, our team was not ready to run on time full regression tests against fresh build because of recent changes in DOM tree for many objects. We were in need to invent something robust, not silent and not verbose; this mechanism should report something into logs when a control was not found directly but it should attempt to recognize that control using set of provided properties.
After a short experience report on maintenance problems caused by large volume of automation scripts and complexity of GUI DOM tree, Peter provides analysis of downsides of default GUI recognition logic, and shares solution example - as the functional diagram and code snippet.
In the nutshell, the idea is brilliantly simple: supplying more than a minimal set of object recognition properties greatly improves automation scripts' robustness and enables automatic cross-checking between object's location and object's properties.
18 automation refactoring heuristics with code examples
Creating automation scripts from small steps and simple code is a common recommendation. In the context of learning programming, automation tools and object models it might even be considered a best practice. Yet practically using such scripts in testing brings minimal value due to variety of issues. Some of them related to programming.
Whenever encountering an external call that might break execution or raise exception see if you can improve it with error-handling.
On Error Resume Next boolRC = objRegExp.Test(sSource) intRC = Err.Number On Error GoTo 0 If intRC <> 0 Then boolRC = FALSE If Not boolRC Then Set objRegExp = Nothing Regex_Match = "" Exit Function End If
Suggested collection of refactoring heuristics covers levels of code block, subroutine, simple class, function library, and intended to help improving code, created with such tools as Quick Test Professional and Test Complete.
Visualize XML then Blink Test
XML format is a very popular data container. Programs read, generate, convert, and exchange data in XML format.
XML data chunks can be uploaded from application's GUI, or can be generated by a client part and then transmitted to a server. XML data input can be effectively used when an application has unstable GUI or has no GUI at all.
<pre><?xml version="1.0" encoding="utf-8"?> <transactions> <debit> <amount>10.0</amount></debit> <credit> <amount>55.0</amount> </credit> <debit> <amount>120.0</amount> </debit> <debit> <amount>25.0</amount> </debit> <credit> <amount>5.0</amount> </credit> <credil> <amount>15.0</amount> </credil> <credit> <amount>15.0</amount> </credit> <debit> <amount>60.0</amount> </debit> <debit> <amount>50.05</amount> </debit> <debit> <amount>75.0</amount> </debit> </transactions></pre>
...But, in testing, XML data verification task means time-consuming process of going through countless, similar-looking text lines, with a high chance to get bored and miss an inconsistency.
Sample Task
Verify “transactions” xml file presented above.
Only “debit” or “credit” records are valid. Any other entries must be located and reported.
Additionally, identify and report all debit records with debit amount greater than 50.00.
As you can see, even going through just 10 records takes a significant time and might become really boring task.
With a 100 of records it's pretty much a brain-dead work to do.
How can we transform it to re-enable brain-powered testing?
Blink Testing technique, as described by James Bach, would be a perfect fit to engage rapid pattern recognition capabilities of a human brain. However, applying it directly to a textual source of an XML file may lack of efficiency due to complexity of a pattern.
Transforming XML text into a web-page looking table (HTML table) with inconsistencies color-coded, gives an instant productivity boost for blink testing.

XML visualization technique
XML transformation, presented above, is performed with help of XSL (Extensible Stylesheet Language) script.
Creation of XSL scripts does not require installing any IDE - you can use just a text editor, like Notepad. You would need minimal programming experience to start creating your own scripts, and you can easily modify existing templates.
XML source sample and its visualization were taken from my article "XML verification example".
You can also find there XSL source code template and links to other XML/XSL related articles.

