Sign inSign up

williamyeh/behave

By williamyeh

•Updated over 7 years ago

Docker image for Python-based SBE/BDD tools.

Image
3

10K+

williamyeh/behave repository overview

⁠Docker image for Python-based SBE/BDD tools

Circle CI Build Status

⁠Summary

Repository name in Docker Hub: williamyeh/behave⁠

This repository contains Dockerized Python tools for SBE/BDD, published to the public Docker Hub⁠ via automated build mechanism.

⁠Configuration

This docker image contains the following software stack:

⁠Usage

Given a features sub-directory as follows:

.
└── features
    ├── environment.py
    ├── requirements.txt
    ├── xxx.feature
    ├── yyy.feature
    └── steps
        ├── xxx_step.py
        └── yyy_step.py

When I invoke the program as follows:

$ docker run -it --rm -v "$(pwd):/behave:ro"  williamyeh/behave

Then I can see the output as follows:

Feature: ...
[...]
1 feature passed, 0 failed, 0 skipped
7 scenarios passed, 0 failed, 0 skipped
21 steps passed, 0 failed, 0 skipped, 0 undefined
Took 0m11.532s

Note: requirements.txt in features directory.

⁠Run with browser in headless mode

This is the default mode. All are done within the Docker container.

⁠Run with desktop's browser

To run with the desktop's browser, please follow the steps.

+---------------------------------------------------------+
|                                                         |
|                                                 host    |
|   +----------------+                                    |
|   |     Docker     |                                    |
|   |                |                                    |
|   |                |                                    |
|   |                |                                    |
|   |                |                                    |
|   |    container   |                        Chrome      |
|   |        |       |      ChromeDriver      browser     |
|   +----------------+       |        |          |        |
|            |               |        |          |        |
|            +---------------+        +----------+        |
|                    /wd/hub:9515                         |
|                                                         |
+---------------------------------------------------------+
⁠Requirements for host environment
  1. Install Chrome⁠.

  2. Install ChromeDriver⁠. Mac users can install it as follows:

    $ brew install chromedriver
    

    Windows users can install it as follows:

    > choco install chromedriver
    
⁠Configuration

Configure features/environment.py as follows:

# import useful functions
from environment_common import init_selenium_chrome_driver
from environment_common import use_headless_mode
from environment_common import set_remote_chrome_addr
...


# invoke them, if necessary
use_headless_mode(False)
...


# customize hooks, if necessary

def before_all(context):
    ...
⁠Run
  1. Start the ChromeDriver with base URL path /wd/hub and default port 9515:

    $ chromedriver --url-base=/wd/hub
    
  2. Now you're ready to run williamyeh/behave!

If you encounter the error WebDriverException: Message: Host header or origin header is specified and is not localhost. try to add the container's IP address into the whitelist as follows:

$ chromedriver --url-base=/wd/hub --whitelisted-ips="xxx.xxx.xxx.xxx"

⁠TODO

  1. Detailed document.
  2. Firefox?
  3. Flow with Jenkins.

⁠Tutorial

Behave

Selenium

Elementium

Capybara

⁠License

Author: William Yeh [email protected]⁠

Licensed under the Apache License V2.0. See the LICENSE file⁠ for details.

Tag summary

Content type

Image

Digest

Size

343.5 MB

Last updated

over 7 years ago

docker pull williamyeh/behave