Run a SQL Trace To Look Behind The Curtain
5 comments Posted by Eric Jacobson at Tuesday, July 26, 2011When we find a bug with repro steps we typically leave the deep investigation to our Progs and move on to the next test. But sometimes it’s fun to squeeze in a little extra investigation if time permits.
My service calls were not returning the expected results so my Prog showed me a cool little trick; how to capture the SQL being passed into my DB for specific service calls. This technique is otherwise known as performing a SQL trace. We ran a SQL trace and with a bit of filtering and some timing, we easily captured the SQL statements being triggered via the called service. We extracted the SQL from the trace and used it to perform direct DB calls. Said isolation helped us find the root problem; a bad join.
Ask your Progs or DBAs which tools they use to perform SQL Traces. We used SQL Profiler and SQL Server 2008 R2. Make sure they show you how to filter down the trace (e.g., only show TSQL, to a certain DB, sent from a specific trigger like a user or service) so you don’t have to sift through all the other transactions.
As testers, we typically open screens in our products and focus on the data that is presented to us. Does it meet our expectations? We are sometimes forced to be patient and wait for said data to present itself. Don’t forget to step back and determine what happens if the data doesn’t get a chance to present itself.
Test Steps:
1. Open a screen or window on the UI. This bug is easier to repro in places where lots of data needs to load on the screen or window. Look for asynchronous data loading (e.g., the user is given control after some data presents itself, while the rest of the data is still being fetched)
2. Close the screen or window before the data has finished loading. Be quick. Be creative; if the screen you opened doesn’t close on command, try its parent.
Expected Results: No errors are thrown. The product handles it gracefully by killing the data load process and releasing the memory.
After reading my Testing for Bug Bucks & Breaking The Rules post, In2v asked, “I was wondering if your team went on with that game and how it turned out. Would you update us?”
Sure. The Bug Bucks game/experiment failed miserably. It sounded good on paper but in practice it was too awkward. When testers found bugs, they didn’t have the heart to ask Progs for Bug Bucks. Go figure…
We like to joke about testers and Progs being caught up in some kind of rivalry. But when we’re actually performing our jobs on serious work, we want each other to succeed. Both tester and Prog had an understanding that nobody was at fault; they were both doing their jobs. When I asked TesterA why he didn’t take any Bug Bucks from ProgA, I was told ProgA would have been in Bug Buck debt (because of all the bugs) but it didn’t seem fair because many of the bugs were team oversights.
We could have adjusted the rules but I could see it was too awkward. And just before management was getting ready to order some Bug Buck goods for purchase, I suggested we pull the plug.
So now I have a stack of worthless Bug Bucks on my desk, and a recurring hope to come up with a more fun way to perform our jobs. I’m open to suggestions…
From this post forward, I will attempt to use the term “Prog” to refer to programmers.
I read a lot of Michael Bolton and I agree, testers are developers too. So are the BAs. Testers, Programmers, and BAs all work together to develop the product. We all work on a software development team.
Before I understood the above, I used the word “Dev” as short hand for “developer” (meaning programmer). Now everybody on my development team says “Dev” (to reference programmers). It has been a struggle to change my team culture to get everyone to call them “programmers”. I’m completely failing and almost ready to switch back to “Dev”, myself. I don’t much like the word, “programmer”…too many syllables and letters.
Thus, I give it one last attempt. “Prog” is perfect! Please help me popularize this term. It’s clearly short for “programmer”, easy to spell, and fun to say. It also reminds me of “frog”, which is fitting because some progs are like frogs. They sit all day waiting for us to give them bugs.