ddt

package
v0.0.0-...-8e9073d Latest Latest
Warning

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

Go to latest
Published: May 13, 2019 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SuiteBuilder

type SuiteBuilder struct {
	Name string
	// contains filtered or unexported fields
}

SuiteBuilder - Test suite main class.

func NewSuiteBuilder

func NewSuiteBuilder(inputFile string) *SuiteBuilder

NewSuiteBuilder - Creates a new SuiteBuilder setting up input data file.

func (*SuiteBuilder) Build

func (suite *SuiteBuilder) Build() (map[string][]TestCase, error)

Build - Takes the current state of the suite builder and creates the test cases ready to be executed. Steps to follow (each one will return the proper error if present): - Verify input file. - Replace parameters with text/template. - Read CSV rows and transform them from []string to []interface{}. - Skip first row if headers are present. - Group the final row properly. - Return the TestCase groups. ---

func (*SuiteBuilder) GlobalName

func (suite *SuiteBuilder) GlobalName(name string) *SuiteBuilder

GlobalName - Sets up the suite name.

func (*SuiteBuilder) GroupBy

func (suite *SuiteBuilder) GroupBy(column int) *SuiteBuilder

GroupBy - Sets up the column by which test cases should be grouped. If column value is invalid it will be ignored.

func (*SuiteBuilder) Headers

func (suite *SuiteBuilder) Headers(haveHeaders bool) *SuiteBuilder

Headers - Sets up whether or not the input file have headers. False by default.

func (*SuiteBuilder) RowTransformer

func (suite *SuiteBuilder) RowTransformer(transformer func(row []string) []interface{}) *SuiteBuilder

RowTransformer - Sets up a custom way to transform input values.

func (*SuiteBuilder) TestExecutor

func (suite *SuiteBuilder) TestExecutor(executor TestExecutor) *SuiteBuilder

TestExecutor - Sets up the way in which data will be validated.

func (*SuiteBuilder) Variables

func (suite *SuiteBuilder) Variables(vars map[string]interface{}) *SuiteBuilder

Variables - Sets up a map with the input variables values.

type TestCase

type TestCase struct {
	Group string
	// contains filtered or unexported fields
}

TestCase - Abstraction for the individual test case execution.

func (*TestCase) Run

func (testCase *TestCase) Run() bool

Run - Execute the test case itself.

type TestExecutor

type TestExecutor func(data []interface{}) bool

TestExecutor - Signature of the test executor function.

Jump to

Keyboard shortcuts

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