anttest

package
v0.0.0-...-bba8168 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 24, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package anttest implements scraper test helpers.

Usage:

func TestScraper(t *testing.T) {
  var assert = require.New(t)
  var page = anttest.Fetch(t, "https://github.com")
  var scraper = &MyScraper{}

  scraper.Scrape(ctx, page)

  assert.Equal("GitHub", scraper.Title)
}

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BenchmarkQueue

func BenchmarkQueue(b *testing.B, new func(testing.TB) ant.Queue)

BenchmarkQueue benchmarks a queue implementation.

func Fetch

func Fetch(t testing.TB, url string) *ant.Page

Fetch fetches a page by its URL.

If the page cannot be fetched successfully the method calls `t.Fatalf` with the error.

func TestQueue

func TestQueue(t *testing.T, new func(testing.TB) ant.Queue)

TestQueue tests a Queue implementation.

`new(t)` must return a new empty queue ready for use.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL