Posted by admin on Jul 20, 2010 in
SQL,
code,
tips

MYSQL
How to fix the-selected-file-was-generated-by-mysqldump-and-cannot-be-restored-by-this-application error.
This post is here more of a reminder to myself. However I’m hoping that others will find it useful also.
I was testing out a piece of code which needed a new MYSQL InnoDB restored.
I had a slight issue ad when I attempted to restore the DB via the MySQL Administrator tool I got the following error message.
“The selected file was generated by mysqldump and cannot be restored by this application.”
This error is given usually when the Backup was taken via a batch job (or just a user who is using the command line).
Becuase of this the only way to restore the DB is again via the command line.
So carry out the following steps.
Firstly find the MySQL.exe file, (this will usually be stored in the installation bin folder)
then run the following using the command line.
C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql.exe -uusername -ppassword < “C:\DB Backups\nameofbackupfile.sql”
The -uusername should be something like -uroot
and the -ppassword should be something like -psecret
Hope it helps.
Martin H
Posted by admin on Jul 5, 2010 in
Testing,
VSTS,
code,
productivity,
tips,
tools

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.
Code Below.
‘———————————————————————
‘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
‘———————————————————————
Imports System
Imports System.ComponentModel
Imports Microsoft.VisualStudio.TestTools.WebTesting
Namespace RegressionSampleWebTestRules
Public Class RegressionAllHeadingLocationsRule
Inherits Microsoft.VisualStudio.TestTools.WebTesting.ValidationRule
‘———————————————————————
‘ 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
Get
Return “RegressionAllHeadingLocationsRule”
End Get
End Property
‘———————————————————————
‘ 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
Get
Return “This should Compare text from a datasource parameter in a CSV file against the page sourcecode.”
End Get
End Property
‘ The name of the expected string
Private ExpectedStringValue As String
Public Property ExpectedString() As String
Get
Return ExpectedStringValue
End Get
Set(ByVal value As String)
ExpectedStringValue = value
End Set
End Property
‘———————————————————————
‘ 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)
Try
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
End If
If e.Response.BodyString.ToLower.Contains(result2) Then
e.IsValid = True
e.Message = (“pass – - “) & result2
End If
Catch ex As Exception
End Try
End Sub
End Class
End Namespace
/End Code.
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
Good Luck
Martin H
Posted by admin on Jun 3, 2010 in
Testing,
productivity

Testing Different Browsers
This is a document I originally wrote a few years back.
It’s a living document meaning that it’s constantly being updated and it’s never finished.
I’ve removed all references to the company I work for and have instead listed in bold text the places where you should insert your company name or your companies website name or the stats gathering tool which you use.
It should all hopefully be all rather self explanatory however if you need help in fleshing it out a bit just send me a mail or reply in the comments and I’ll be glad to help you.
I hope you find it useful.
Browser Support Testing Standards
Author(s)
Martin Hall
Contents
Introduction, – Test Items, – Not To Be Tested, – Approach, – Test Applications And Resources, – Resources, – Communication, – Defect Logging, – Pass/Fail Criteria, – Suspend/Resume Criteria, – Test Deliverables
Revision History
| Author |
Version |
Date |
Change Detail |
| Martin Hall |
1.0 |
18th February 2009 |
Original Version |
| Martin Hall |
1.1 |
26th February 2009 |
Error Correction |
| Martin Hall |
1.2 |
07th July 2009 |
Update for New Browser Versions. |
| Martin Hall |
1.3 |
02nd June 2010 |
Update for New Browser Versions. |
1. Introduction
1.2.1 As testers we accept that the nature of the internet medium is such that web pages cannot be produced in such a way as to be uniformly rendered in all browsers, so as to provide a consistent experience for all users. We accept that small variations in this experience are acceptable within the ‘Levels of Support’. (See appendix 1 for details)
1.2.2. Web browsers will be assigned a ‘Level of Support’ by the insert your company name here Test Manager, in the Browser Support Table. (See appendix 2 for details of how these levels of support are decided).
1.2.3 Web browser support levels will be amended on a regular basis depending on the statistics that come from the Insert the name of your statistics system here (Webtrends for example).
2. ‘Levels of Support’ definitions
2.1. Support Level 1 – supported web browser – Support definition
2.1.1. All content and functionality MUST work.
2.1.2. Variations to presentation of content MUST be minimised.
2.1.3. Where CSS layout is used, the CSS MUST be rendered by supported web browsers, so that a fully-styled version of the page is presented to the user.
2.1.4. Variations between browsers are inevitable. In these situations, when deciding which browsers should offer a better experience than other browsers (i.e. which would be the closest to the original design), you MUST base your decision on which outcome would maximise the ‘Objectives of Web Browser Support’.
2.1.5. Pages SHOULD be developed to maximise the user experience for users of the web browser with the highest proportion of users (IE7 Windows PC at this time) UNLESS this would greatly compromise the ‘Objectives of Web Browser Support’.
2.2. Support Level 2 – partially-supported web browser – Support definition:
2.2.1. All core content MUST be readable and usable
2.2.2. Navigation functionality MUST work.
2.2.3. Any degradation to (client-side) application functionality SHOULD be graceful degradation.
2.2.4. Any degradation to presentation SHOULD NOT obscure content.
2.2.5. Where CSS layout is used, you MAY choose provide a non-styled version of the page to partially-supported browser.
2.3. Support Level 3 – unsupported web browser – Support definition:
2.3.1. No support or testing necessary.
2.3.2. All web browsers not specifically listed in the support table are unsupported.
2.3.3 There is no need to code or make any alterations for unsupported browsers.
IE = Internet Explorer,
FF = Firefox,
Chrome = Google chrome,
Safari = Apple Safari,
Opera = Opera
| Browser |
IE |
MoZilla |
opera |
safari |
Mozilla |
ie |
chrome |
| Platform |
Windows |
ALL |
ALL |
MAC |
LINUX |
MAC |
ALL |
| LEVEL 1 |
IE7.0 = 41.7% Use
IE6.0 = 18.50% Use
IE8.0 = 17.36% Use |
FF 3.6.x = 14.3% Use
FF 3.5 |
|
Safari Latest Version
To be tested On a Mac or a Virtualised Machine |
|
|
Chrome Latest Version
To be Tested on Windows. |
| LEVEL 2 |
|
|
|
|
FF Latest Version |
|
|
| LEVEL 3 |
9.0 |
FF 3.0 |
10.xx |
|
|
|
|
| MUST TEST |
7.0, 6.0, 8.0 |
FF 3.5 & FF3.6 |
|
Latest Version |
|
Latest Version |
Latest Version |
| SHOULD TEST |
|
|
|
|
FF Latest Version |
|
|
| NOTES |
Vanilla Installations should be used. May also test with Plug-ins |
Testing should be carried out with and without various FF plug-ins |
|
|
Testing should be carried out with and without various FF plug-ins |
|
|
Appendix
Appendix 1 – Background
Although we are a UK based and UK targeted company Web pages are available to viewers across the internet, anywhere in the world, using a wide variety of web browsers. These web browsers are developed by a number of different organisations with a variety of motives (some commercial), each of which interpret the source code used to produce web pages slightly differently. As a result, any single web page will not be uniformly rendered by all web browsers, to produce a consistent user experience as intended by the producer.
While this has improved over time, standardisation of web browsers is still to be achieved. The quest for standardising source code and the manner in which web browsers interpret it, has been led by the W3C (World Wide Web Consortium), an organisation whose stated role is to try to “lead the Web to its full potential”. The support amongst the community of web developers for standardisation has come to be known as the ‘Web Standards’ movement.
This insert your company name here standards document exists so as to produce web pages that can be viewed (as consistently as can reasonably be achieved) by the greatest number of people possible.
HTML and CSS for separation of meaning from presentation
Because of the lack of web standards in the past, the only way to provide a consistent user experience was to use only the small range of source code features which worked across all web browsers. Specifically, the inconsistent rendering of CSS meant that CSS was not used much. HTML, which was more consistent, was used for both meaning and presentation; although its intended purpose was semantic rather than presentational.
With the advance of web standards, this has changed. HTML should thus be used to mark-up web content, to give it semantic meaning; while CSS should be used to define the presentation of content.
Not only is this how HTML and CSS are intended to be used (as outlined by the W3C), but it brings a wealth of advantages that considerably improve the potential to improve public value at insert your company name here; especially in terms of reducing costs and improving usability, e.g. accessibility. The use of HTML and CSS in this manner is often referred to as ‘standards compliant code’.
Web browsers employ varying degrees of compliance to W3C recommendations (web standards) and consequently insert UI Developers name often has to employ hacks and work-arounds* to meet the above Browsers Support Levels so that our content can be viewed by the widest possible audience, while providing the optimum user experience. However, these hacks and work-arounds cost time and money, for supporting older, less standards-compliant browsers.
This insert company name standard defines which web browsers are supported by the insert company name, based on these and other contributory factors, to optimise value for users of the insert company website name website.
- A hack is something that is not valid
- a work-around is valid, but requires additional code
Appendix 2 – Objectives of Web Browser Support
When considering which ‘Level of Support’ a web browser should be assigned, the following are some of the issues that are considered.
- Firstly we should check our insert statistics tools name stats to see the browsers that our current customers use and make sure we are proving content that all of our current users can view. Any browser used by more than 3% of our customers is added to the SHOULD TEST list and any browser which is used by more than 5% of our customers is added to the MUST TEST list.
- Web standards are good for the web and meeting these standards offers value for money. Meaning that we will not have to recode a page because of incompatibilities.
- Insert company name customers use a variety of web browsers. Our aim should be to provide the best possible experience to the largest number of people.
- All of our customers are considered to be valuable.
- Some people use accessibility tools (Elderly or Disabled) – these people benefit greatly from web pages that are standards compliant.
- Insert company name should not, where possible, provide a service that gives a competitive advantage to any particular product or service. (E.g. we should not add to any page ‘works best in x browser’).
- Insert company website name represents insert company name. The companies image is considered to be of importance and, therefore, as a main communication point with our potential customers we should be displaying content that works well and has a nice look and feel to as many who view as possible.
Martin Hall
Posted by admin on Jun 2, 2010 in
Testing,
tips

