Is it possible to use values from my Azure Key Vault in a Specflow feature file's example table?

Viewed 30

My Feature file looks like this:

Feature: Login

Scenario Outline: a <role> User Logs In
    Given an admin user navigates to the home page
    And logs out if they are already logged in
    When <role> User enters login credentials of <username> & <password>
    Then they are logged in successfully
    And presented with <role> UI

    Examples:
        | role             | username             | password         |
        | User1            | {U1keyVaultUsername} | {U1keyVaultPass} |

The LogIn credentials for the users are stored in an Azure KeyVault. I would like to populate the login credentials with the values from the KeyVault

[When(@"(.*) User enters login credentials of (.*) & (.*)")]
public void WhenUserEntersLoginCredentials(String role, String username, String password)
{
    Console.WriteLine("Entering Username/Email...");
    this._driver.FindElement(this._userNameTextField).SendKeys(username);
            
    //Find element Id of "password" textbox & enter password
    Console.WriteLine("Entering Password...");
    _driver.FindElement(this._passwordTextField).SendKeys(password);

    Console.WriteLine("Clicking Sign In...");
    _driver.FindElement(this._submitLoginBtn).Click(); 
}
0 Answers
Related