I noticed a missing distinct clause on a SQL statement a couple of days ago. Not the most amazing find but its small discovery got me thinking about something I do while testing. I think about the SQL.
Sometimes I directly test the SQL in an application. Sometimes I ask for the SQL to review. And sometimes I try to envision the SQL being generated in the application as I’m testing.
Historically (until a couple of months ago), I would have said thinking about the SQL was intuition. SQL intuition. But spending time with Mike Kelly and James Bach has me rethinking my use of the word intuition.
Is it really intuition? I thought more about this and remembered that I’d been trained years ago, actually taught to ask directly for the SQL statements to review. And when I wasn’t able to get the SQL, I was also taught to think about the SQL being generated and to think about what might go wrong in SQL statements I couldn’t directly review. And in the case of one application I’d tested – I had an option to turn SQL tracing on to view the SQL being generated. (There was a key code sequence buried in the application and the SQL statements were written off to a separate log file.) I was taught to think about the SQL. And I’ve experienced bugs in poorly formed SQL so experience has reinforced the lesson. It isn’t intuition. It’s training coupled with experience that has evolved to a built-in behavior to the extent that it has become instinctual.
So what’s my point? I think I have a few and hopefully one or more of these points helps.
If you’re new to testing, learn SQL. Start with the concepts and work up to being able to write well-formed SQL on your own. Here’s a website that’s good, free, and accessible (no annoying account setup required).
If you have SQL skills but for some reason you’re not in the practice of thinking about the SQL as you test an application – suppose you only think about SQL when you’re directly testing a SQL statement. I suggest looking closely at your application for areas where SQL is being used versus where code is being used. Ask a developer. Ask a DBA. Both might be willing to point out functionality that relies on SQL. You can ask to see the SQL statements. As you review the statements, you’re practical SQL knowledge may increase. As you find bugs, the learning will be reinforced. For me, anywhere I’ve found bugs is reinforced learning because I want to find bugs again.
And a lesson for me personally, I think this helped my own understanding for getting behind the word intuition. If I want to explain why and how I’m a skilled tester than being able to articulate what I do and how I do it is important. I can see that now. And if I want to teach other people about software testing (which I do) then I have to be more exact about what to learn and when to apply that knowledge.