File tree Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Expand file tree Collapse file tree 1 file changed +16
-3
lines changed Original file line number Diff line number Diff line change 11import csv
22import io
3+ import os
34from enum import Enum
45from pathlib import Path
56from behave .runner_util import make_undefined_step_snippet
@@ -26,11 +27,23 @@ def scenario_name(scenario):
2627 return scenario .name if scenario .name else scenario .keyword
2728
2829
29- def scenario_history_id (scenario ):
30+ def scenario_history_id (scenario ) -> str :
31+ """
32+ Create a historyId for a scenario.
33+ - Always based on feature name and scenario name
34+ - Optional: can append a value from an environment variable
35+ """
3036 parts = [scenario .feature .name , scenario .name ]
31- if scenario ._row :
37+
38+ if hasattr (scenario , "_row" ) and scenario ._row :
3239 row = scenario ._row
33- parts .extend ([f'{ name } ={ value } ' for name , value in zip (row .headings , row .cells )])
40+ parts .extend ([f"{ name } ={ value } " for name , value in zip (row .headings , row .cells )])
41+
42+ # Optional: append environment variable to differentiate runs
43+ history_id = os .getenv ("HISTORY_ID" )
44+ if history_id :
45+ parts .append (history_id )
46+
3447 return md5 (* parts )
3548
3649
You can’t perform that action at this time.
0 commit comments