test

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2017 License: GPL-3.0 Imports: 7 Imported by: 21

Documentation

Index

Constants

View Source
const (
	MinSUT = "Oldest Version"
	MaxSUT = "Current Version"
)

Variables

View Source
var ExampleSteps = []([]Step){{
	Step{"Open the application", NotAssessed,
		"The application should display the start screen", "", 1},
	Step{"Click on login", NotAssessed,
		"The application should display the login modal", "", 2},
	Step{"Enter user name and password", NotAssessed,
		"The user can see that he entered symbols into input fields", "", 3},
}, {
	Step{"The user uses the application", NotAssessed,
		"The application appropriately responses to the user input", "", 1},
}}

ExampleSteps is slice of exemplary Step-slices for use in tests and initialization

Functions

func CalculateDuration

func CalculateDuration(cases []Case) (int, int)

CalculateDuration calculates the durationHours and durationMin for testsequences

func CalculateSUTVersion

func CalculateSUTVersion(cases []Case, upperBound, lowerBound, sutType string) (string, error)

CalculateSUTVersion calculates the SUTVersionFrom or the SUTVersionTo depending on the given sutType parameter

Types

type Case

type Case struct {
	ID               string
	Name             string
	Labels           []string
	TestCaseVersions []CaseVersion
	CreationDate     time.Time
}

The Case struct contains the information needed for describing a test case

func NewTestCase

func NewTestCase(name, description, preconditions, sutVerFrom, sutVerTo string, dur time.Duration) Case

NewTestCase creates a new test case with the given information

func (Case) ItemID

func (tc Case) ItemID() string

ItemID returns a test cases id

func (Case) ItemName

func (tc Case) ItemName() string

ItemName returns a test cases name

type CaseExecutionRecord

type CaseExecutionRecord struct {
	ID                int
	TestCaseID        string
	TestCaseVersionNr int
	ProjectID         string

	SUTVersion    string
	Environment   string
	ExecutionDate time.Time

	StepRecords     []StepExecutionRecord
	Result          Result
	Comment         string
	OtherNeededTime time.Duration
}

CaseExecutionRecord contains all information relating to an execution of a test case

func NewCaseExecutionRecord

func NewCaseExecutionRecord(TestCase Case, TestCaseVersionNr int, projectID string, SUTVersion string,
	Environment string) CaseExecutionRecord

NewCaseExecutionRecord creates a new execution record of a test case execution with the given information

func (CaseExecutionRecord) DeepCopy

DeepCopy returns a copy, that is completely independent of its original.

func (CaseExecutionRecord) Equals

func (rec CaseExecutionRecord) Equals(in interface{}) bool

Equals compares two CaseExecutionRecords and returns true, if these two are equal. If in is nil, Equals will return false.

func (*CaseExecutionRecord) Finish

func (rec *CaseExecutionRecord) Finish(result Result, comment string, neededTime time.Duration)

Finish will finish the Record and saves over all Data.

func (*CaseExecutionRecord) GetNeededTime

func (rec *CaseExecutionRecord) GetNeededTime() time.Duration

GetNeededTime returns the summed up time, needed for this execution so far.

func (*CaseExecutionRecord) IsFinished

func (rec *CaseExecutionRecord) IsFinished() bool

IsFinished checks, if the TestCase was executed till end or was interrupted and isn't completed yet.

func (*CaseExecutionRecord) SaveStep

func (rec *CaseExecutionRecord) SaveStep(stepNr int, observedBehavior string, result Result, comment string,
	neededTime time.Duration)

SaveStep will be called, if the user executed one test step. The results of the execution will be saved to the record. stepNr starts with step 1

type CaseExecutionRecordID

type CaseExecutionRecordID struct {
	ID         int
	TestCaseID string
	ProjectID  string
}

CaseExecutionRecordID embraces all values needed to identify a case record

type CaseVersion

type CaseVersion struct {
	VersionNr      int
	Message        string
	IsMinor        bool
	Description    string
	Preconditions  string
	SUTVersionFrom string
	SUTVersionTo   string
	DurationHours  int
	DurationMin    int
	Steps          []Step
	CreationDate   time.Time
}

CaseVersion contains the information needed for describing a version of a test case

func NewTestCaseVersion

func NewTestCaseVersion(version int, isMinor bool, message, description, preconditions, sutVerFrom, sutVerTo string,
	dur time.Duration) CaseVersion

