-
Notifications
You must be signed in to change notification settings - Fork 13
Description
It's difficult to test scrapy spiders. I love this autounit framework and was inspired to copy some of the patterns to do something similar for auto integration tests. When a spider is run with AUTOUNIT_ENABLED, I wrote a pipeline that generates i.) fixture files from the live spider run and ii.) a test_name_of_spider.py file. The test is a single function that creates a CrawlerProcess, which performs a live crawl, and compares the results to the fixtures by attaching to an item_scraped signal. It's nice to use autounit during the development workflow and auto integration before a deploy.
Here's a gist to give the idea:
https://gist.github.com/ryonlife/e9131d8ac2c9ce1d089a98eb346905e7
Curious if there's interest to integrate into autounit or perhaps as a standalone library.