Why we need testers
As I promised in my last blog post, here is the presentation that I gave a couple of years back on why we need testers in development teams.
please note that everything about this presentation is rough as it was never meant to be publicly shown or distributed, it was created for a small in-house audience.
I’ve posted the headline text for the slide-show in this blog post and then link to the powerpoint file below. You’ll have to fluff out the main text as it’s only main headlines so I knew what text was coming for which slide.
DOWNLOAD THE POWERPOINT PRESENTATION
If you wish to make a similar presentation in the future you’ll have the slide-show above and the headline text below to refer to.
Text for the Slide-Show =
QA – Why we need Testing and Testers
2) Jigsaw story or why developers shouldn’t test
3) What is Quality and how to measure it?
Well we sometimes take quality to be subjective and we expect that others will know what we mean when we say that a product has quality.
But in an example of an car one user may say that the car has quality because of leather seats and air con – yet another may think otherwise and base the quality upon the engine specifications etc. However quality can universally be measured by the way a product meets its specifications.
If a finished product meets its design specs 100% then it can be argued that it is a quality product as it has been built exactly the way it was supposed to be built.
4) BAD CODE = Creating poorly written code
Even after decades of advancement the software industry, the quality of software produced remains one of the biggest problems. This coding bad practice started mainly during the dot com boom as new start ups rushed to produce a working example of the “next big thing”, Even in today’s market we have a large focus on “time to market”, not only this but also the sheer growth and volume of software being developed, and the amount of amalgamated new technologies to absorb, it really is no surprise that software development houses still continue to face quality problems. There are two main sides to these quality problems: high defect rates and lack of code maintainability.
5) ROI – Return on Investment
Speeding up Development time and less cost.
Almost every organisation in the world be they schools – governments or Nasdaq/FTSE100’s rely on software to help them with their daily processes. A vast majority will depend upon the software industry for product development, production, marketing, support, and services.
Spending on software development is very costly but there is a great way to partly reduce that cost and that it efficient testing processes. For example if there is going to be more that 3 iterations of software then it will usually be financially viable to start an automated regression testing process.
Better company image.
There can be nothing worse than using a piece of software and it crashing in front of a user. Especially if it does it in a messy way (losing data etc.)
Imagine buying a piece of software and having it fall over constantly because you put an apostrophe in a name field (O’Donnell for instance). This type of thing will happen on badly coded systems with SQL back ends (SQL Injection).
But with through testing the system should never fall over in front of the user and if it ever does the error should be captured and the user given a helpful message. With wide spread use of the internet its also possible to have automated bug reporting built into programs so that they not only provide the user a decent message and close correctly but they will also automatically report the bug to the software house with a small process tree list and provide the user with a defect ID.
This goes back to the car and idea of a quality product. If it does what it says on the tin then it should be OK.
But of course we can’t just test using this “on the tin” approach we have to try and break our product by first doing what it says “on the tin” (the design specifications) and then by doing everything else (lookup equivalence partitioning).
This can include buffer overflows. Out of range integers – non syntax types – e.g. text in a date field etc.
6) But I said we need testers before I mentioned automated tools so can’t we use these test monkeys find these bugs?
Well the answer is NO –
Bugs are found during manual testing based on a testers desire to deliver quality product. Verification is conducted while the testers are operating the applications and comparing the actual results with the results they expect. However, some bugs are still not detected with manual testing. Therefore, it is desirable to automate as many of the manual testing tasks as possible.
But these automated tools lack the common senses of a human being. Manual testers are still needed to test the high-risk areas of the products.
Test monkeys however do have a purpose and are often used in addition to human tests. Test monkeys are automated tools. Their testing actions are randomly performed without a user’s bias.
Benefits of them can be
1) They will run and run until they crash a system (fuzzing being my favourite kind)
2) They can be put on an old or slow system
3) They don’t get bored or care if they GUI has changed. (they can run test scenarios for days on end non-stop)
4) Microsoft said that 20% of all its defects found were by using monkeys.
Not all automated tools are dumb monkeys in fact the majority of tools used are partly AI based.
7) The Perfect tester
What makes the perfect tester? In my opinion it’s the same hacker mentality of Steve Jobs, Steve Wokniak, Bill Klaxton and Bill Gates the old school hackers who helped to create the systems we use. They took a look at what systems existed (virtually everything back then was IBM or listed as IBM compatible) and wanted to change those systems by making them better.
It’s wanting to know how something works and wanting to see if you can beat it.
This beating it for me is finding a bug.
If any of the above is used in any presentations then I’d love to see/read your take on why software needs testers.
Posted by admin on Jun 1, 2010 in
Testing,
productivity,
tips

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
SQL,
code,
productivity,
tips