NewTestCaseVersion creates a new version for a test case Returns the created test case version

type Result

type Result int

Result is the type to describe the actual outcome of a test step execution

const (
	NotAssessed Result = iota
	Pass
	PassWithComment
	Fail
)

Pass, PassWithComment, Fail and NotAssessed are possible values of the type Result

func (Result) Integer

func (r Result) Integer() int

func (Result) String

func (r Result) String() string

type Sequence

type Sequence struct {
	ID               string
	Name             string
	Labels           []string
	CreationDate     time.Time
	SequenceVersions []SequenceVersion
}

The Sequence struct contains information for describing a test sequence

func NewTestSequence

func NewTestSequence(name, description, preconditions string, cases []Case) (Sequence, error)

NewTestSequence creates a new test sequence with the given information

func (Sequence) ItemID

func (ts Sequence) ItemID() string

ItemID returns a test sequences id

func (Sequence) ItemName

func (ts Sequence) ItemName() string

ItemName returns a test sequences name

type SequenceExecutionRecord

type SequenceExecutionRecord struct {
	ID                    int
	TestSequenceID        string
	TestSequenceVersionNr int
	ProjectID             string
	SUTVersion            string
	Environment           string
	CaseExecutionRecords  []CaseExecutionRecordID
}

SequenceExecutionRecord contains all information relating to an execution of a test sequence itself. Data referring to the single test cases are saved in the corresponding CaseExecutionRecord

func NewSequenceExecutionRecord

func NewSequenceExecutionRecord(testSequence Sequence, testSequenceVersionNr int,
	projectID string, sutVersion string, environment string) SequenceExecutionRecord

NewSequenceExecutionRecord creates a new execution record of a test sequence execution with the given information

func (*SequenceExecutionRecord) AddCaseExecutionRecord

func (s *SequenceExecutionRecord) AddCaseExecutionRecord(id int, testCaseID string, projectID string)

AddCaseExecutionRecord adds an case record to the sequence record

func (SequenceExecutionRecord) Equals

func (s SequenceExecutionRecord) Equals(in interface{}) bool

Equals compares two SequenceExecutionRecord and returns true, if these two are equal. The contained CaseExecutionRecords will be compared too. If in is nil, Equals will return false.

type SequenceInfo

type SequenceInfo struct {
	SUTVersionFrom string
	SUTVersionTo   string
	DurationHours  int
	DurationMin    int
}

SequenceInfo contains meta information for a SequenceVersion

type SequenceVersion

type SequenceVersion struct {
	VersionNr     int
	Message       string
	IsMinor       bool
	Description   string
	Preconditions string
	CreationDate  time.Time
	Cases         []Case
	SequenceInfos SequenceInfo
}

SequenceVersion contains information for describing a version of a test sequence

func NewTestSequenceVersion

func NewTestSequenceVersion(version int, isMinor bool, message, description string, preconditions string,
	cases []Case) (SequenceVersion, error)

NewTestSequenceVersion creates a new version for a test case Returns the test case the version belongs to

func (SequenceVersion) CountIncludedSteps

func (tsv SequenceVersion) CountIncludedSteps() int

CountIncludedSteps returns the total number of steps summed over all included cases

func (SequenceVersion) CountIncludedStepsUpTo

func (tsv SequenceVersion) CountIncludedStepsUpTo(maxCaseNr int) int

CountIncludedStepsUpTo returns the total number of steps summed over all included cases up to maxCaseNr the numeration starts with 0 and maxCaseNr itself will be included

func (SequenceVersion) ItemEstimatedDuration

func (tsv SequenceVersion) ItemEstimatedDuration() (minutes int, hours int)

ItemEstimatedDuration returns the estimated Duration for the sequence

type Step

type Step struct {
	Action         string
	ActualResult   Result
	ExpectedResult string
	Assessment     string
	ID             int
}

The Step struct contains information for describing a single step of a test case

func NewTestStep

func NewTestStep(action, expect string) Step

NewTestStep creates a new Step with action and expected result from parameters

type StepExecutionRecord

type StepExecutionRecord struct {
	NeededTime       time.Duration
	ObservedBehavior string
	Result           Result
	Comment          string
	Visited          bool
}

StepExecutionRecord contains all information relating to an execution of a test step

func (StepExecutionRecord) DeepCopy

DeepCopy returns a copy, that is completely independent of its original, but equal.

Jump to

Keyboard shortcuts

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