[Haskell-beginners] using quickcheck for blackbox testing for 3rd party apps.

Srikanth K k.srikanth.opensource at gmail.com
Mon Oct 12 02:21:49 EDT 2009

Hi All,
   I am exploring use of quickCheck to define the test-specification for a
3rd party component.
   The component is basically an Command/Response type of application.

   Hence to validate it, I thought that the best way might be to take the
following approach(based on the quickCheckM paper)

a. describe the component in a purely functional way.  The functions would
take the "AppState", "Command" as parameters and would return a Response.
Let me call this the "Abstract Application"
    The signature for this would therefore be of the form
     abstract_App :: AppState -> Command -> Response

b. define an agent (Let me call it as Real_App) that  that would
    (i) take a initial State,  "Command" and send it to the "Application
Under test" using some IPC mechanisms(probably socket or FIFO files)
    (ii) parse the received response and send it back as "Response".  As a
result the the API for the agent would be of the form
   real_APP :: AppState -> Command -> IO Response

c. write a quick-check specification that would send a bunch of commands to
the "Abstract Application" and check for equivalence with the value returned
by the "real_App"

However, being a newbie, I am not able to understand how I can extract the
"Response" part from the IO Response.

I want something as follows
prop_App state_x command_y = (abstract_App state_x command_y ) == (real_App
state_x command_y)

The issue here is that since the reall_App would return a "IO Response" and
not "Response" I cannot really compare the abstract_App with the real_App.

Any thought on how I can extract the value from the "IO Response" so that I
can compare the the two implementations for equvivalence.

FYI, I have gone through the various quickcheck related docs like

- Srikanth
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20091012/ac4cdfde/attachment.html

More information about the Beginners mailing list