I'm trying to understand how to use the background feature in cucumber. My current understanding is that it's used as something that happens before every Scenario. But I don't really understand it. Consider the following example:
Background:
Scenario: Get user login
Given That there exist a file for user credentials
Then fetch the credentials.
So before I do my test I want to get the user credentials for a file. Then I want to run my test
Scenario: Test the user login function
When A user wants to log in with there stored credentials
Then Check if their username and password is valid
So, in short, this is what I would like to do. However, when writing this test, since they're different scenarios the second test will only show username and password as null. So what is the point of the background feature if I can't use the assigned values from the variables in that test?