test

package
v2.0.0-rc10+incompatible Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2019 License: GPL-3.0 Imports: 9 Imported by: 21

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ExampleSteps = [][]Step{{
	Step{"Type \"SystemTestPortal\" into the search bar and press enter.",
		"The search results for \"SystemTestPortal\" appear in a list.", 1},
	Step{"Click on the menu-button (The three horizontal lines at the top right corner).",
		"The sidebar opens.", 2},
	Step{"Click on the third theme (the blue-green one).",
		"The user interface design changes." +
			"The URL addresses are displayed beneath the title of the search result. " +
			"The URL font color changes to green. The icons before the URL disappear. " +
			"The font gets bold.", 3},
}, {
	Step{"Type \"SystemTestPortal\" into the search bar and press enter.",
		"\"SystemTestPortal\" is written into the search bar. The search results are listed. " +
			"Under the search bar \"Web\" is selected as search result type.", 1},
	Step{"Click on the search result that leads to systemtestportal.org.",
		"www.systemtestportal.org opens.", 2},
}, {
	Step{"Type \"portal image\" into the search bar and press enter.",
		"A new layout opens with multiple images. " +
			"Under the search bar \"Images\" is selected as search result type.", 1},
	Step{"Under the row to select the search result type there is a second row of filters. " +
		"Click on the last filter which says \"All Colors\" and select \"Black and White\".",
		"Instead of \"All Color\" there stands now \"Black and White\". " +
			"The search results change. All search results are predominantly black and white.", 2},
}, {
	Step{"Type \"test definition\" into the search bar and press enter.",
		"Under the search bar \"Definition\" is selected as search result type. " +
			"On the top is a highlighted area with definitions for \"test\". " +
			"Several search results of websites follow.", 1},
}, {
	Step{"Click on the menu-button (The three horizontal lines at the top right corner).",
		"The sidebar opens.", 1},
	Step{"Select \"other Settings\".",
		"A list of adjustable settings is viewed.", 2},
	Step{"Select \"Español de España\" in the drop down menu on the right of \"Language\".",
		"The site is translated into Spanish (e.g. Settings changes into \"Ajustes\").", 3},
	Step{"Scroll to the end of the settings list and click \"Guardar y salir\".",
		"The site changes back to DuckDuckGo.com. " +
			"The language viewed here is the language you selected in your browser settings.", 4},
}, {
	Step{"Click on the arrow down in the bottom center.",
		"The page scrolls down.", 1},
	Step{"Click on the button \"Add DuckDuckGo to Chrome\".",
		"The notification \"Add DuckDuckGo for Chrome?\" appears.", 2},
	Step{"Click \"Add extension\". ",
		"The notification \"DuckDuckGo for Chrome has been added to Chrome...\" appears. " +
			"In the top right corner the icon of DuckDuckGo is viewed.", 3},
	Step{"Press ALT + G.",
		"In the top right corner a pop up appears with a search bar inside.", 4},
}, {
	Step{"Click on the menu-button (The three horizontal lines at the top right corner).",
		"The sidebar opens.", 1},
	Step{"Select \"other Settings\".",
		"A list of adjustable settings is viewed.", 2},
	Step{"Click \"Appearance\" in the list on the right of the headline \"Settings\". ",
		"A list of other adjustable settings is viewed.", 3},
	Step{"Select \"Largest\" in the drop down menu on the right of \"Font Size\".",
		"The font size increases.", 4},
	Step{"Scroll to the end of the settings list and click \"Save and Exit\".",
		"The site changes back to DuckDuckGo.com.", 5},
}, {
	Step{"Type \"Stuttgart Map\" into the search bar.",
		"The search results are viewed. At the top is a small map showing stuttgart." +
			" A list of websites follows.", 1},
	Step{"Select \"OpenStreetMap\" in the drop down in the bottom right corner of the map.",
		"OpenStreetMap is written next to the small triangle of the drop down menu.", 2},
	Step{"Click on the map.",
		"The map opens in full screen mode.", 3},
	Step{"Click on \"Directions\".",
		"OpenStreetMap opens. The coordinates 48.7761, 9.1775 are entered as the finish of the route.",
		4},
}, {
	Step{"Type \"s\" into the search bar.",
		"No list of auto-suggestions appears under the search bar.", 1},
	Step{"Click on the menu-button (The three horizontal lines at the top right corner).",
		"The sidebar opens.", 2},
	Step{"Select \"other Settings\".",
		"A list of adjustable settings is viewed.", 3},
	Step{"Click the button \"Off\" next to \"Auto-Suggest\".",
		"The color of the button changes. The description of the button changes to \"On\".", 4},
	Step{"Scroll to the end of the settings list and click \"Save and Exit\".",
		"The site changes back to DuckDuckGo.com.", 5},
	Step{"Type \"s\" into the search bar.",
		"A list of auto-suggestions appears under the search bar.", 6},
}, {
	Step{"Type \"Pizza recipes\" into the search bar and press enter.",
		"\"Pizza recipes\" is written into the search bar. The search results are listed. " +
			"Under the search bar \"Recipes\" is selected as search result type.", 1},
}, {
	Step{"Click on the arrow down in the bottom center.",
		"The page scrolls down.", 1},
	Step{"Click on the button \"Add DuckDuckGo to Firefox\".",
		"The notification \"Firefox blocked this website....\" appears.", 2},
	Step{"Click \"Permit\".",
		"The notification \"Add DuckDuckGo Plus? ...\" appears.", 3},
	Step{"Click \"Add\".",
		"The notification \"DuckDuckGo for Chrome has been added to Chrome...\" appears. " +
			"In the top right corner the icon of DuckDuckGo is viewed.", 4},
	Step{"Press ALT + G.",
		"In the top right corner a pop up appears with a search bar inside.", 5},
}, {
	Step{"Click on the arrow down in the bottom center.",
		"The page scrolls down.", 1},
	Step{"Click on the button \"Add DuckDuckGo to Edge\".",
		"The site \"Take Back Your Privacy! ...\" is displayed.", 2},
	Step{"Follow the instructions on this site. Open a new tap and type \"SystemTestPortal\" " +
		"into the search bar.",
		"The search engine you used was DuckDuckGo (i.e the URL in the search bar " +
			"starts with \"https://duckduckgo.com/\").", 3},
}}

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

Functions

func CalculateDuration

func CalculateDuration(cases []Case) duration.Duration

CalculateDuration calculates the durationHours and durationMin for testsequences

func CalculateSUTVariants added in v1.2.0

func CalculateSUTVariants(cases []Case) (map[string]*project.Version, error)

CalculateSUTVariant calculates the applicable sut variants

func ContainsVariant added in v1.2.0

func ContainsVariant(variantList []project.Variant, variant project.Variant) bool

containsVariantchecks if the variantList contains the given variant

func GetProtocolNr added in v1.5.0

func GetProtocolNr(rl ProtocolLister, testVersion id.TestVersionID) (int, error)

getProtocolNr returns a new id, which is unique for the given test version the new, returned id will be blocked and will not be returned again

Types

type Case

type Case struct {
	Id        int64
	CreatedAt time.Time `xorm:"created"`

	// Foreign Key ----------------|
	ProjectID int64

	Name string

	Project          id.ProjectID     `xorm:"-"`
	Labels           []*project.Label `xorm:"-"`
	TestCaseVersions []CaseVersion    `xorm:"-"`
}

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

func NewTestCase

func NewTestCase(name, description string, preconditions []Precondition, versions map[string]*project.Version,
	dur duration.Duration, project id.ProjectID) Case

NewTestCase creates a new test case with the given information

func (Case) ID

func (tc Case) ID() id.TestID

ID returns a test cases id

func (Case) ItemName

func (tc Case) ItemName() string

ItemName returns a test cases name

func (*Case) Rename added in v0.8.0

func (tc *Case) Rename(n string)

Rename renames the testcase. This might change its ID.

type CaseExecutionProtocol added in v0.10.0

type CaseExecutionProtocol struct {
	Id          int64
	TestVersion id.TestVersionID // The version of the case that belong to this protocol
	ProtocolNr  int

	SUTVersion    string
	SUTVariant    string
	ExecutionDate time.Time
	UserName      string `xorm:"-"` // The tester that executed this test
	IsAnonymous   bool   // Whether the execution was anonymous

	Result          Result
	Comment         string
	OtherNeededTime duration.Duration

	PreconditionResults []PreconditionResult    `xorm:"-"`
	StepProtocols       []StepExecutionProtocol `xorm:"-"`
}

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

func NewCaseExecutionProtocol added in v0.10.0

func NewCaseExecutionProtocol(caseProtocolLister ProtocolLister, preconditionResults []PreconditionResult,
	caseVersion id.TestVersionID, SUTVariant string, SUTVersion string,
	neededTime duration.Duration, stepCount int, userName string, isAnonymous bool) (CaseExecutionProtocol, error)

NewCaseExecutionProtocol creates a new execution protocol of a test case execution with the given information

func (CaseExecutionProtocol) DeepCopy added in v0.10.0

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

func (CaseExecutionProtocol) Equals added in v0.10.0

func (prt CaseExecutionProtocol) Equals(in interface{}) bool

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

func (*CaseExecutionProtocol) Finish added in v0.10.0

func (prt *CaseExecutionProtocol) Finish(result Result, comment string, neededTime duration.Duration)

Finish will finish the Protocol and saves over all Data.

func (*CaseExecutionProtocol) GetNeededTime added in v0.10.0

func (prt *CaseExecutionProtocol) GetNeededTime() duration.Duration

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

func (CaseExecutionProtocol) ID added in v0.10.0

ID returns a caseProtocols id

func (*CaseExecutionProtocol) IsFinished added in v0.10.0

func (prt *CaseExecutionProtocol) IsFinished() bool

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

func (*CaseExecutionProtocol) SaveStep added in v0.10.0

func (prt *CaseExecutionProtocol) SaveStep(stepNr int, observedBehavior string, result Result, comment string,
	neededTime duration.Duration)

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

type CaseProtocolGetter added in v1.0.0

type CaseProtocolGetter interface {
	// GetCaseExecutionProtocol gets the protocol with given id
	GetCaseExecutionProtocol(protocolID id.ProtocolID) (CaseExecutionProtocol, error)
}

CaseProtocolGetter is used to get a specific protocols for a given protocolID.

type CaseVersion

type CaseVersion struct {
	VersionNr     int
	Message       string
	IsMinor       bool
	Description   string
	Preconditions []Precondition
	Versions      map[string]*project.Version
	Duration      duration.Duration
	Steps         []Step
	CreationDate  time.Time
	Case          id.TestID
}

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

func NewTestCaseVersion

func NewTestCaseVersion(version int, isMinor bool, message, description string, preconditions []Precondition,
	versions map[string]*project.Version, dur duration.Duration, testcase id.TestID) CaseVersion

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

func (CaseVersion) ID added in v0.9.0

func (tcv CaseVersion) ID() id.TestVersionID

ID returns a testcase versions id

type Precondition added in v1.3.0

type Precondition struct {
	Id          int64
	TestVersion int64
	Content     string
}

type PreconditionResult added in v1.3.0

type PreconditionResult struct {
	Precondition Precondition
	Result       string
}

PreconditionResult contains information about the state of a precondition for an execution

type ProtocolLister added in v0.10.0

type ProtocolLister interface {
	// GetTestVersionProtocols gets the protocols for the testVersion with given id
	GetTestVersionProtocols(testVersionID id.TestVersionID) ([]id.ProtocolID, error)
	// GetCaseExecutionProtocol gets the caseProtocol related to the protocolID
	GetCaseExecutionProtocol(protocolID id.ProtocolID) (CaseExecutionProtocol, error)
}

ProtocolLister is used to list protocols for a given testVersion.

type Result

type Result int

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

const (
	NotAssessed Result = iota
	Pass
	PartiallySuccessful
	Fail
	NotApplicable
)

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

func GetResultFromString added in v1.1.0

func GetResultFromString(resString string) (Result, error)

GetResultFromString returns a valid result for a correct string

func (Result) Integer

func (r Result) Integer() int

Integer returns the result as a string

func (Result) PrettyString added in v1.7.0

func (r Result) PrettyString() string

String returns the result as a prettier string

func (Result) String

func (r Result) String() string

String returns the result as a string

type Sequence

