Skip to content

Commit

Permalink
Merge pull request #183 from hrcorval/release_4.1.0
Browse files Browse the repository at this point in the history
Release 4.1.0
  • Loading branch information
hrcorval authored Feb 17, 2025
2 parents 3f5aa96 + 612839a commit 92553bf
Show file tree
Hide file tree
Showing 12 changed files with 64 additions and 16 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ jobs:
run: |
python -m pip install --upgrade pip
python setup.py sdist
pip install dist/behavex-4.0.10.tar.gz
pip install dist/behavex-4.1.0.tar.gz
- name: Verify behavex command
shell: bash
Expand Down
11 changes: 11 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
Version History
===============================================================================

Version: 4.1.0
-------------------------------------------------------------------------------

ENHANCEMENTS:

* Cosmetic improvements in documentation

FIXES:

* Fixing issue when re-executing failing scenarios using the -rf option, as there where scenario outline examples not being considered in the re-execution

Version: 4.0.10
-------------------------------------------------------------------------------

Expand Down
14 changes: 8 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ Execute BehaveX in the same way as Behave from the command line, using the `beha

BehaveX manages concurrent executions of Behave instances in multiple processes. You can perform parallel test executions by feature or scenario. When the parallel scheme is by scenario, the examples of a scenario outline are also executed in parallel.

![Parallel Test Executions](https://github.com/hrcorval/behavex/blob/release_4.1.0/img/behavex_parallel_executions.png?raw=true)

### Examples:
```bash
behavex --parallel-processes=3
Expand All @@ -175,16 +177,16 @@ This variable can be accessed within the python tests using `context.config.user

## Test Execution Reports

### HTML Report
A friendly test execution report containing information related to test scenarios, execution status, evidence, and metrics. Available at:
### JSON Report
Contains information about test scenarios and execution status. This is the base report generated by BehaveX, which is used to generate the HTML report. Available at:
```bash
<output_folder>/report.html
<output_folder>/report.json
```

### JSON Report
Contains information about test scenarios and execution status. Available at:
### HTML Report
A friendly test execution report containing information related to test scenarios, execution status, evidence, and metrics. Available at:
```bash
<output_folder>/report.json
<output_folder>/report.html
```

### JUnit Report
Expand Down
6 changes: 3 additions & 3 deletions behavex/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,20 +104,20 @@ def run(args):
ConfigRun().set_args(args_parsed)
execution_code, rerun_list = setup_running_failures(args_parsed)
if rerun_list:
paths = ",".join(rerun_list)
paths = ",".join(rerun_list).replace('\n', '')
os.environ['FEATURES_PATH'] = paths
global_vars.rerun_failures = True
if execution_code == EXIT_ERROR:
return EXIT_ERROR
else:
# Handle paths parameter
if len(get_param('paths')) > 0:
paths = ",".join(expand_paths(get_param('paths')))
paths = ",".join(expand_paths(get_param('paths'))).replace('\n', '')
os.environ['FEATURES_PATH'] = paths

# Handle include_paths parameter
if len(get_param('include_paths')) > 0:
include_paths = ",".join(expand_paths(get_param('include_paths')))
include_paths = ",".join(expand_paths(get_param('include_paths'))).replace('\n', '')
features_path = os.environ.get('FEATURES_PATH')
if features_path == '' or features_path is None or not os.path.exists(features_path):
os.environ['FEATURES_PATH'] = include_paths
Expand Down
11 changes: 8 additions & 3 deletions behavex/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@ def join_scenario_reports(json_reports):
def explore_features(features_path, features_list=None):
if features_list is None:
features_list = []

# Normalize path separators
pure_feature_path, scenario_line = get_feature_and_scenario_line(features_path)
normalized_features_path = os.path.normpath(pure_feature_path)
Expand All @@ -190,8 +189,14 @@ def explore_features(features_path, features_list=None):
if scenario_line:
# iterate over scenarios and add the scenario that matches the scenario line
for scenario in feature.scenarios:
if scenario.line == int(scenario_line):
features_list.append(scenario)
#check if scenario is a ScenarioOutline
if isinstance(scenario, ScenarioOutline):
for example in scenario.scenarios:
if example.line == int(scenario_line):
features_list.append(example)
else:
if scenario.line == int(scenario_line):
features_list.append(scenario)
else:
features_list.extend(feature.scenarios)
else:
Expand Down
Binary file added img/behavex_parallel_executions.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "behavex"
version = "4.0.10"
version = "4.1.0"
description = "Agile testing framework on top of Behave (BDD)."
readme = "README.md"
license = { text = "MIT" }
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

setup(
name='behavex',
version='4.0.10',
version='4.1.0',
license="MIT",
platforms=['any'],
python_requires='>=3.5',
Expand Down
1 change: 1 addition & 0 deletions tests/features/failing_scenarios.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tests/features/secondary_features/passing_tests.feature:8,tests/features/secondary_features/passing_tests.feature:29,tests/features/secondary_features/failing_tests.feature:3
21 changes: 21 additions & 0 deletions tests/features/rerun_scenarios.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Feature: Rerun Scenarios

@RERUN_SCENARIOS
Scenario Outline: Performing rerun of failing scenarios using the -rf option
Given I have installed behavex
When I setup the behavex command with "<parallel_processes>" parallel processes and parallel scheme set as "<parallel_scheme>"
When I run the behavex command with a file of failing tests
Then I should see the following behavex console outputs and exit code "1"
| output_line |
| 2 scenarios passed, 1 failed |
| Exit code: 1 |
And I should not see exception messages in the output
And I should see the same number of scenarios in the reports not considering the skipped scenarios
And I should see the generated HTML report does not contain internal BehaveX variables and tags
Examples:
| parallel_scheme | parallel_processes |
| scenario | 1 |
| scenario | 3 |

# TODO: Uncomment this when enable performing rerun of failing scenarios using parallel scheme set as feature
# | feature | 2 |
2 changes: 1 addition & 1 deletion tests/features/skipped_scenarios.feature
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Feature: Skipped Scenarios
Then I should see the following behavex console outputs and exit code "0"
| output_line |
| 0 scenarios passed, 0 failed, 1 skipped |
| Exit code: 0
| Exit code: 0 |
And I should not see error messages in the output
And I should see the same number of scenarios in the reports and the console output
And I should see the generated HTML report does not contain internal BehaveX variables and tags
7 changes: 7 additions & 0 deletions tests/features/steps/execution_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@ def step_impl(context):
execute_command(context, execution_args)


@when('I run the behavex command with a file of failing tests')
def step_impl(context):
context.output_path = os.path.join('output', 'output_{}'.format(get_random_number(6)))
execution_args = ['behavex', '-rf', os.path.join(tests_features_path, 'failing_scenarios.txt'), '-o', context.output_path]
execute_command(context, execution_args)


@when('I run the behavex command that renames scenarios and features')
def step_impl(context):
context.output_path = os.path.join('output', 'output_{}'.format(get_random_number(6)))
Expand Down

0 comments on commit 92553bf

Please sign in to comment.