code for create/confirm password issue

Mobile Testing, Android App Testing.
Styris
Posts: 49
Joined: Tue Feb 03, 2015 2:32 am

code for create/confirm password issue

Post by Styris » Thu Feb 05, 2015 9:17 pm

I have a couple things. On a mobile app I am trying to do a couple things here: There are two fields: Create password & Confirm password. they both need to be a minimum of 6 chars, and both need to match. I need to automation it so here is what I did

1. For the minimum 6 chars portion I tried this
if create_Password.SelectionLength < '6'
{
min_6_chars.Checked = "False";
}
else
{
min_6_chars.Checked = "True"
}


2. For the matching I tried this
if create_Password.TextValue.Equals confirm_Password.TextValue
{
passwords_must_match.Checked = "True";
}

else
{
passwords_must_match.Checked = "True";
}


Can anyoen tell me where I am wrong...or what I need to do instead. Would really appreciate it!

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: code for create/confirm password issue

Post by krstcs » Thu Feb 05, 2015 10:01 pm

Please provide more information:

What version of Ranorex are you using?
What mobile system (Android/iOS) is the app being tested on, and what version?

Please post a Ranorex Snapshot of the app in question, if possible, so we can see the structure and possibly help. You can find information on creating a Ranorex Snapshot here.

If you can't post it on the forums, you can also send the snapshot directly to the Ranorex Support Team at [email protected].

In addition, could you explain what you are attempting to accomplish and provide the Ranorex test code? Again, if you can't post it here, you can send it to support at the above email address.
Shortcuts usually aren't...

Styris
Posts: 49
Joined: Tue Feb 03, 2015 2:32 am

Re: code for create/confirm password issue

Post by Styris » Thu Feb 05, 2015 11:34 pm

Ranorex version: 5.2.2.21596 (Trail version)
Android version: 4.4.4


Plz find attached the ranorex snapshot
Attachments
shotcrpass.rxsnp
(71.99 KiB) Downloaded 61 times

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Re: code for create/confirm password issue

Post by Support Team » Fri Feb 06, 2015 2:14 pm

Hi Styris,

As krstcs already asked, could you please also explain what you are attempting to accomplish, please describe the use case?
This will help us helping you :).
It would also help us if you could add the RxPaths of the used elements to this thread, this helps us to understand which elements you use in your code.

Thanks,
Markus
.
Image

Styris
Posts: 49
Joined: Tue Feb 03, 2015 2:32 am

Re: code for create/confirm password issue

Post by Styris » Fri Feb 06, 2015 7:28 pm

Hi Markus,

I thought my initial post was pretty detailed in what I was trying to accomplish. However I can mention it again. I am trying to accomplish a couple things on the Create Password page
1. The create_Password should be at least 6 characters, and in that case the min_6_chars checkbox will automatically be checked.

2. The text value that the User enters in confirm_Password field should match the create_Password, and in that case the passwords_must_match checkbox will get checked.

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: code for create/confirm password issue

Post by krstcs » Fri Feb 06, 2015 7:39 pm

From what I am reading, you are detailing the requirements and the actions of the SUT, not what you, specifically, are trying to accomplish with your test case.

For example, are you wanting to validate that a value is set correctly, or that a checkbox is checked/unchecked, etc.?
Shortcuts usually aren't...

Styris
Posts: 49
Joined: Tue Feb 03, 2015 2:32 am

Re: code for create/confirm password issue

Post by Styris » Fri Feb 06, 2015 10:01 pm

Yes. I want to be able to automate (with code I guess) of what I detailed out. If the User enters a password that is < 6 in length then the first checkbox will not be checked - it will only be checked if password is at least 6 chars in length.

Also then I want to test that if the create and confirm passwords field that the user enters are the same..then the second checkbox gets checked; if those two fields do not have the exact same textvalues in it..then that checkbox won't be checked.

Styris
Posts: 49
Joined: Tue Feb 03, 2015 2:32 am

Re: code for create/confirm password issue

Post by Styris » Mon Feb 09, 2015 3:51 am

I think I got this for the most part
if (create_Password.SelectionLength.Equals(6))
{
min_6_chars.Checked.Equals("True");
}
else
{
min_6_chars.Checked.Equals("False");
}


if (create_Password.TextValue.Equals(confirm_Password.TextValue))
{
passwords_must_match.Checked.Equals("True");
}
else
{
passwords_must_match.Checked.Equals("False");
}

This should take care of most of it. My only problem now is that I only accoutn for =6. Really, I want to be able to say that if it is => 6...then True, else "False"

krstcs
Ranorex Guru
Posts: 2683
Joined: Tue Feb 07, 2012 4:14 pm
Location: Austin, Texas, USA

Re: code for create/confirm password issue

Post by krstcs » Mon Feb 09, 2015 5:50 pm

create_Password.SelectionLength should return an int.

You should be able to change it to this:

Code: Select all

if (create_Password.SelectionLength >= 6)
Shortcuts usually aren't...