I'm still pretty new to Cucumber automation testing and I haven't found anything about this in documentation, so I'm guessing either it's not possible or it's done in a very different way.
The thing is, in Robot automation framework I'm used to working with variables like this: ${userName} and once set these can be shared by different tests. Is that possible in cucumber?
The specific use case is: I'm using Java version of Cucumber, and I want to create a new user account that I'll use throughout all scenarios in the whole feature file:
Scenario: Create user account
Given user navigates to the home page
And user enters username and password *(this is where I want to provide random data and have it stored for future use)*
And user clicks on the register button
Then user should see the default landing page
I can always create a random user name and password in my test implementation using java and store them in class-scoped variables for future use in all steps that require them. But I'm not sure this is a good practice. Is there a better way to do so?