type Sequence struct {
	Id        int64
	CreatedAt time.Time `xorm:"created"`

	// Foreign Key ----------------|
	ProjectId int64

	Name string

	Project          id.ProjectID      `xorm:"-"`
	Labels           []*project.Label  `xorm:"-"`
	SequenceVersions []SequenceVersion `xorm:"-"`
}

The Sequence struct contains information for describing a test sequence

func NewTestSequence

func NewTestSequence(name, description string, preconditions []Precondition,
	cases []Case, project id.ProjectID) (Sequence, error)

NewTestSequence creates a new test sequence with the given information

func (Sequence) ID

func (ts Sequence) ID() id.TestID

ID returns a test sequences id

func (Sequence) ItemName

func (ts Sequence) ItemName() string

ItemName returns a test cases name

func (*Sequence) Rename added in v0.8.0

func (ts *Sequence) Rename(n string)

Rename renames this sequence also changing it's id.

type SequenceExecutionProtocol added in v0.10.0

type SequenceExecutionProtocol struct {
	Id          int64
	TestVersion id.TestVersionID
	ProtocolNr  int

	Result      Result
	UserName    string `xorm:"-"` // "Tester" in db
	IsAnonymous bool

	SUTVersion      string
	SUTVariant      string
	ExecutionDate   time.Time
	OtherNeededTime duration.Duration

	PreconditionResults    []PreconditionResult `xorm:"-"`
	CaseExecutionProtocols []id.ProtocolID      `xorm:"-"`
}

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

func NewSequenceExecutionProtocol added in v0.10.0

func NewSequenceExecutionProtocol(sequenceProtocolLister ProtocolLister, preconditionResult []PreconditionResult, sequenceVersion id.TestVersionID,
	sutVariant string, sutVersion string, neededTime duration.Duration, userName string, isAnonymous bool) (SequenceExecutionProtocol, error)

NewSequenceExecutionProtocol creates a new execution protocol of a test sequence execution with the given information

func (*SequenceExecutionProtocol) AddCaseExecutionProtocol added in v0.10.0

func (s *SequenceExecutionProtocol) AddCaseExecutionProtocol(caseProtocol CaseExecutionProtocol)

AddCaseExecutionProtocol adds an case protocol to the sequence protocol

func (SequenceExecutionProtocol) Equals added in v0.10.0

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

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

func (SequenceExecutionProtocol) ID added in v0.10.0

ID returns a sequenceProtocols id

func (*SequenceExecutionProtocol) UpdateResult added in v1.5.0

func (s *SequenceExecutionProtocol) UpdateResult(cpg CaseProtocolGetter) error

updateResult calculates and set the overall result of the sequenceProtocol out of all the contained case-results. The rules for the calculation: At least one Fail -> fail No Fail, at least one PartiallySuccessful -> PartiallySuccessful No Fail, at least one NotAssessed but not only -> PartiallySuccessful Only Pass -> Pass Only NotAssessed -> NotAssessed Suppress linter "not used" nolint: megacheck

type SequenceInfo

type SequenceInfo struct {
	Versions      map[string]*project.Version
	DurationHours int
	DurationMin   int
}

SequenceInfo contains meta information for a SequenceVersion. This data depends on the cases that the sequence contains.

type SequenceVersion

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

SequenceVersion contains information for describing a version of a test sequence

func NewTestSequenceVersion

func NewTestSequenceVersion(version int, isMinor bool, message, description string, preconditions []Precondition,
	cases []Case, testsequence id.TestID) (SequenceVersion, error)

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

func UpdateInfo added in v1.0.0

func UpdateInfo(ts *SequenceVersion) (*SequenceVersion, error)

UpdateInfo updates the SequenceInfo of a SequenceVersion, populating it with generated data

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) ID added in v0.9.0

func (tsv SequenceVersion) ID() id.TestVersionID

ID returns a test sequences id

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
	ExpectedResult string
	Index          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 StepExecutionProtocol added in v0.10.0

type StepExecutionProtocol struct {
	NeededTime       duration.Duration
	ObservedBehavior string
	Result           Result
	Comment          string
	Visited          bool
}

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

func (StepExecutionProtocol) DeepCopy added in v0.10.0

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