db

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2021 License: MIT Imports: 15 Imported by: 0

README

godog-db

Build Status Go Report Card Go Reference GitHub

godog-db defines a godog feature context which adds steps to setup and verify database contents during tests.

Installation

go get -u github.com/martinohmann/godog-db

Usage

Check feature_context_test.go and the features/ for usage examples.

License

The source code of godog-db is released under the MIT License. See the bundled LICENSE file for details.

Documentation

Overview

Package db defines a godog feature context which adds steps to setup and verify database contents during tests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBInitializeFn

type DBInitializeFn func(*sql.DB)

type FeatureContext

type FeatureContext struct {
	// contains filtered or unexported fields
}

FeatureContext adds steps to setup and verify database contents during godog tests.

func NewFeatureContext

func NewFeatureContext(driver, dsn string, initDB DBInitializeFn) *FeatureContext

NewFeatureContext create a new feature context. It expects the db driver name, a connection DSN and an init functions which receives an instance of *sql.DB. The init function is called before every scenario and can be used to pass the db handle to the tested application or run setup like database migrations.

func (*FeatureContext) Register

func (c *FeatureContext) Register(ctx *godog.ScenarioContext)

Register registers the feature context to the godog suite.

func (*FeatureContext) WithoutTxDB

func (c *FeatureContext) WithoutTxDB()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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