Session-based Test Management using Evernote

(This is a post from my previous testing blog that had a short run. It was published on Aug 21, 2013 originally, but I wanted to highlight some of my original blog content as a possible contrast even to some of my current thinking)

I find using Session-based Test Management (SBTM) principles to help focus my testing work to be helpful. It is a helpful way to organize my testing activities and produce a testing artifact that can explain how and what I was testing. I don’t do context-driven testing or exploratory testing particularly well I believe, but it is a skill I am working on developing. As with anything, to really improve at something, we need to do it thoughtfully and reflectively, and I find that SBTM helps me to do that. I have always found creating and storing the session sheets to be a management chore and something that got in the way of my eagerness to embrace this as a method for organizing my testing activities. I have tried several different tools, most of them found from Paul Carvalho’s excellent page about Lessons Learned in Session-based Test Management, and mostly used the original tool developed by James and Jon Bach. In the back of my mind, however, has always been this lingering idea that implementing the session sheets in Evernote made a lot of sense. One of the limitations in Evernote for doing this (and other cool things) has always been the way it handles (or really does not handle) templates (i.e. notes with consistent data needed in new notes).

Recently, I decided to get serious about solving the problem of templating in Evernote, in hope that it would reduce some of the management overhead of duplicating session sheets, remembering the date formatting on the note filename, what notebook to store it in so it could be separated by project, and other default values that need to be included in the text of the session document. My work in this case was aided greatly by Thought Asylum‘s posts about templating in Evernote. I found the following posts to be invaluable in setting up a template system in Evernote that worked for me:

http://www.thoughtasylum.com/blog/2010/3/14/an-improved-template-system-for-evernote.html

http://www.thoughtasylum.com/blog/2011/5/7/evernote-note-templates-show-me-the-new-note.html

http://www.thoughtasylum.com/blog/2010/3/15/creating-a-daily-journal-in-evernote.html

http://dev.evernote.com/doc/articles/enscript.php

http://dev.evernote.com/doc/articles/search_grammar.php

http://blog.lobrecht.com/rick/2010/10/06/evernote-templates/

I found the first three to be very helpful in getting my batch script setup. While the daily journal post might appear a little out of place, it shows how to dynamically create a template file that can be imported into Evernote. This is helpful for inserting a custom title (one that has the date in it for example), as well as date/time specific parts of the SBTM session sheet. The other evernote articles just helped me work through some batch scripting (Enscript is the command line interface into Evernote on Windows at least), as well as some of the querying needed to trigger a search in Evernote once the import is completed so that the newly created note from the template is selected and shows up in the Evernote application without requiring the user to go find it and select it. The PS menu third party add-on mentioned is also helpful for exposing those batch scripts in the system tray in a quick and easy way to access them.

Here is the batch script that I ended up with for a session sheet template. I have added some comments to the script in bold to try and explain what each section is doing. Once the script below is saved as a batch file, it can just be clicked on and ran and functions properly (provided you have update the sections that set the location for where some files are or where they will be created). You can follow the steps at one of the Thought Asylum blog posts for getting up and running with PS Menu. The end result of all of this is that it has facilitated creating session sheets at the click of a button, which has significant reduced some of the overhead for recording my testing activities in an organized way. While I have plenty of room for improvement (identifying someone to “debrief” with, improving my identification of appropriate charters, notetaking), I’m able to embed relevant files in the session sheet as needed. The next big (and I mean BIG) project would be to look at what is required to parse the session sheets inside of of a particular notebook to generate some of the TBS metrics that can help me to evaluate what I am spending my time on. The nice thing about keeping the session sheets in Evernote is that I get great support for search and sharing of notebooks if I can ever expand the SBTM practices to other testers in my group.

Batch Script

:CONFIGURE

REM Calls the GET_TIMESTAMP function at the bottom of the script, which generates some variables needed as the script progresses, when the function is finished it returns to the line below the function call
call :GET_TIMESTAMP
set QueryString=created:%TimeStamp%

REM Sets the location of different tools (like ENScript.exe) and my evernote database, as well as the location of text files that contain some elements of the evernote template (which is an xml based document that Evernote uses to store its notes in)
set ENscriptLocation="C:Program Files (x86)EvernoteEvernoteENScript.exe"
set "C:UsershintbwAppDataLocalEvernoteEvernoteDatabaseshintbw.exb"
set FilePart1="D:Skydrive - BrettSkyDriveDocumentsEvernote Templatessession-template-part-1.txt"
set FilePart2="D:Skydrive - BrettSkyDriveDocumentsEvernote Templatessession-template-part-2.txt"
set FilePart3="D:Skydrive - BrettSkyDriveDocumentsEvernote Templatessession-template-part-3.txt"

REM Sets the location for the temporary .enex file that is created for import into Evernote
set WorkingFile="D:Skydrive - BrettSkyDriveDocumentsEvernote Templatestemplate1.enex"

REM Sets the default notebook to import the template into, some alternatives to the script can include passing in a parameter when the batch script is called that would override this variable
set DefaultNotebook="Sessions-ProjectName"
:Build

REM Build the template file by inserting each part of the XML document. Note the two echo statements which are inserting the custom date data that I needed in different sections of my session sheet
type %FilePart1% > %WorkingFile%
echo %NoteTitle% >> %WorkingFile%
type %FilePart2% >> %WorkingFile%
echo %StartTime% >> %WorkingFile%
type %FilePart3% >> %WorkingFile%

REM Sets the query string that will be used to cause Evernote to display the note after it is created from the template
set QueryString=notebook:%DefaultNotebook% %QueryString%

REM This imports a new note based on the template file created and places it in the default notebook that was specified
%ENscriptLocation% importNotes /s %WorkingFile% /n %DefaultNotebook% /d %EvernoteDatabaseLocation%

REM This command causes the Evernote application to show any notes created after this batch script is run, which generally will be just the note that you created above
%ENscriptLocation% showNotes /q "%QueryString%" /d %EvernoteDatabaseLocation%

REM This section deletes any of the variables that were set, including, most importantly, the temporary working file that had been created on the file system
:Tidy_UP
del %WorkingFile%
set ENscriptLocation=
set EvernoteDatabaseLocation=
set JournalNotebook=
set FilePart1=
set FilePart2=
set FilePart3=
set WorkingFile=
goto :EOF

REM This section sets time and date values I need to build titles and add date related information in my template
:GET_TIMESTAMP
for /f "tokens=1,2,3 delims=:" %%a in ("%time%") do ^
set hour=%%a& ^
set minute=%%b& ^
set second=%%c

for /f "tokens=1,2 delims=." %%a in ("%second%") do ^
set second=%%a& ^
set remainder=%%b

REM This section may not be needed for some locales, but it eliminates the weekday information on the front of the date information that was messing up the query to show the note in Evernote after importing the template
for /f "tokens=1,2 delims= " %%a in ("%date%") do ^
set weekday=%%a& ^
set usabledate=%%b for /f "tokens=1,2,3 delims=/" %%a in ("%usabledate%") do ^
set day=%%b& ^
set month=%%a& ^

set year=%%c

set NoteTitle="<title>et-bwh-%year%%month%%day%-</title>":
set TimeStamp=%year%%Month%%day%T%hour%%minute%%second%
set StartTime=%month%/%day%/%year% %hour%:%minute%
goto :EOF