Documentation
¶
Index ¶
Constants ¶
View Source
const ( EnvVarNameBase_NetProtocol = "PROTO" // E.g. "tcp". EnvVarNameBase_Driver = "DRIVER" // E.g. "mysql". EnvVarNameBase_Host = "HOST" // E.g. "localhost". EnvVarNameBase_Port = "PORT" // E.g. "3306". EnvVarNameBase_Database = "DB" EnvVarNameBase_User = "USER" EnvVarNameBase_Password = "PWD" )
View Source
const ( ErrTestedFunctionsAreNotSet = "tested functions are not set" ErrUnknownSqlDriver = "unknown SQL driver: %v" ErrConnectionIsNull = "connection is null" )
View Source
const ( DriverMySQL = "mysql" DriverPostgreSQL = "postgres" )
List of supported SQL drivers.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IntroFunction ¶
type OutroFunction ¶
type TestDbParameters ¶
type TestDbParameters struct { NetworkProtocol string // E.g. "tcp". Driver string // E.g. "mysql". Host string // E.g. "localhost". Port string // E.g. "3306". DB string User string Pwd string }
TestDbParameters are parameters of a test database.
func NewTestDbParameters ¶
func NewTestDbParameters(envVarNamePrefix string) (p *TestDbParameters, err error)
type TestSuite ¶
type TestSuite struct {
// contains filtered or unexported fields
}
TestSuite is a suite of several tests. To run the tests create a test suite and use the 'Run' method.
Test suite automatically connects to and disconnects from the test database, runs an "intro" function, then runs all the tests (tested functions), and then runs the "outro" function. Intro-function is used to prepare tested database objects, e.g. to create tables and data. Outro-function is used to clean up the mess in the database after the tests, e.g. to delete data and tables.
func NewTestSuite ¶
func NewTestSuite( t *testing.T, envVarNamePrefix string, intro []IntroFunction, testedFunctions []*TestedFunction, outro []OutroFunction, ) (ts *TestSuite, err error)
type TestedFunction ¶
Click to show internal directories.
Click to hide internal directories.