Skip to content

Commit 6ad9c8f

Browse files
change history_id
1 parent 5833093 commit 6ad9c8f

File tree

8 files changed

+88
-0
lines changed

8 files changed

+88
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name": "Tests shoud work", "status": "passed", "steps": [{"name": "Given start test", "status": "passed", "start": 1759410889128, "stop": 1759410889129}, {"name": "When we do something", "status": "passed", "start": 1759410889129, "stop": 1759410889129}, {"name": "Then compare the change", "status": "passed", "start": 1759410889129, "stop": 1759410889129}], "start": 1759410889127, "stop": 1759410889130, "uuid": "b38efcd4-cf08-4544-b5f6-91cb1746b75b", "historyId": "63243c8bf50b6a9471755d9c19f6cf03", "fullName": "Test Simple Test: Tests shoud work", "labels": [{"name": "severity", "value": "normal"}, {"name": "feature", "value": "Test Simple Test"}, {"name": "framework", "value": "behave"}, {"name": "language", "value": "cpython3"}], "titlePath": ["features", "scenarios", "Test Simple Test"]}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name": "Tests shoud work", "status": "passed", "steps": [{"name": "Given start test", "status": "passed", "start": 1759411049581, "stop": 1759411049581}, {"name": "When we do something", "status": "passed", "start": 1759411049581, "stop": 1759411049581}, {"name": "Then compare the change", "status": "passed", "start": 1759411049582, "stop": 1759411049582}], "start": 1759411049580, "stop": 1759411049582, "uuid": "6cb2c368-1a4a-42cd-95f1-a27f21715705", "historyId": "dd7d87ca9065638fdc5f8c802ad03d02", "fullName": "Test Simple Test: Tests shoud work", "labels": [{"name": "severity", "value": "normal"}, {"name": "feature", "value": "Test Simple Test"}, {"name": "framework", "value": "behave"}, {"name": "language", "value": "cpython3"}], "titlePath": ["features", "scenarios", "Test Simple Test"]}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"name": "Tests shoud work", "status": "passed", "steps": [{"name": "Given start test", "status": "passed", "start": 1759411141236, "stop": 1759411141237}, {"name": "When we do something", "status": "passed", "start": 1759411141238, "stop": 1759411141238}, {"name": "Then compare the change", "status": "passed", "start": 1759411141238, "stop": 1759411141239}], "start": 1759411141236, "stop": 1759411141239, "uuid": "2d14c15e-9012-4baa-8984-c100e0303e45", "historyId": "dd7d87ca9065638fdc5f8c802ad03d02", "fullName": "Test Simple Test: Tests shoud work", "labels": [{"name": "severity", "value": "normal"}, {"name": "feature", "value": "Test Simple Test"}, {"name": "framework", "value": "behave"}, {"name": "language", "value": "cpython3"}], "titlePath": ["features", "scenarios", "Test Simple Test"]}

jola_testenvironment/behave.ini

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# -- FILE: behave.ini
2+
[behave.formatters]
3+
html-pretty = behave_html_pretty_formatter:PrettyHTMLFormatter
4+
html = behave_html_formatter:HTMLFormatter
5+
allure=allure_behave.formatter:AllureFormatter
6+
7+
[behave]
8+
format=allure_behave.formatter:AllureFormatter
9+
outfiles=allure-results

jola_testenvironment/changes.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import hashlib
2+
import os
3+
4+
# jola_testenvironment\.venv\Lib\site-packages\allure_behave\utils.py
5+
6+
def scenario_history_id(scenario, extra: str = None) -> str:
7+
"""
8+
Erzeugt eine History-ID für ein Scenario.
9+
- Immer basierend auf Feature-Name, Scenario-Name und evtl. Tabellenzeilen.
10+
- Zusätzlich kann ein optionaler Faktor (extra) angegeben werden,
11+
der in die Berechnung mit einfließt.
12+
"""
13+
parts = [scenario.feature.name, scenario.name]
14+
15+
# Falls Scenario aus einer Tabelle (Outline) stammt
16+
if hasattr(scenario, "_row") and scenario._row:
17+
row = scenario._row
18+
parts.extend([f"{name}={value}" for name, value in zip(row.headings, row.cells)])
19+
20+
# Optionaler zusätzlicher Faktor (Parameter oder Umgebungsvariable)
21+
extra_factor = extra or os.getenv("TEST_HISTORY_FACTOR")
22+
if extra_factor:
23+
parts.append(f"extra={extra_factor}")
24+
25+
# Hash erzeugen
26+
text = "|".join(parts).encode("utf-8")
27+
return hashlib.md5(text).hexdigest()
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
from enum import Enum
2+
import os
3+
4+
5+
6+
class Option(str, Enum):
7+
OPTION_A = "Option A"
8+
OPTION_B = "Option B"
9+
10+
def before_all(context):
11+
os.environ["TEST_HISTORY_FACTOR"] = Option.OPTION_A.value
12+
13+
print(f"INFO: {os.getenv('TEST_HISTORY_FACTOR')}")
14+
pass
15+
16+
def before_scenario(context, scenario):
17+
pass
18+
19+
def before_step(context, step):
20+
pass
21+
22+
23+
def before_feature(context,feature):
24+
pass
25+
26+
def before_scenario(context,feature):
27+
pass
28+
29+
def after_all(context):
30+
pass
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
Feature: Test Simple Test
2+
Scenario: Tests shoud work
3+
Given start test
4+
When we do something
5+
Then compare the change
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from behave import Given,When,Then
2+
import allure
3+
4+
@Given("start test")
5+
def step_impl(context, ):
6+
print("Start Test")
7+
8+
@When("we do something")
9+
def step_impl(context, ):
10+
print("we do something")
11+
12+
@Then("compare the change")
13+
def step_impl(context, ):
14+
print("compare the change")

0 commit comments

Comments
 (0)