[Xapian-discuss] Fwd: Clearing Database For Tests

David P. Novakovic davidnovakovic at gmail.com
Mon Nov 2 23:46:24 GMT 2009


I forgot to cc the mailing list...

---------- Forwarded message ----------
From: David P. Novakovic <davidnovakovic at gmail.com>
Date: Tue, Nov 3, 2009 at 9:45 AM
Subject: Re: [Xapian-discuss] Clearing Database For Tests
To: Ryan Bates <ryan at railscasts.com>


i know this doesn't answer your question, but it is definitely worth
mentioning:

I've found that I actually don't need that many tests for interface code to
xapian.  Once you have tests that prove your base wrapper functions work as
expected wouldn't you just want to test your code not xapian?

Use mocks and dep injection to avoid actually touching the xapian code...
I've forgotten the technical term for it, but you want to avoid testing code
that is outside of the scope of what you are trying to test.


On Tue, Nov 3, 2009 at 9:36 AM, Ryan Bates <ryan at railscasts.com> wrote:

> I am using Xapian through the Ruby bindings and am wondering the best
> way to use it in a unit test suite where we must start with an empty
> database every time (so records generated in one test don't interfere
> with another). I am currently deleting the database directory and
> regenerating it every time, but I find this to be very slow (nearly
> half a second). This results in even a small number of tests taking a
> long time to run.
>
> Is there some fast way to clear an existing database of all content
> (terms, values, spellings, etc.)? If not, what is the best practice
> for resetting a database for each test?
>
> Regards,
>
> Ryan
>
> _______________________________________________
> Xapian-discuss mailing list
> Xapian-discuss at lists.xapian.org
> http://lists.xapian.org/mailman/listinfo/xapian-discuss
>


More information about the Xapian-discuss mailing list