0

I am implementing UI tests with Silk4J. To log in I used the SetText() method until now. However, using a plain text password in my source code is not such a good idea.

Now I found that there is also SetPasswordText() [MicroFocus], which takes an encrypted password as parameter.

Unfortunately the documentation does not specify a way to convert my plaintext password into an encyrpted password. How can I do that?

I found a website mentioning a tool, but that tool does not exist on my machine. It also mentions an Encrypt() method, but for Java, I need at least a class name to access that method.

Thomas Weller
  • 55,411
  • 20
  • 125
  • 222
  • 1
    Why do you care about encrypting the passwords used in a test? Surely, you're testing on a test system that doesn't use the same passwords as your production system? – Philipp Reichart Feb 25 '15 at 13:32
  • 1
    @PhilippReichart: that's true, it is a test system and I don't use the password anywhere else. Still, it seems possible and it's always a good habit to do things right. – Thomas Weller Feb 25 '15 at 13:35
  • I agree with Philipp. Why is it right to encrypt test passwords? – Duncan Jones Feb 25 '15 at 15:15
  • @Duncan: if it's wrong to encrypt passwords, why did they implement such a method? If you can explain why it is wrong, maybe I accept that as an answer. – Thomas Weller Feb 25 '15 at 15:19
  • @ᵺṓᵯᶏᵴ Perhaps I've mistaken you. Are you wanting to convert your application code (also used in production) to use `SetPasswordText` rather than `SetText` or are we purely talking about test code here? – Duncan Jones Feb 25 '15 at 15:24
  • @Duncan: my code is test code only. Perhaps it is only curiosity why I'm asking the question. Maybe it's also useful for someone else who wants to use it in production code. – Thomas Weller Feb 25 '15 at 15:29

1 Answers1

3

There isn't any way in the UI to encrypt your password. You have two options:

  1. Record entering text into the password field. This will record the text entered using the setPasswordText() method, which you can copy and paste into your test.

  2. Write a short test that calls Agent.encrypt(). This will return the encrypted version of the text passed in. Copy the return value of this method into your original test.

Andy
  • 30,088
  • 6
  • 78
  • 89