MySQL Logo
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.
Martin H
Posted by admin on Apr 12, 2010 in
SQL,
code,
productivity,
tips

mysql logo
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;
Enjoy.
Martin H
Posted by admin on Mar 30, 2010 in
SQL,
code,
tips

SQL Code
OK so just like the post below about searching for columns or table names. This post is all about how to search inside Stored Procedures for strings / text.
This can be really useful especially if you know a piece of code is called but your not sure which stored proc calls it.
As before we are going to use the ‘users’ string to keep consistency.
I had searched high and low for this code on the internet but couldn’t find anything. All of the examples I found only searched in the first 255 characters of stored procedure which is OK if its a declaration your looking for however not too good if your stored proc has unions and has declarations half way down the procedure. So I decided to write my own.
Anyway on with the script. (really nice and simple)
– Author : Martin Hall
– Date 17th February 2010
– Search Stored Procedures for Text. (see Definition like)
SELECT Name
FROM sys.procedures
WHERE OBJECT_DEFINITION(object_id) LIKE ‘%users%’
Hope you Enjoy
Posted by admin on Mar 30, 2010 in
SQL,
tips

SQL Code
This is a very useful script which I use all of the time. Especially if there are issues around Database Schema maps being kept up to date.
This SQL script will take a string as an input and output all of the column names and table names where that string is used.
So for instance you have a column called username however its not in the obvious place which would be the users table. You know the column exists as you’ve seen it trace outputs or the developer has said to you “check the users column.
You would run the below script and would get a list of any Tables or Columns with a name like ‘users’
– Author : Martin Hall
– Date 12th June 2009
– Search Table or Column for text
– To search for a TableName then just change the “where syscolumns” to “where sysobjects”)
SELECT syscolumns.name AS [Col Name], sysobjects.name AS [Table Name]
FROM syscolumns INNER JOIN
sysobjects ON syscolumns.id = sysobjects.id
WHERE (syscolumns.name LIKE N’%users%’)
Order by sysobjects.name
Hope you find it useful.
Tags: SQL search Column Names
Posted by admin on Mar 22, 2010 in
Today's News

Google.CN Moved to Hong Kong
As the title states Google.CN is moving all searches offshore to Hong Kong. Google.Com.HK
However the Google Domain is still live for other things like maps = Google Maps China
Is still live. As are Google Images and Google Products and Google Q & A all for China on the .CN domain.
And most important of all the firewall of china is now turned off according to Googles owns Blog. It will be interesting to see how China reacts especially as officially Hong Kong is still on Chinese soil.
This all resolves from the Aurora Attacks. Many big companies got hacked in those attacks but it was not Google’s own accounts being hacked that got its goat. It was however the accounts of many prominent Chineese human rights activists who had their Gmail details hacked.
In fact according to Google the hackers were after two things, firstly the accounts and details of the activists and then secondly the source code of many internal applications. They accessed the source code via source management systems.
What will be interesting is how the Chineese Government react to this change (especially if Google remove the censorship from searches). So far they have only stated that “There will be consequences”
And just to prove that the Google US Exec’s know how bad the human rights violations in China are they try and give their resident Chinese execs a get out of jail free card so the Ministry of State Secrets (MSS - Guojia Anquan Bu [Guoanbu])won’t come and round them up.
“Finally, we would like to make clear that all these decisions have been driven and implemented by our executives in the United States, and that none of our employees in China can, or should, be held responsible for them.”