test

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2018 License: GPL-3.0 Imports: 8 Imported by: 21

Documentation

Index

Constants

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

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 CalculateSUTVersion

func CalculateSUTVersion(cases []Case) (map[string]*project.Variant, error)

CalculateSUTVersion calculates the applicable sut versions

Types

type Case

type Case struct {
	Name             string
	TestCaseVersions []CaseVersion
	Project          id.ProjectID
	Labels           []project.Label
}

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

func NewTestCase

func NewTestCase(name, description, preconditions string, labels []project.Label, variants map[string]*project.Variant,
	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 CaseExecutionRecord

type CaseExecutionRecord struct {
	TestVersion id.TestVersionID
	RecordNr    int

	SUTVersion    string
	SUTVariant    string
	ExecutionDate time.Time

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

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

func NewCaseExecutionRecord

func NewCaseExecutionRecord(caseRecordLister RecordLister, caseVersion id.TestVersionID, SUTVariant string,
	SUTVersion string, neededTime duration.Duration, stepCount int) (CaseExecutionRecord, error)

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 duration.Duration)

Finish will finish the Record and saves over all Data.

func (*CaseExecutionRecord) GetNeededTime

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

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

func (CaseExecutionRecord) ID

ID returns a caseRecords id

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 duration.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 CaseVersion

type CaseVersion struct {
	VersionNr     int
	Message       string
	IsMinor       bool
	Description   string
	Preconditions string
	Variants      map[string]*project.Variant
	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, preconditions string,
	variants map[string]*project.Variant, 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 RecordLister added in v0.9.0

type RecordLister interface {
	// GetTestVersionRecords gets the records for the testVersion with given id
	GetTestVersionRecords(testVersionID id.TestVersionID) ([]interface {
		ID() id.ProtocolID
	}, error)
}

RecordLister is used to list records 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
	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 {
	Name             string
	Project          id.ProjectID
	Labels           []project.Label
	SequenceVersions []SequenceVersion
}

The Sequence struct contains information for describing a test sequence

func NewTestSequence

func NewTestSequence(name, description, preconditions string, labels []project.Label, 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 sequences 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 SequenceExecutionRecord

type SequenceExecutionRecord struct {
	TestVersion id.TestVersionID
	RecordNr    int

	SUTVersion           string
	SUTVariant           string
	CaseExecutionRecords []id.ProtocolID
	OtherNeededTime      duration.Duration
}

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(sequenceRecordLister RecordLister, sequenceVersion id.TestVersionID, sutVariant string, sutVersion string, neededTime duration.Duration) (SequenceExecutionRecord, error)

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

func (*SequenceExecutionRecord) AddCaseExecutionRecord

func (s *SequenceExecutionRecord) AddCaseExecutionRecord(caseProtocol id.ProtocolID)

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.

func (SequenceExecutionRecord) ID

ID returns a sequenceRecords id

type SequenceInfo

type SequenceInfo struct {
	Variants      map[string]*project.Variant
	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
	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 string,
	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 (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 StepExecutionRecord

type StepExecutionRecord struct {
	NeededTime       duration.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