# README
Projectwork Checking Automation
This little tool automates the checking of project work submissions using Docker and Cucumber. It takes the feature files described in the features directory and translates them to Go functions, some of which execute in a Docker container.
Important: running this utility doesn't replace testing your code yourself! If bugs or missing checks are found they may be added last minute!
Getting it to run
- Install the Docker Desktop.
- Download the appropriate release from the releases section.
- Unpack all files to a directory.
- Set the
EXOSCALE_KEY
,EXOSCALE_SECRET
environment variables. - Set the
DIRECTORY
variable to point to the directory with your source code. - Run the
hand-in-automation
program from its directory, optionally with the-v
or-vv
parameters to get a more detailed output.
Note: if you do not wish to check for the optional service discovery goal please remove or rename the sprint2-servicediscovery.feature
file from the features
directory.
Getting more info & making runs faster
This tool has a command-line switch to enable more verbose logging. It can be triggered by passing the -v
option, or the -vv
option for increasingly verbose logs.
If you want to run only some of the tests you can remove or rename the feature files in the release.
How it works
How Cucumber is used
Cucumber is integrated using GoDog, a test framework for Go executing feature files. main.go sets up the test environment and executes the steps.
The steps are defined in steps.go:
func (tc *TestContext) InitializeScenario(ctx *godog.ScenarioContext) {
ctx.Step(`^I have applied the Terraform code$`, tc.iHaveAppliedTheTerraformCode)
...
}
Each sentence is matched with a function, which is called when that sentence is used in a feature file. Some functions can have parameters that are automatically extracted based on the regular expression.
How Docker is integrated
Terraform is executed in a Docker container for security purposes. This is done in the function executeTerraform
. It
will connect the Docker socket and launch a new container for each Terraform execution.