cucumber4 and my feature file is having a step which takes around 15 parameters. I want to access my testdata.json file content without passing as parameters for the stepdefinition. Here my requirement is how we can access the datafile content i.e testdata.json file in the stepdef without passing as parameters due to large number of parameters.
build.gradle:
implementation group: 'com.qmetry', name: 'qaf', version: '2.1.15'
implementation group: 'com.qmetry', name :'qaf-cucumber4', version: '2.1.15'
implementation 'org.json:json:20210307'
testdata.json
[
{
"Url" : "https://test.appp.com/",
"FirstName" : "UserFTest1",
"LastName" : "UserLTest1",
"DOB" : "01/01/1990",
"Address1" : "1234, TestAddress1"
"Address2" : "Test Address1",
"City" : "TestCity1"
"County" : "TestCounty1",
"State" : "TestState1",
"Country" : "TestCountry1",
"Landmark" : "Test Landmark1"
"Username" : "TestUname1",
"Password" : "TestPass1",
"ConfirmPassword" : "TestConfirmPass1",
"SecretQuestion1" : "TestBirthCity1",
"SecretQuestion2" : "TestMiddleName1",
"SecretQuestion3" : "TestSchoolName1",
}
]
FeatureFile:
**@datafile:src/test/resources/data/testdata.json**
**Scenario Outline: User registration**
Given the user on the application **"<Url>"**
And user fills all user registration details
StepDef File:
@And("user fills all user registration details")
@QAFTestStep(description = "user fills all user registration details")
public void user_fills_registration_details() throws InterruptedException {
String firstName = **Need logic to get the FirstName**;
String lastName = **Need logic to get the LastName**;
String DOB = **Need logic to get the DOB**;
}
Can you please provide solution to get the data in the stepdef without passing as parameters