[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

memcache wrapper testing

David Weldon

7/16/2007 11:19:00 PM

I have a wrapper class for memcache-client (adds a little extra
functionality for something specific I need). Does anyone have any good
ideas for how to do unit testing on it?

The issue I have is that the memcache will become full of data from each
functional test I run. It would be nice to have a "clean slate" each
time I run. To me, the obvious thing would be to start and stop a
memcached server for each of my tests, but that seems like a major pain.
Is there something I'm missing like a clear_memcache function or
something?

Thanks!

--
Posted via http://www.ruby-....

2 Answers

Chris Wanstrath

7/17/2007 3:25:00 AM

0

On 7/16/07, David Weldon <dweldon@gmail.com> wrote:

> I have a wrapper class for memcache-client (adds a little extra
> functionality for something specific I need). Does anyone have any good
> ideas for how to do unit testing on it?

Use mocks. Check the cache_fu tests, which run against mocks and a
real memcached server.

http://require.errtheblog.com/plugins/browse...

--
Chris Wanstrath
http://e... // http://errt...

Eric Hodel

7/17/2007 8:17:00 AM

0

On Jul 16, 2007, at 16:18, David Weldon wrote:

> I have a wrapper class for memcache-client (adds a little extra
> functionality for something specific I need). Does anyone have any
> good
> ideas for how to do unit testing on it?
>
> The issue I have is that the memcache will become full of data from
> each
> functional test I run. It would be nice to have a "clean slate" each
> time I run. To me, the obvious thing would be to start and stop a
> memcached server for each of my tests, but that seems like a major
> pain.
> Is there something I'm missing like a clear_memcache function or
> something?

Look at how the memcache-client tests are written. They never touch
a server.

--
Poor workers blame their tools. Good workers build better tools. The
best workers get their tools to do the work for them. -- Syndicate Wars