Spider Contracts

260 views
Skip to first unread message

Pablo Hoffman

unread,
Jun 10, 2010, 9:44:14 AM6/10/10
to Scrapy Users
Hi all,

We're working on a new Scrapy feature to make it easier to test your spiders.
It's called "Spider Contracts" and here's the SEP:
http://dev.scrapy.org/wiki/SEP-017

We'd love to hear your feedback.

Pablo.

Ping Yin

unread,
Jun 10, 2010, 10:37:15 AM6/10/10
to scrapy...@googlegroups.com
On Thu, Jun 10, 2010 at 9:44 PM, Pablo Hoffman <pabloh...@gmail.com> wrote:
>
> We're working on a new Scrapy feature to make it easier to test your spiders.
> It's called "Spider Contracts" and here's the SEP:
> http://dev.scrapy.org/wiki/SEP-017
>

Wow, great feature, thanks! However, i expect more tags such as

@expected name foo
@expected email f...@example.com

Not familiar with the contract syntax, i hope my meaning is clear.

Pablo Hoffman

unread,
Jun 11, 2010, 10:52:39 AM6/11/10
to scrapy...@googlegroups.com
On Thu, Jun 10, 2010 at 10:37:15PM +0800, Ping Yin wrote:
> On Thu, Jun 10, 2010 at 9:44 PM, Pablo Hoffman <pabloh...@gmail.com> wrote:
> >
> > We're working on a new Scrapy feature to make it easier to test your spiders.
> > It's called "Spider Contracts" and here's the SEP:
> > http://dev.scrapy.org/wiki/SEP-017
> >
>
> Wow, great feature, thanks!

You're welcome, thanks for the feedback :)

> However, i expect more tags such as
>
> @expected name foo
> @expected email f...@example.com
>
> Not familiar with the contract syntax, i hope my meaning is clear.

It's clear, and it can be done, but I think checking for the exact value of
scraped fields may be harder to maintain, since you'll have to update those
values every time you update the sample url (for example, when a product goes
unavailable and the page returns 404). So I think checking for scraped fields
present is more reliable and easier to maintain, but it can be done
nevertheless.

Pablo.

Ping Yin

unread,
Jun 11, 2010, 11:16:32 AM6/11/10
to scrapy...@googlegroups.com

Exact value is just an example. The regex match may be more flexible.
Just checking whether the field exists is not enough for me. The field
may exist, however, the value extracted may be wrong.

S A C H I N

unread,
Apr 12, 2017, 7:49:12 AM4/12/17
to scrapy-users
Hi Pablo,

 I am tasked to research a framework to unit test our scrapy bots and i came across "Contracts".
I however have not found any good documentation on the same. Can you please point me to a good and well elaborated documentation so that i can complete my research.
The one page documentation on official scrapy web is not sufficient for me to take it forward.
TIA
Reply all
Reply to author
Forward
0 new messages