├── .github └── workflows │ └── blank.yml ├── .gitignore ├── .travis.yml ├── Jenkinsfile ├── Jenkinsfiles_Dec ├── LICENSE ├── README.md ├── azure-pipelines.yml ├── features ├── __init__.py ├── calc_feature_1.feature ├── calc_feature_2.feature ├── calc_feature_3.feature ├── pages │ ├── __init__.py │ └── simple_calculator.py └── steps │ ├── __init__.py │ └── simple_cal_steps.py └── requirements.txt /.github/workflows/blank.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - master 7 | push: 8 | branches: 9 | - master 10 | - release/* 11 | 12 | jobs: 13 | build: 14 | 15 | runs-on: ubuntu-latest 16 | strategy: 17 | max-parallel: 4 18 | matrix: 19 | python-version: [2.7] 20 | 21 | steps: 22 | - uses: actions/checkout@v1 23 | - name: Set up Python ${{ matrix.python-version }} 24 | uses: actions/setup-python@v1 25 | with: 26 | python-version: ${{ matrix.python-version }} 27 | - name: Run Parallel Test 28 | run: | 29 | python -m pip install --upgrade pip 30 | python --version 31 | pip install virtualenv 32 | virtualenv .env 33 | source .env/bin/activate 34 | pip install -r requirements.txt 35 | pip install git+git://github.com/hugeinc/behave-parallel.git@a57eff3087aae9bd7519a7d4fc15228611db20b9#egg=behave-parallel --upgrade 36 | pip freeze 37 | behave --processes 5 --parallel-element feature 38 | 39 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | 5 | # C extensions 6 | *.so 7 | 8 | # Distribution / packaging 9 | .Python 10 | env/ 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | *.egg-info/ 23 | .installed.cfg 24 | *.egg 25 | 26 | # PyInstaller 27 | # Usually these files are written by a python script from a template 28 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 29 | *.manifest 30 | *.spec 31 | 32 | # Installer logs 33 | pip-log.txt 34 | pip-delete-this-directory.txt 35 | 36 | # Unit test / coverage reports 37 | htmlcov/ 38 | .tox/ 39 | .coverage 40 | .coverage.* 41 | .cache 42 | nosetests.xml 43 | coverage.xml 44 | *,cover 45 | 46 | # Translations 47 | *.mo 48 | *.pot 49 | 50 | # Django stuff: 51 | *.log 52 | 53 | # Sphinx documentation 54 | docs/_build/ 55 | 56 | # PyBuilder 57 | target/ 58 | 59 | .env/ 60 | 61 | .idea/ 62 | src/ 63 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | sudo: false 3 | python: 4 | - "2.7" 5 | cache: 6 | directories: 7 | - $HOME/.env/pip 8 | script: 9 | - python --version 10 | - pip install virtualenv 11 | - virtualenv .env 12 | - source .env/bin/activate 13 | - pip install -r requirements.txt 14 | - pip install git+git://github.com/hugeinc/behave-parallel.git@a57eff3087aae9bd7519a7d4fc15228611db20b9#egg=behave-parallel --upgrade 15 | - pip freeze 16 | - behave --processes 5 --parallel-element feature 17 | -------------------------------------------------------------------------------- /Jenkinsfile: -------------------------------------------------------------------------------- 1 | node{ 2 | stage('Checkout Project'){ 3 | properties([pipelineTriggers([[$class: 'GitHubPushTrigger']])]) 4 | checkout scm 5 | git_branch = env.BRANCH_NAME 6 | git_tag = sh returnStdout: true, script: 'git tag -l --points-at HEAD' 7 | } 8 | 9 | stage("Bake Docker") { 10 | echo 'Bake Docker' 11 | } 12 | stage('Test'){ 13 | parallel ( 14 | "JUnit": { 15 | sh "echo JUnit" 16 | }, 17 | "DBUnit": { 18 | sh "echo DBUnit" 19 | }, 20 | "Jasmine": { 21 | sh "echo Jasmine" 22 | }, 23 | ) 24 | } 25 | 26 | stage('Deploy Dev'){ 27 | sh "echo Dev" 28 | } 29 | stage('Browser Tests'){ 30 | parallel ( 31 | "Firefox": { 32 | sh "echo Firefox" 33 | }, 34 | "Edge": { 35 | sh "echo Edge" 36 | }, 37 | "Safari": { 38 | sh "echo Safari" 39 | }, 40 | "Chrome": { 41 | sh "echo Chrome" 42 | }, 43 | ) 44 | } 45 | stage('Deploy Staging'){ 46 | sh "echo Staging" 47 | } 48 | stage('Browser Tests'){ 49 | parallel ( 50 | "Firefox": { 51 | sh "echo Firefox" 52 | }, 53 | "Edge": { 54 | sh "echo Edge" 55 | }, 56 | "Safari": { 57 | sh "echo Safari" 58 | }, 59 | "Chrome": { 60 | sh "echo Chrome" 61 | }, 62 | ) 63 | } 64 | 65 | stage('Deploy Perf'){ 66 | sh "echo Staging" 67 | } 68 | stage('Browser Tests'){ 69 | parallel ( 70 | "VAPT": { 71 | sh "echo VAPT" 72 | }, 73 | "Load Tests": { 74 | sh "echo Load Tests" 75 | }, 76 | "Stress Tests": { 77 | sh "echo Stress Tests" 78 | }, 79 | "Spike Tests": { 80 | sh "echo Spike Tests" 81 | }, 82 | ) 83 | } 84 | stage('Blue Production'){ 85 | sh "echo Blue Production" 86 | } 87 | stage('Post Deployment Browser Tests'){ 88 | parallel ( 89 | "Firefox": { 90 | sh "echo Firefox" 91 | }, 92 | "Edge": { 93 | sh "echo Edge" 94 | }, 95 | "Safari": { 96 | sh "echo Safari" 97 | }, 98 | "Chrome": { 99 | sh "echo Chrome" 100 | }, 101 | ) 102 | } 103 | stage('Green Production'){ 104 | sh "echo Green Production" 105 | } 106 | stage("Merge Pull Request") 107 | { 108 | sh "echo Merge Pull Request" 109 | } 110 | stage("Merge to Master") 111 | { 112 | sh "echo Merge to Master" 113 | } 114 | 115 | } 116 | -------------------------------------------------------------------------------- /Jenkinsfiles_Dec: -------------------------------------------------------------------------------- 1 | pipeline { 2 | agent { docker { image 'python:3.7.2' } } 3 | stages { 4 | stage('build') { 5 | steps { 6 | sh 'pip install -r requirements.txt' 7 | } 8 | } 9 | stage('test') { 10 | steps { 11 | sh 'python test.py' 12 | } 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Vishal 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | # Welcome to the behave_parallel_demo wiki! 3 | 4 |

5 | Follow on Twitter 6 |
7 |

8 | 9 | 10 | | CI Provider | Build Status | Time Taken(Approx) | 11 | | ------------- | ------------- | ------------- | 12 | | **Github Actions** | [![GitHub Actions status](https://github.com/vishalm/behave_parallel_demo/workflows/CI/badge.svg)](https://launch-editor.github.com/actions?workflowID=CI&event=push&nwo=vishalm%2Fbehave_parallel_demo)| 40+ Sec [Github Status](https://launch-editor.github.com/actions?workflowID=CI&event=push&nwo=vishalm%2Fbehave_parallel_demo)| 13 | | **Azure DevOps** | [![Build Status](https://dev.azure.com/vishalmishra84/Test%20Project/_apis/build/status/vishalm.behave_parallel_demo?branchName=master)](https://dev.azure.com/vishalmishra84/Test%20Project/_build/latest?definitionId=2&branchName=master) | 31+ Sec [Azure Stats](https://dev.azure.com/vishalmishra84/Test%20Project/_build?definitionId=2&view=ms.vss-pipelineanalytics-web.new-build-definition-pipeline-analytics-view-cardmetrics)| 14 | | **Travis** | [![Travis](https://travis-ci.org/vishalm/behave_parallel_demo.svg)](https://travis-ci.org/vishalm/behave_parallel_demo) | 33+ Sec [Travis Status](http://scribu.net/travis-stats/#vishalm/behave_parallel_demo/master)| 15 | 16 | 17 | 18 | #### Must do 19 | How what want to manage virtual env but make sure you are following these steps 20 | * `virtualenv .env ` 21 | * `source .env/bin/activate ` 22 | * `pip install -r requirements.txt` 23 | * `pip install git+git://github.com/hugeinc/behave-parallel.git@a57eff3087aae9bd7519a7d4fc15228611db20b9#egg=behave-parallel --upgrade` ### Super importent 24 | 25 | 26 | ##Works exact steps on Ubuntu: 27 | 28 | ### Steps: 29 | 1. Clone this repo 30 | 1. Goto to root of the project 31 | 1. Create a virtual evn 32 | 33 | * `virtualenv .env ` 34 | * `source .env/bin/activate ` 35 | * `pip install -r requirements.txt` 36 | * `pip install git+git://github.com/hugeinc/behave-parallel.git@a57eff3087aae9bd7519a7d4fc15228611db20b9#egg=behave-parallel --upgrade` ### Super importent 37 | * `pip freeze` 38 | 39 | ###Run Features in parallel 40 | `/usr/bin/time behave --processes 5 --parallel-element feature ` 41 | 42 | ###Run Scenario in parallel 43 | `/usr/bin/time behave --processes 5 --parallel-element scenario ` 44 | 45 | ###How I run feature: 46 | `/usr/bin/time behave --processes "${PROCESS_COUNT}" --parallel-element feature --junit --junit-directory=xmlrunner -v -t "${TAGS_LIST}" -f rerun -o rerun.txt -f plain -T --no-skipped --tags=~@xfail features/` 47 | 48 | ###How I run Scenario: 49 | `/usr/bin/time behave --processes "${PROCESS_COUNT}" --parallel-element scenario --junit --junit-directory=xmlrunner -v -t "${TAGS_LIST}" -f rerun -o rerun.txt -f plain -T --no-skipped --tags=~@xfail features/ ` 50 | 51 | Actual Source: 52 | 53 | 54 | -------------------------------------------------------------------------------- /azure-pipelines.yml: -------------------------------------------------------------------------------- 1 | # Python package 2 | # Create and test a Python package on multiple Python versions. 3 | # Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more: 4 | # https://docs.microsoft.com/azure/devops/pipelines/languages/python 5 | 6 | trigger: 7 | - master 8 | 9 | pool: 10 | vmImage: 'ubuntu-latest' 11 | strategy: 12 | matrix: 13 | Python27: 14 | python.version: '2.7' 15 | 16 | steps: 17 | - task: UsePythonVersion@0 18 | inputs: 19 | versionSpec: '$(python.version)' 20 | displayName: 'Use Python $(python.version)' 21 | 22 | - script: | 23 | python -m pip install --upgrade pip 24 | python --version 25 | pip install virtualenv 26 | virtualenv .env 27 | source .env/bin/activate 28 | pip install -r requirements.txt 29 | pip install git+git://github.com/hugeinc/behave-parallel.git@a57eff3087aae9bd7519a7d4fc15228611db20b9#egg=behave-parallel --upgrade 30 | pip freeze 31 | displayName: 'Install dependencies' 32 | 33 | - script: | 34 | source .env/bin/activate 35 | behave --processes 5 --parallel-element feature 36 | displayName: 'Parallel behave tests' 37 | -------------------------------------------------------------------------------- /features/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vishalm/behave_parallel_demo/f9dd0187f6ac26742466ef72bb13f658536bac8a/features/__init__.py -------------------------------------------------------------------------------- /features/calc_feature_1.feature: -------------------------------------------------------------------------------- 1 | @simple_calculator 2 | 3 | Feature: Simple Calculator 1 4 | In order to perform simple arithmetic operation 5 | As a math practitioner 6 | I want to creat simple calculator 7 | 8 | @simple_calculator 9 | Scenario: Addition of two numbers 1 1 10 | Given I have two number 150 and 70 into the calculator 11 | When I perform addition 12 | Then the result should be 220 on the screen 13 | 14 | @simple_calculator 15 | Scenario: Subtraction of two numbers 1 2 16 | Given I have two number 70 and 50 into the calculator 17 | When I perform subtraction 18 | Then the result should be 20 on the screen 19 | 20 | @simple_calculator 21 | Scenario: Multiplication two numbers 1 3 22 | Given I have two number 5 and 70 into the calculator 23 | When I perform multiplication 24 | Then the result should be 350 on the screen 25 | 26 | @simple_calculator 27 | Scenario: Divide two numbers 1 4 28 | Given I have two number 88 and 11 into the calculator 29 | When I perform division 30 | Then the result should be 8 on the screen 31 | 32 | @simple_calculator 33 | Scenario Outline: Perform simple arithmetic operations 1 5 x 34 | Given I have two number and into the calculator 35 | When I perform 36 | Then the result should be on the screen 37 | Examples: 38 | | param1 | param2 |operator | expected_result | 39 | | 12 | 6 |division | 2 | 40 | | 6 | 12 |division | 0.5 | 41 | | 1.5 | 2 |multiplication | 3 | 42 | | 25 | 10 |multiplication | 250 | 43 | | -5 | -2 |subtraction | -3 | 44 | | 25.5 | 10 |subtraction | 15.5 | 45 | | -5 | -3 |addition | -8 | 46 | | 10.5 | 10 |addition | 20.5 | -------------------------------------------------------------------------------- /features/calc_feature_2.feature: -------------------------------------------------------------------------------- 1 | @simple_calculator 2 | 3 | Feature: Simple Calculator 2 4 | In order to perform simple arithmetic operation 5 | As a math practitioner 6 | I want to creat simple calculator 7 | 8 | @simple_calculator 9 | Scenario: Addition of two numbers 2 1 10 | Given I have two number 150 and 70 into the calculator 11 | When I perform addition 12 | Then the result should be 220 on the screen 13 | 14 | @simple_calculator 15 | Scenario: Subtraction of two numbers 2 2 16 | Given I have two number 70 and 50 into the calculator 17 | When I perform subtraction 18 | Then the result should be 20 on the screen 19 | 20 | @simple_calculator 21 | Scenario: Multiplication two numbers 2 3 22 | Given I have two number 5 and 70 into the calculator 23 | When I perform multiplication 24 | Then the result should be 350 on the screen 25 | 26 | @simple_calculator 27 | Scenario: Divide two numbers 2 4 28 | Given I have two number 88 and 11 into the calculator 29 | When I perform division 30 | Then the result should be 8 on the screen 31 | 32 | @simple_calculator 33 | Scenario Outline: Perform simple arithmetic operations 2 5 x 34 | Given I have two number and into the calculator 35 | When I perform 36 | Then the result should be on the screen 37 | Examples: 38 | | param1 | param2 |operator | expected_result | 39 | | 12 | 6 |division | 2 | 40 | | 6 | 12 |division | 0.5 | 41 | | 1.5 | 2 |multiplication | 3 | 42 | | 25 | 10 |multiplication | 250 | 43 | | -5 | -2 |subtraction | -3 | 44 | | 25.5 | 10 |subtraction | 15.5 | 45 | | -5 | -3 |addition | -8 | 46 | | 10.5 | 10 |addition | 20.5 | -------------------------------------------------------------------------------- /features/calc_feature_3.feature: -------------------------------------------------------------------------------- 1 | @simple_calculator 2 | 3 | Feature: Simple Calculator 3 4 | In order to perform simple arithmetic operation 5 | As a math practitioner 6 | I want to creat simple calculator 7 | 8 | @simple_calculator 9 | Scenario: Addition of two numbers 3 1 10 | Given I have two number 150 and 70 into the calculator 11 | When I perform addition 12 | Then the result should be 220 on the screen 13 | 14 | @simple_calculator 15 | Scenario: Subtraction of two numbers 3 2 16 | Given I have two number 70 and 50 into the calculator 17 | When I perform subtraction 18 | Then the result should be 20 on the screen 19 | 20 | @simple_calculator 21 | Scenario: Multiplication two numbers 3 3 22 | Given I have two number 5 and 70 into the calculator 23 | When I perform multiplication 24 | Then the result should be 350 on the screen 25 | 26 | @simple_calculator 27 | Scenario: Divide two numbers 3 4 28 | Given I have two number 88 and 11 into the calculator 29 | When I perform division 30 | Then the result should be 8 on the screen 31 | 32 | @simple_calculator 33 | Scenario Outline: Perform simple arithmetic operations 3 5 x 34 | Given I have two number and into the calculator 35 | When I perform 36 | Then the result should be on the screen 37 | Examples: 38 | | param1 | param2 |operator | expected_result | 39 | | 12 | 6 |division | 2 | 40 | | 6 | 12 |division | 0.5 | 41 | | 1.5 | 2 |multiplication | 3 | 42 | | 25 | 10 |multiplication | 250 | 43 | | -5 | -2 |subtraction | -3 | 44 | | 25.5 | 10 |subtraction | 15.5 | 45 | | -5 | -3 |addition | -8 | 46 | | 10.5 | 10 |addition | 20.5 | -------------------------------------------------------------------------------- /features/pages/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vishalm/behave_parallel_demo/f9dd0187f6ac26742466ef72bb13f658536bac8a/features/pages/__init__.py -------------------------------------------------------------------------------- /features/pages/simple_calculator.py: -------------------------------------------------------------------------------- 1 | class SimpleCalculator(object): 2 | def __init__(self, param1, param2): 3 | self.fn = None 4 | self.param1 = param1 5 | self.param2 = param2 6 | 7 | def addition(self): 8 | return self.param1 + self.param2 9 | 10 | def subtraction(self): 11 | return self.param1 - self.param2 12 | 13 | def multiplication(self): 14 | return self.param1 * self.param2 15 | 16 | def division(self): 17 | return self.param1 / self.param2 18 | -------------------------------------------------------------------------------- /features/steps/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vishalm/behave_parallel_demo/f9dd0187f6ac26742466ef72bb13f658536bac8a/features/steps/__init__.py -------------------------------------------------------------------------------- /features/steps/simple_cal_steps.py: -------------------------------------------------------------------------------- 1 | from behave import * 2 | from features.pages.simple_calculator import SimpleCalculator 3 | 4 | 5 | step_matcher("re") 6 | 7 | var1 = '' 8 | var2 = '' 9 | actual_result = '' 10 | 11 | @given("I have two number (.*) and (.*) into the calculator") 12 | def step_impl(context,param1, param2): 13 | global var1 14 | global var2 15 | var1 = float(param1) 16 | var2 = float(param2) 17 | 18 | 19 | @when("I perform (addition|subtraction|multiplication|division)") 20 | def step_impl(context,operator): 21 | global var1 22 | global var2 23 | global actual_result 24 | calc = SimpleCalculator(var1, var2) 25 | if operator == 'addition': 26 | actual_result = calc.addition() 27 | if operator == 'subtraction': 28 | actual_result = calc.subtraction() 29 | if operator == 'multiplication': 30 | actual_result = calc.multiplication() 31 | if operator == 'division': 32 | actual_result = calc.division() 33 | 34 | 35 | @then("the result should be (.*) on the screen") 36 | def step_impl(context,expected_result): 37 | global actual_result 38 | assert (actual_result == float(expected_result)) is True 39 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | behave==1.2.4 2 | -e git+git://github.com/hugeinc/behave-parallel.git@a57eff3087aae9bd7519a7d4fc15228611db20b9#egg=behave-parallel 3 | 4 | --------------------------------------------------------------------------------