Skip to content

dctse/openshift-cucumber

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
This branch is 26 commits behind vbehar:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

OpenShift Cucumber

Cucumber steps definitions for the OpenShift API.

GoDoc Download Travis Circle CI Go Report Card

This project provides Cucumber step definitions to execute tests on an OpenShift instance.

It allows you to write things like

Given My current project is "hello-openshift"
When I create a new application based on the template "hello-openshift" with parameters "APPLICATION_NAME=hello"
Then I should have a deploymentconfig "hello"
And I should have a service "hello"
...
Given I have a buildconfig "hello"
When I start a new build of "hello"
Then the latest build of "hello" should succeed in less than "5m"
...
Given I have a deploymentconfig "hello"
When the deploymentconfig "hello" has at least 1 deployment
Then the latest deployment of "hello" should succeed in less than "3m"
...
When I have a successful deployment of "hello"
Then I can access the application through the route "hello"

You can find more complete examples in the examples directory.

With it, you can write complete tests for your application deployment on OpenShift:

  • login (or token validation)
  • project creation
  • credentials setup (secrets and serviceaccounts)
  • templates creation
  • applications creation
  • build status
  • deployment status
  • route http check

It does not include all features available in OpenShift, but it's easy to add more step definitions ;-)

Usage

Write Cucumber feature files, and then just run openshift-cucumber with the path of yours files as argument.

Note that openshift-cucumber relies on environment variables to login:

  • OPENSHIFT_HOST: the OpenShift server (for example: https://localhost:8443)
  • OPENSHIFT_USER: the username (if you want to perform a login - in this case you also need to provide a password)
  • OPENSHIFT_PASSWD: the password
  • OPENSHIFT_TOKEN: the token (if you just want to validate a ServiceAccount token - in this case, you don't need the user or password)

If you want to run the provided examples againt a local instance of OpenShift:

$ export OPENSHIFT_HOST="https://localhost:8443"
$ export OPENSHIFT_USER="demo"
$ export OPENSHIFT_PASSWD="demo"
$ openshift-cucumber examples

Output / Reporting

By default, openshift-cucumber print each step and its result (either success in green, or failure in red) in the standard output.

You can also configure a reporter:

  • JUnit: the JUnit reporter can write the results in a JUnit XML formatted file, so that it can be used by Jenkins to display a nice UI on top of it.

    You need to configure the --reporter and --output options:

    openshift-cucumber --reporter="junit" --output="/path/to/results.xml" /path/to/feature-files
    

Install

Pre-build binaries for the main platforms (darwin-amd64, linux-amd64 and windows-amd64) are available in bintray:

https://bintray.com/vbehar/openshift-cucumber/openshift-cucumber/_latestVersion#files

Building from sources

openshift-cucumber is written in Go. To build it, you need:

Then, you can run godep go install to build the openshift-cucumber executable (in $GOPATH/bin)

To make things easier, you can use the provided Dockerfile to build in a Docker environment:

  • Build a docker image:

    docker build -t openshiftcucumber -f Dockerfile.build .
    
  • And build the project in a container (the default command is gox, which will build binaries for the main platforms)

    docker run --rm -v $PWD:/go/src/github.com/vbehar/openshift-cucumber openshiftcucumber
    
  • The binaries will be available in the build directory.

License

Copyright 2015 the original author or authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

Cucumber steps definitions for the OpenShift API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 100.0%