WPF encoded UI test: encryption password read from the data source

I used Coded UI Test Builder to create a recorded action to enter user credentials into the login window. This initial recording hard-coded the encrypted password into the public domain
The Params object used by the test method , As shown below:

[GeneratedCode("Coded UITest Builder", "10.0.40219.1")]
public class StartOccUIParams
{

#region Fields
///
/// Type'username' in'usernameBox' text box
///
< br /> public string UIUsernameBoxEditText = "username";

///
/// Type'{Tab}' in'usernameBox' text box
// /

public string UIUsernameBoxEditSendKeys = "{Tab}";

///
/// Type'******** 'in'passwordBox' text box
///

public string UIPasswordBoxEditSendKeys = "9927b9lJLxdZrqR1G+zHC2MA==";
#endregion
}

< p>This is fine, but I need to retrieve the username and password from the CSV data source to test the failure situation. The question is, how do I convert the password retrieved from the CSV into an encrypted form that can be used with the password box? I checked SecureString, but it does not expose an API to get the encrypted string, and I doubt its format is correct.

var loginParams = UIMap.StartOccUiParams;
loginParams.UIUsernameBoxEditText = TestContext.DataRow["User"].ToString();
var password = TestContext.DataRow["Password"].ToString();

// how do I encrypt password to use below?
loginParams.UIPasswordBoxEditSendKeys = "encrypted password";

use Playback.EncryptText

Encrypts a given text for passing to playback as password property.

I used Coded UI Test Builder to create a recorded action to enter the user credentials into the login window. This initial recording hard-coded the encrypted password into the public domain.
The Params object used by the test method is as follows:

[GeneratedCode("Coded UITest Builder", "10.0.40219.1")]
public class StartOccUIParams
{

#region Fields
///
/// Type'username' in'usernameBox' text box
///

public string UIUsernameBoxEditText = "username";

///
/// Type'{Tab }'in'usernameBox' text box
///

public string UIUsernameBoxEditSendKeys = "{Tab}";

///
/// Type'********' in'passwordBox' text box
///

public string UIPasswordBoxEditSendKeys = "9927b9lJLxdZrqR1G+zHC2MA==";
#endregion
}

This is fine but I need to retrieve the username and password from the CSV data source to test the failure situation. The question is, how to convert the password retrieved from the CSV to be compatible What kind of encryption is used with the password box? I checked SecureString, but it does not expose an API to get the encrypted string, and I doubt its format is correct.

var loginParams = UIMap.StartOccUiParams;
loginParams.UIUsernameBoxEditText = TestContext.DataRow["User"].ToString();
var password = TestContext.DataRow["Password"].ToString();

// how do I encrypt password to use below?
loginParams.UIPasswordBoxEditSendKeys = "encrypted password";

Use Playback.EncryptText

Encrypts a given text for passing to playback as password property.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 4938 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.