Welcome to GotSpeech.NET Sign in | Join | Help

Unit Testing Speech Applications Using LogPlayer.exe

Chris Jansen already beat me to a great post about using LogPlayer.exe to replay sessions of TASIM.  I wanted to talk more about how you could use it to unit test your application.

 

Here is the MSDN documentation on LogPlayer.exe

 

Unit testing of speech applications is typically a very tedious process and not easily automated.  You can create another application that would call your application to be tested and verify the call flow but this is no easy task and is a lot of work.  You can manually call your application each time your make a change but this gets really old and boring.

 

Well because I am a lazy developer I wanted to automate my unit testing.

 

I stumbled upon a neat utility called LogPlayer.exe that might be able to solve the problem of unit testing speech applications.

 

First you have to turn on logging in the Speech Debugging Console (see MSDN article to turn on logging: step three under: To configure Speech Debugging Console options).

 

Now, everytime you use the Telephony Application Simulator (TASIM) it will log an xml file that details all the events of the calls that you make.  You can then use those .xml files using the LogPlayer.exe utility to replay the calls.  This is great for unit testing because if you are disciplined enough to create an xml for everything that you want to test you can then automate your testing process.  Everytime, I added a new functionality I would run TASIM and produce a new xml file and add it to my unit tests.

 

LogPlayer then gives you the ability to replay multiple .xml files.  You can just pass in the .xml replay batchfile name:

 

LogPlayer.exe ReplayBatchFile.xml

 

Where ReplayBatchFile.xml looks like this:

 

<BatchReplay>

<ResultsFilePath>BatchResults.xml</ResultsFilePath>

<Replay Mode="Strict" ShowWarnings="true" RecordLogFile="false">

<LogFilePath>UnitTestIntroMsg.xml</LogFilePath>

</Replay>

<Replay Mode="Strict" ShowWarnings="true" RecordLogFile="false">

<LogFilePath>UnitTestCallFlow.xml</LogFilePath>

</Replay>

</BatchReplay>

 

And where UnitTestIntro.Msg.xml and UnitTestCallFlow.xml are xml files that were created when I tested the application using TASIM.

 

Then when I run Logplayer.exe ReplayBatchFile.xml it will automatically test my application and place the results in: BatchResults.xml.  You can then view this xml file for any errors that might have been introduced into your application.  LogPlayer will just show you the differences between what it expects in the xml files and what it is seeing now.

 

This is great for unit testing because you can make a small change to your application and not really be sure what the consequences are.  Now you can make a small change run it through the LogPlayer suite of unit tests and view the results to see if the application was affected.

 

Also, as Chris mentioned in his post you can look through these xml files that are generated by TASIM and edit them.  I can see editing the URL of the application to point to at a QA server or something like that.

 

Now, true Test Driven Development would write the test first, have it fail, then write the code and make it pass and then refactor.  So, we are doing things a little different but we are still building a suite of speech unit tests that will be very handy down the road when we are making changes and we want to know the affects.

 

Technorati Tags:

Published Friday, July 28, 2006 12:39 PM by brandontyler
Filed under: ,

Comments

# re: Unit Testing Speech Applications Using LogPlayer.exe

Don't say you are lazy. It could give people the wrong idea.

Say that you strive for utmost efficiency and maximization of developer (i.e. your) time while minimizing developer activity.

Great post.
Friday, July 28, 2006 12:08 PM by marshallharrison

# re: Unit Testing Speech Applications Using LogPlayer.exe

Minimizing developer activitiy!  That is the key statement.
Friday, July 28, 2006 1:45 PM by brandontyler

# GotSpeech.Net Podcast Show #5 Pizza Tutorial: Creating the Dialogue Framework

The show: Hosts ( brandontyler and csharprox ) News Launch Event of Vista showing off Unified Communications

Wednesday, February 28, 2007 11:25 AM by Speech Served Here
Anonymous comments are disabled