I work as a software developer. A developer who doesn’t really like testing so much – so many more interesting problems to solve, so much more functionality to improve, why spend time writing tests?
“Wait a minute there”, you will say, “haven’t you created a testing tool? Don’t you spend most of your time talking about testing, how to test stuff etc.?”.Well, yes and no.
I am an engineer. Trained as an engineer, I think like one: Take a problem, define it’s parameters, devise a solution, identify edge cases, make sure the solution stays within the parameters.
The creative “destruction” really good testers bring to the game eludes me, because I think in solutions and that narrows my scope.
But as a software engineer I also think about what will happen if something changes. Trying to foresee change is a sure way to bloated software and unmanageable featuritis ending with a (s)crap heap.
So in my engineer’s mind tests serve to identify breaking changes as well as proof of a working solution, building insurance for the future.
This is a limited view of testing, as it concentrates on the normal flow and the few variations and error cases identified during the design.
You could say that as a software engineer I am interested in tests for their initial validation of the logic and their usefulness in detecting regressions.
What I can say is that I am not really interested in actually running tests. From the engineering point of view, this is a job for the computer, a very interesting “problem” to solve, hence rutema, a tool for automating test execution.
Devising tests, now that is a whole craft, a way of thinking, requiring skill, intelligence and quite a bit of discipline. Just like what is needed to write software anyway, isn’t it?
Good testers approach the solution as a problem, deconstruct it and find the holes. Discipline is essential – wildly clicking on a GUI might net you a few errors, but if you cannot reconstruct them there is no test and no value.
Good judgement, imagination and discipline are not automate-able. You need a tester, a good tester, first. And you need him/her in the team, in regular contact with the developers, exchanging ideas, pointing out design flaws, helping shape your software.
Automation is necessary whenever there is repetition. Originality is required before it, and that you can only get from a good tester.
This entry fits with the – old now – entries detailing the ideas behind rutema, starting with “On test automation and management, part I”.
Off to the comments…
Posted by Vassilis Rizopoulos on Jun 27, 2010
I have been looking for a way to capture web pages as images from the command line and/or programmatically.
There doesn’t seem to be the “easy” way so this merits a note to self.
The command-line-utility-you-can-wrap-in-a-system()-call way
There are a few command line utilities, but they are not fully cross-platform:
CutyCapt works on Windows and Linux. It uses the WebKit engine.
IECapt from the same guy offering CutyCapt uses IE and obviously only runs on Windows.
webkit2png will fill your OS X needs
The write-some-code-in-Ruby way
Get selenium-rc the proxy and use the page snapshot functionality. If only you didn’t have to use the damn selenium proxy this would have been perfect.
There is Selenium gem which bundles selenium-rc and adds a CLI wrapper to start and stop the proxy server but it hasn’t been updated since July 2008 which makes the bundled selenium-rc version suspect.
The start/stop functionality is also implemented as blocking calls which a bit of a bother.
The wrapper for the server is essentially a system() call to java so it is relatively simple to grab the latest selenium-rc code and just use the code to programmatically start/stop the proxy server – still, not the easy out-of-the-box solution I would like.
Anyone else have any suggestions?
Off to the comments…
Posted by Vassilis Rizopoulos on Jun 25, 2010
A friend called me about 10 days ago. “V, I can’t access my external disk, Windows won’t see it. It lights up and all but I can’t find my data”. Now, there’s a couple of reasons something like this might happen and none of them is good. The standard answer is “format the disk” followed closely by “you should have had backups” with the occasional “you got backups? Good”. I’ve gotten pretty unemotional about delivering such news…
But in this case I just couldn’t dismiss it without trying. It was a quarter of a terabyte of photos and movies of our kids, family and friends, with no other copy available. The sentimental value alone…
Now, the disk was spinning up and registering as unformated with the proper capacity so the worst case scenario of stuck heads and scratched plates was fortunately not in play. It being a new disk it was also well inside it’s MTBF which left us with software error. A quick check revealed that the NTFS partition table decided to take a vacation to places unknown. Verdict: The data is there, but no-one knows exactly where.
There’s a whole bunch of recover-your-deleted-files apps for windows out there, some of which I have used from time to time to salvage my own disks. None has proven satisfactory (one reason I have triple backups of my data). It didn’t look like they would work this time, the geometry numbers for the disk where all wrong (I’m not sure but that suggests malaware rather than windows idiocy – somebody correct me).
Then Google turned up TestDisk. Quoting from the site:
“TestDisk is a powerful free data recovery software! It was primarily designed to help recover lost partitions and/or make non-booting disks bootable again when these symptoms are caused by faulty software, certain types of viruses or human error (such as accidentally deleting a Partition Table). Partition table recovery using TestDisk is really easy.”
Now, TestDisk is cool,super hero open source software. It does what it says on the tin with all the caveats that dealing with the myriad file systems out there entails and it runs on every platform you would need it on. But it didn’t work.
Like I said, the geometry data reported by the disk were all skewed and I couldn’t find the data-sheet to type in the proper ones. I didn’t really take the time to be honest ’cause TestDisk has a sibling, named PhotoRec.
“PhotoRec is file data recovery software designed to recover lost files including video, documents and archives from hard disks, CD-ROMs, and lost pictures (thus the Photo Recovery name) from digital camera memory. PhotoRec ignores the file system and goes after the underlying data, so it will still work even if your media’s file system has been severely damaged or reformatted.”
Now, PhotoRec is name_your_children_after_the_developer, freaking awesome open source software. Plug the disk in, plug a second one to copy whatever PhotoRec finds, start PhotoRec and go away for a weekend (it is a 1TB disk we’re talking about). When you come back it will have scraped every last byte off the bad disk.
Both tools are the work of Christophe Grenier, and I unequivocally, enthusiastically urge you to donate so that he can keep up the amazing work.
As for my mate? He breathed a deep, deep sigh of relief and went out and bought another disk for backups. I guess he will be more conscientious from now on…
Off to the comments…
Posted by Vassilis Rizopoulos on Jun 20, 2010
I’ve been trying to track down a deadlock problem that has been plaguing our system for quite a while now.
To this end we’ve run a trace on the production server (on the events to track and how to analyze them read this ). Unfortunately, I ended up with 386 trace files.
Loading them in SQLProfiler is a sure path to RSI. Thankfully google is your friend and can find everything in MS’s knowledge base :).
This article describes how to programmatically load trace files into trace tables. It’s for SQLServer 2000, but the relevant SQL still works on SQLServer 2008.
In short, I created a new database (Traces) and run the following query:
USE Traces
GO
SELECT * INTO trace_table FROM ::fn_trace_gettable(‘c:\trace_file.trc’,default)
This will create the file trace_table and load
all the trace files (that’s what the default in the function call does).
It took quite a while, but at the end it was a lot better than hitting enter 386 times in SQLProfiler (and that every time I tried to filter events)
Off to the comments…
Posted by Vassilis Rizopoulos on Mar 05, 2010
It was inevitable that rutema would one day have to use a different database than sqlite3.
To do that I needed a testbed therefore I chose mySQL.
This is a “forget-me-not” for the way to a local mySQL installation on Snow Leopard.
Instead of going with the prepackaged .dmg I chose to install mySQL using MacPorts. This was pretty straightforward and went without a hitch.
The mysql executables end up in /opt/local/bin, and they are all suffixed with a ‘5’. The actual binaries are all under /opt/local/lib/mysql5/ (no suffix there).
After compilation succeeds you need to do the following:
- Create the system tables
sudo /opt/local/bin/mysql_install_db5 --user=_mysql
- Start the server
sudo /opt/local/bin/mysqld_safe5 --user=_mysql &
The _mysql user is already present on Mac OS X 10.6
- Change the root user password
/opt/local/bin/mysqladmin5 -u root password 'pass'
In order to setup privileges, you enter the mysql command shell as root(/opt/local/bin/mysql5 -u root -p) and setup your database and users. The rutema setup looks something like
create database rutema;
create user rutema;
grant all on rutema.* to rutema;
set password for rutema = password('pass');
The current activerecord gem does not include the pure ruby mysql code anymore and requires the C based mysql gem. This is a bit tricky to install as it needs to compile as 64 bit to work with the Apple standard Ruby installation.
sudo env ARCHFLAGS="-arch x86_64" gem install --no-rdoc --no-ri mysql -- --with-mysql-dir=/opt/local/lib/mysql5 --with-mysql-config=/opt/local/lib/mysql5/bin/mysql_config
should do the trick though.
Off to the comments…
Posted by Vassilis Rizopoulos on Nov 13, 2009