Any tips how to write testcases for credentials?

Hi there,

I am writing a unit testcase for a workflow that uses multiple GetAsset and GetCredential, returning as output arguments strings, NetworkCredential and SecureString .

What are good ways to use the Testing activities “Verification” to check for successful retrieval?

  • I can “verify Expression with Operator” the assets as Inequality with String.Empty
  • also “verify Expression with Operator” a username, again as Inequality with String.Empty

But how to check a SecurePassword property, or a SecureString?

Because when I instantiate a New NetworkCredential and access the .Password, then the content gets logged out! scary

I tried comparing against Nothing and such, but cannot come up with a working assertion.

Hi there,

In an environment with a minimum length for a password, you can check if the secure string is Nothing, you can also check the size of the secure string if at least it is greater or equal to the minimum accepted password length.

  • IsNothing(SecureString)
  • (SecureString.Length >= 8)
1 Like

Ah, nice! I was close, but needed your help. Thanks!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.