Reputation: 105
Thank you in advance for help.
I am trying to create variable in env.rb
File_path =("#{File.dirname(__FILE__)}/../../features/TestData/Testdata.html")
and call File_path in the Cucumber feature directly.
for example
...
And I upload a file from path "<File_path>"
...
Is the is a better way of doing this ?
Upvotes: 1
Views: 802
Reputation: 35453
Yes, there's a better way.
In your feature text, use meaningful names instead of file paths.
For example, any of these, depending on your goal:
And I upload a file of test data
And I upload my web page
And I upload some previously saved information
Then put the file path in your step file.
In general, feature descriptions should be plain language, not source code, file paths, env vars, etc
Upvotes: 3