Documentation ¶
Index ¶
- type Factory
- type Fixture
- func (self *Fixture) AddCoworkerRepo()
- func (self *Fixture) AddSecondWorktree(branch gitdomain.LocalBranchName)
- func (self *Fixture) AddSubmoduleRepo()
- func (self *Fixture) AddUpstream()
- func (self *Fixture) Branches() datatable.DataTable
- func (self Fixture) CommitTable(fields []string) datatable.DataTable
- func (self *Fixture) CreateCommits(commits []testgit.Commit)
- func (self Fixture) CreateTags(table *messages.PickleStepArgument_PickleTable)
- func (self Fixture) TagTable() datatable.DataTable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory manages the Git setup for the entire test suite. For each scenario, it provides a standardized, empty Fixture consisting of a local and remote Git repository.
Setting up a Fixture is an expensive operation and has to be done for every scenario. As a performance optimization, Factory creates a fully set up Fixture (including the main branch and configuration) (the "memoized" environment) at the beginning of the test suite and makes copies of it for each scenario. Making copies of a fully set up Git repo is much faster than creating it from scratch. End-to-end tests run multi-threaded, all threads share a global Factory instance.
func NewFactory ¶
NewFactory provides a new FixtureFactory instance operating in the given directory.
func (*Factory) CreateFixture ¶
CreateFixture provides a new Fixture for the scenario with the given name.
type Fixture ¶
type Fixture struct { // CoworkerRepo is the optional Git repository that is locally checked out at the coworker machine. CoworkerRepo *testruntime.TestRuntime `exhaustruct:"optional"` // DevRepo is the Git repository that is locally checked out at the developer machine. DevRepo testruntime.TestRuntime `exhaustruct:"optional"` // Dir defines the local folder in which this Fixture is stored. // This folder also acts as the HOME directory for tests using this Fixture. // It contains the global Git configuration to use in this test. Dir string // OriginRepo is the Git repository that simulates the origin repo (on GitHub). // If this value is nil, the current test setup has no origin. OriginRepo *testruntime.TestRuntime `exhaustruct:"optional"` // SecondWorktree is the directory that contains an additional workspace. // If this value is nil, the current test setup has no additional workspace. SecondWorktree *testruntime.TestRuntime `exhaustruct:"optional"` // SubmoduleRepo is the Git repository that simulates an external repo used as a submodule. // If this value is nil, the current test setup uses no submodules. SubmoduleRepo *testruntime.TestRuntime `exhaustruct:"optional"` // UpstreamRepo is the optional Git repository that contains the upstream for this environment. UpstreamRepo *testruntime.TestRuntime `exhaustruct:"optional"` }
Fixture is a complete Git environment for a Cucumber scenario.
func CloneFixture ¶
CloneFixture provides a Fixture instance in the given directory, containing a copy of the given Fixture.
func NewStandardFixture ¶
NewStandardFixture provides a Fixture in the given directory, fully populated as a standardized setup for scenarios.
The origin repo has the initial branch checked out. Git repos cannot receive pushes of the currently checked out branch because that will change files in the current workspace. The tests don't use the initial branch.
func (*Fixture) AddCoworkerRepo ¶
func (self *Fixture) AddCoworkerRepo()
AddCoworkerRepo adds a coworker repository.
func (*Fixture) AddSecondWorktree ¶
func (self *Fixture) AddSecondWorktree(branch gitdomain.LocalBranchName)
func (*Fixture) AddSubmoduleRepo ¶
func (self *Fixture) AddSubmoduleRepo()
AddSubmodule adds a submodule repository.
func (*Fixture) AddUpstream ¶
func (self *Fixture) AddUpstream()
AddUpstream adds an upstream repository.
func (Fixture) CommitTable ¶
CommitTable provides a table for all commits in this Git environment containing only the given fields.
func (*Fixture) CreateCommits ¶
CreateCommits creates the commits described by the given Gherkin table in this Git repository.
func (Fixture) CreateTags ¶
func (self Fixture) CreateTags(table *messages.PickleStepArgument_PickleTable)
CreateTags creates tags from the given gherkin table.