This is a migrated thread and some comments may be shown as answers.

Numeric Textbox

4 Answers 104 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Natasha
Top achievements
Rank 1
Natasha asked on 18 Nov 2011, 05:23 PM
Hi,
I need to know how test a numeric TextBox. This control is customized.
Test Studio generated the next code: "Pages.CmNavigo.SilverlightApp.Numerictextbox.SetText(true, "4", 10, 100, false);" Converting the number 4 to string therefore the test fails.
Thanks

4 Answers, 1 is accepted

Sort by
0
Anthony
Telerik team
answered on 18 Nov 2011, 11:53 PM
Hi Natasha,

How does the test fail? Using the Export Result To File feature from the Step Failure Details is the best way to give us that information.

Is the text box programmed to only accept numbers? Can you provide a public site that demonstrates the issue so we can see the issue first-hand? 

Greetings,
Anthony
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Natasha
Top achievements
Rank 1
answered on 21 Nov 2011, 12:05 PM

Hi Anthony,

The problem is that the tool didn’t recognize that the test had failed as it considered the inserted number without any problem. I think the setValue method converts the number to the string and when the test runs, it doesn’t run exactly as expected because when the Test Studio tries to insert a string, my control doesnt accept and the number never shows up.

Yes, my control only accepts numbers. I prefer not to send you my control because it is confidential. However, I tried to test your control MaskedInput and that gave me the same problem.

I see a possible solution here (LINK) but I wasn’t able to and I don’t know how to  include dll in my project and use library system.windows.control.

I look forward to your prompt reply.

0
Shashi
Top achievements
Rank 1
answered on 21 Nov 2011, 01:39 PM

Natasha,

 

I was the one who posted the issue at the link you provided below.  I can report that the workaround provided by Stoich in that post worked well for us.  I subsequently tried the suggestion in his last post when we ran into the same issue in another place - and that worked as well.  Obviously, the second solution is better (if it works) as it involves zero coding and is not dependent on the value that is to be typed in.

To answer your question, System.Windows.Forms.dll is located at C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.Windows.Forms.dll.  To add it to your project, right mouse on References node (in the project that contains your test), select Add Reference ..., click Browse tab, navigate to the location of the DLL and select it.  These instructions assume that you are using Visual Studio 2010 with .NET 4 installed - process for older versions of VS should be similar if you make the necessary changes to the location.
  
Hope that helps,

Shashi

0
Accepted
Anthony
Telerik team
answered on 21 Nov 2011, 05:30 PM
Hello Natasha,

Thank you for providing the test files that demonstrate the issue.

Shashi's instructions for adding an assembly reference are for the Visual Studio plugin. If you're using Test Studio Standalone version, follow this guide. You'll add the following file:

  • C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client\System.Windows.Forms.dll

First add the above assembly reference to your project. Then load the test and disable all steps except the Navigate to and the coded step. Change its code to this:

Pages.TelerikMaskedInputFor.SilverlightApp.Item6Radmaskedtextinput.User.Click();
Manager.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.D1);
Manager.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.D2);
Manager.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.D3);
Manager.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.D4);
 
Pages.TelerikMaskedInputFor.SilverlightApp.Item4Radmaskedtextinput.User.Click();
Manager.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.D5);
Manager.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.D6);
Manager.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.D7);
Manager.Desktop.KeyBoard.KeyPress(System.Windows.Forms.Keys.D8);


Regards,
Anthony
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Natasha
Top achievements
Rank 1
Answers by
Anthony
Telerik team
Natasha
Top achievements
Rank 1
Shashi
Top achievements
Rank 1
Share this question
or