Using a config file to pass user credentials for login during test

3 posts, 1 answers
  1. Jessica
    Jessica avatar
    5 posts
    Member since:
    Aug 2017

    Posted 27 Oct Link to this post

    I currently have various tests, some of them use the login step where you can check encrypt and it will protect the password of the user used. I also have tests that are coded steps and I code the user and password to deal with the login. I would prefer to have a configuration file where I do the username and password as a configuration property that would be used to in the coded steps so that in the event of needing to change the user used for testing I wouldn't have to change it for all the steps. 

     

    First off I found the C:\Program Files (x86)\Telerik\Test Studio\Bin config file and I put the following in the configuration tags: 

     <configSections>
    <section name="users" type="[namespaceNameHere].UserConfigSection" />
      </configSections>
      <users>
        <add id="1" name="Automated Testing User" username="jessica.gonzales" password="AxkrhLLZjmWbai/5hpEJ6w==" />
    <!--<add id="2" name="[Username Description]" username="[username]" password="[safe password]"/>-->
      </users>

  2. Answer
    Nikolay Petrov
    Admin
    Nikolay Petrov avatar
    256 posts

    Posted 30 Oct Link to this post

    Hello Jessica,

    Thank you for this question. I could think additionally of two possible approaches to such scenario. First approach could be in a coded step to get the login information from external file that contains credentials and could be changed easily.

    Second approach could be to data bind login test to a xml data file for example that could be easily changed as well. 

    I hope this directions helps.

    Best Regards,
    Nikolay Petrov
    Progress Telerik
     
    The New Release of Telerik Test Studio Is Here! Download, install,
    and send us your feedback!
  3. Jessica
    Jessica avatar
    5 posts
    Member since:
    Aug 2017

    Posted 31 Oct in reply to Nikolay Petrov Link to this post

    Thank you Nikolay!

    I was making it too complicated, coming from a C# project perspective. The Data Bind step was exactly what I needed to do to accomplish the configuration file.

    Best,

    Jessica

Back to Top