Posted by admin on Oct 22, 2010 in code
Again this is another note to myself, however it may be useful to others.
Yesterday I was attempting to run a Ruby script to check for ASP .Net Padding Oracle problems on a site and I got the following issue.
undefined method `lines’ for #<String:0x240d448>
I had looked at the Ruby Source code and all looked ok however there was still the issue when running the script.
It turns out that in Ruby Versions prior to Ruby 1.8.7 String doesn’t have a lines method and hence the error received. I was running Ruby 1.8.5
So the fix was a simple upgrade to the latest version of Ruby and then to run the script again and voilla the error is no more an issue.
Hope the above tip helps, if your receiving the same error.
Posted by admin on Jul 5, 2010 in code
Visual Studio Webtest Logo
I use Visual Studio Team Testers Edition everyday at work and one of the things that seemed really strange to me was that Microsoft had missed so many tricks when they decided to release it.
Maybe they just decided to build in reasons for users to upgrade, knowing that there will always be another version of VSTS around the corner.
One of the things which is sorely missing is the ability to verify HTML source code against a datasource. Sure you can load a data source and then verify what is returned on the page when that row of the data-source is called however there is no functionality to check that the value of the row that you have submitted is returned somewhere in the HTML source (known as the response in VSTS).
So as per usual when you need something doing then, do it yourself, and hence I wrote a small piece of code that looks at the source code and then checks the value of the datasource row to make sure that the item you are submitting is returned in the HTML response.
All the data is dynamic from your source so you can’t just hard code validation rules, as there could be thousands of rows.
For an example take a Google search test. Imagine I want to check that my datasource of 10,000 records is retuned on every response.
So if I search for “System Testers” as a parameter value
“Parameter Name = q” and
“Parameter Value = Google DataSource.Directory_03062010#csv.SearchParams”
In the above QueryString Parameter you can see
the Datasource is called “Google DataSource”
the Actual FileName is “Directory_03062010″ (and it’s a CSV file)
the Column name is SearchParams
I’ve commented my code to make it easier to understand however if you need any help just ask.
‘Author = Martin Hall
‘Purpose = To load text from a DataSource and then to compare that text
‘ against the source code on the page your testing.
‘Date = 07th June 2010
Public Class RegressionAllHeadingLocationsRule
‘ Specify a name for use in the user interface.
‘ The user sees this name in the Add Validation dialog box.
Public Overrides ReadOnly Property RuleName() As String
‘ Specify a description for use in the user interface.
‘ The user sees this description in the Add Validation dialog box.
Public Overrides ReadOnly Property RuleDescription() As String
Return “This should Compare text from a datasource parameter in a CSV file against the page sourcecode.”
‘ The name of the expected string
Private ExpectedStringValue As String
Public Property ExpectedString() As String
Set(ByVal value As String)
ExpectedStringValue = value
‘ Validate is called with the test case Context and the request context.
‘ These allow the rule to examine both the request and the response.
Public Overrides Sub Validate(ByVal sender As Object, ByVal e As ValidationEventArgs)
Dim result2 As String
‘we only want request2 to match the source code on the returned web page.
‘the SourceCode could be different on the other pages.
result2 = (e.WebTest.Context(“Google DataSource.Directory_03062010#csv.SearchParams”).ToString())
‘This should check the response for text
‘The text in question is the ParamValue we are supplying as new fake
‘parameter name and value
If e.Response.BodyString.ToLower.Contains(result2) = False Then
e.IsValid = False
e.Message = (“fail – - “) & result2
If e.Response.BodyString.ToLower.Contains(result2) Then
e.IsValid = True
e.Message = (“pass – - “) & result2
Catch ex As Exception
The above script is in Visual Basic.Net and it should work for you and if you need any help in how to install and run it then either send an email or reply in the comments.
One last thing to mention is that the values from the data source are loaded in a fake Parameter Name (Just make one up) which will be ignored by the Website however it will show as a Context Name in the Visual Studio Web Test, so we are really just comparing two Context Names
Posted by admin on Jun 1, 2010 in productivity
The Testing Jigsaw
A couple of years ago I was asked to present a talk at a testing conference.
I did a whole presentation that I will post up to the blog in a week or two. The one part of the presentation that seemed to grab everyone’s attention was a story I told about the Developer / Testing Jigsaw.
I think the reason it was so widely accepted was because its given in the form of a story, and we all like a story right?
So if your all sitting comfortably then I’ll begin.
There was once a small boy and his father sitting down together one Sunday afternoon. The father said to his son I have a small surprise for you. I’ve made you a little jigsaw puzzle, its of a tree with grass and sky as the background. Wow, said the little boy as his face lit up, can we do the jigsaw now please?.
Of course said the dad.
So the dad tipped out all of the pieces onto the mat and begun attempting to put the jigsaw together. The son asked his dad if he could help by looking at the picture on the box and advising his father on where he thought the pieces were meant to go.
However his father said “no need – I created this puzzle so I know exactly how it should go together”.
The father struggled on for another 3 hours and wasn’t really any closer to getting the puzzle finished. He then got in a mood and said that he gives up and some pieces must have got lost.
The son then took over and compared each piece to the box making sure that he was putting the pieces where they were meant to go. He did the smart thing first by putting all of the corner pieces where he thought they should go. He looked at the box once more and thought to himself that blue is the sky, the green is the grass and the brown is the tree. So he separated the coloured pieces in 3 piles
He eventually finished the puzzle in about 45 minutes.
There is an obvious key to what is happening above in this story.
The Son is the Tester
The box is the Functionality Specification Document.
The Dad is the Developer.
The jigsaw is the piece of software that has been developed
Yes developers can test code, in fact I encourage it (peer reviews of other developers code and Unit tests), however they should not be the sole testers of code, especially if the code is written by them. Going down that route is a recipe for disaster.
The son who had never seen the jigsaw before managed to finish it in a faster time than his father and also in a more methodical manner.
Testing is a mindset. It’s an art that I, and many others spend every day attempting to perfect. Developers spend most of their day writing code, (also testing their code – Unit tests etc.)
I’m all for test driven development, however lets not forget that with specialisation comes speed and efficiency savings.
Posted by admin on May 10, 2010 in code
This little piece of MySQL Code I wrote a month or so ago.
I had a defect and was trying to provide some decent feedback to the developer on Test-Track (our defect logging system).
I knew that the defect was in a stored procedure and to attempt to run profiler in Mysql can be a bit of a pain so I figured that I’d work out a way to search in every Stroed Proc for the bit of code causing the error.
I knew that the error was caused by the peice of code calling “Videos”.
I looked around on the net but I couldn’t find anything that suited. I did find one other piece of sample code but I found that that only search inside the first 256 chars of the Stored Procedure and I needed something that would search inside the whole of the procedure no matter how long it was.
Once again it’s a nice and simple piece of code.
– Author : Martin Hall
– Date 09th April 2010
– Search for Text inside a MySQL Stored Proc
– MYSQL Version
– See the Like Query for an example of Use.
SELECT * FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE “%video%”
Order by Routine_Name;
Hope you find it useful.
any issues then let me know.
Posted by admin on Apr 12, 2010 in code
You may remember that about three weeks ago I posted a handy script to search for the names of Tables and Columns in a Microsoft SQL database.
Well now today it’s the turn of MySql.
Just a nice and simple script as before however this time there are two seperate scripts one for tables and one for columns names.
– Author : Martin Hall
– Date 09th April 2010
– Search Table or Column for text
– MYSQL Version
– Top query for Table Names and bottom query for column names
SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME like ‘%users%’
Order by table_name asc;
SELECT * FROM INFORMATION_SCHEMA.COLUMNS
WHERE Column_NAME like ‘%video%’
Order by column_name asc;
Posted by admin on Jul 14, 2009 in productivity
To Do lists
I’ve been using TADA lists for about 3 months now and I love them. They just do exactly what you would expect.
You set up a list and you can move the priorities around depending on how your plans throughout the day change.
I have lists created for
In Planning (soon to be handed to test)
Handed Back to Developement for defect correction.
Let me make clear that this is not meant to replace any defect management system you may have in place. Its far to basic for that.
However if like me your daily priorities are constantly changing and you need to maybe make other team members aware of what things are being worked on in which environments then I have found this as a quick and easy fix.
It can of course be used for many other things like shopping lists. I’ve taken my mobile phone shopping before and when my wife gets home she jumps on the PC and just updates my TADAlist with any items that she needs that I may have missed off.
I then get an email on my mobile phone and bingo I now have an updated list to walk around the shop with. Yes she could ring me but I’d have to write it down. I just find this just easier.
Maybe on that note in the future I should make a post about the perils of using technology just because its there.
Anyway enough of the digressing I hope you find the tool as useful as I and the people I work with have.
Posted by admin on Mar 13, 2009 in productivity
Software is Rarely Good, Cheap and Fast
This post will be about the topic I like to call the Universal Constants of testing.
What I find really important in my job is to get the business to buy into these constants and once achieved I find that everyone is happier with the end product when it is delivered.
Look at the triangle on the left to get an idea of what I mean by the Universal Constants.
I’ll also give some examples as I find that an example always to explain a new concept.
The basics of the Constant is that
- You can have it Fast and Cheap however it won’t be Good
- You can have it Fast and Good however it won’t be Cheap
- You can have it Good and Cheap however it won’t be Fast.
Posted by admin on Feb 12, 2009 in code
In this post I want to give people a nice heads up to some of the tools I use in my daily role.
I use these with firefox although IE and Opera should also fine fine for them also. In Firefox just add them to the bookmark toolbar and you’ll have them at your fingertips.
Zap Cookies! This will clear out any stored cookies for the current page/site
Edit Cookies! This will allow you to edit and stored cookies for the current page/site
View Cookies! This does exactly what it states, it allows you to view and stored cookies for the current page/site
Allows you to edit any page you use this on. All changes are temporary of course and only visible to you. (will you ever trust a web page screen shot again?). Not yet sure how this fits into the testing arena, however I though I would include it as someone may make decent use out of it.
Find Redirects! This should list any redirects for the current page, however its currently a tiny bit hit and miss and is does not work 100% of the time, it should however suffice for now and I’ll most likely have to rewrite this at some point in the near future.
remove redirects Lets see what happens if we now remove those redirects we just found using the above Bookmarklet.
Wikipedia lookup This allows you to select any text on a page and once clicked it will lookup that text on Wikipedia
Yahoo site search This allows you to select any text on a page and once clicked it will search on Yahoo for more links from that domain with the same text.
Alexa This will carry out a search at Alexa for the domain you were on when you clicked this bookmarklet.
MSN IP Search Firstly I should thank Robert Hansen (RSnake) for this one. Once clicked it will carry out an IP search which can help you detect a wider network for your testing.
numbered list One of my favourites this one. It allows you to make a nice numbered list of all parameters on the page which contain numbers.
show hiddens This and Zap Cookies are my most used Bookmarklets. this one will display all hidden fields on a webpage and also allow you to edit them.
remove maxlength This will remove all the max lenghts from all input fields (think buffer overflows and code boundary issues)
undisable Who says you can’t click that button . This Bookmarklet will enable any disabled objects on the page.
up This will take you up one directory level in the site structure
top This will take you to the top of the domain.
decrement If your URL ends in a number it will reduce it by one every click
increment As above but the opposite
check images This will check the current page for broken images.
view variables This will list all variable types found on the page. This is more for Developers than testers however its still a useful one to have.
view scripts Like above however it will list all scripts what can be called on the current page.
zap images This should clear all of the images from the page. Works about 98% of the time. This script may need a little tweaking if I ever get the time.
full urls as link text Very useful if you want to see where a link is pointing to.
Posted by admin on Feb 5, 2009 in productivity
Here are a couple of tools to help you become more productive while at work.
These are great especially if you are having a conference call with other team members and want to show them an idea visually.
Neither of the above require a loging to use or share.