BDD and when trying the following the parameters in the feature file are not getting picked up. Am I missing a setting python side or a formatting issue with the feature file.
import pytest ,logging
from pytest_bdd import given, when, then, scenarios, parsers
LOG = logging.getLogger(__name__)
ROW_MAX_LENGTH = 100
parametersused =""
scenarios("../features/Duplicate_check.feature")
@given(parsers.parse("{parameters}"))
def ParseParmeters(parameters):
global LOG
LOG.debug("Parameters: " + parameters)
#used to called given
global parametersused
parametersused = parameters
Feature file:
Feature:Check if data of given attributes is NOT NULL
Scenario: Duplicate_check
Given <parameters>
When SQL to execute:
SELECT
'%TST_CD' AS Test
,(SELECT PROC_DATE FROM V_UTIL.PROCESSING_DATES WHERE PROC_DATE_TYP_CD = '%Proc_Typ_Cd') AS Business_Date
,'%Data_Entity' AS Data_Entity
,'%Data_Attribute' AS Data_Attribute
,'FAIL' AS Test_Sql_Status
FROM
(
SELECT CASE WHEN COUNT(1) = 0 THEN 'PASS' ELSE 'FAIL' END AS RESULT
FROM ( SELECT LMT_ID,LMT_TYP_CD
FROM {$ENV}.LI
WHERE PROCESS_NAME='proc'
GROUP BY 1,2
HAVING COUNT(1) > 1)A
) tst_SQL
WHERE tst_SQL.RESULT= 'FAIL';
Then EXPECTED_RESULT=NO_ROWS_RETURNED
Examples:
|parameters|
|TST_CD=Duplicate_check; Data_Entity=ENT ;PROCESS_NAME=PROC001; Data_Attribute=DA,AD;Proc_Typ_Cd=PROC|