Skip to content

New feature: autointegration tests #76

@ryonlife

Description

@ryonlife

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions