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

How to do Field Level Validation

1 Answer 81 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
jay
Top achievements
Rank 1
jay asked on 17 Dec 2014, 11:33 AM
Hi there,

My scenario is : To validate each fields in my application with both positive and negative data.Additionally the validation result will be stored on the excel file.

I have recorded those controls and its working even in play back.

I have a first name field(a text box)  ,i supposed to give both negative and positive data's from excel file.

The alert box will be appear, if we entered a negative data.

I have validated the fields with negative data by using code :

            if (ActiveBrowser.ContainsText("Please Enter Valid FirstName")) // Please enter valid firstname - is a alert box text
            {
                Worksheet.Cells[Data.IterationIndex + 2, 4] = "Please Enter Valid First Name"; //storing result in excel
            }
            else
            {
                Worksheet.Cells[Data.IterationIndex + 2, 4] = "error";
            }
 
Its working for the negative data's alone,not for the positive data.

How do i validate fields with positive data? Please Help me on this ...

I have enclosed a sample screenshots for your reference.

1 Answer, 1 is accepted

Sort by
0
Konstantin Petkov
Telerik team
answered on 22 Dec 2014, 08:31 AM
Hi,

Your approach seems to be based on the text in the browser, which is probably easier but too limited approach. I'd recommend trying another approach - validation based on elements, which Test Studio is pretty powerful with. One can give the Test Studio recorder a try and record verifications based on the highlighted element or if you prefer coded solution find your elements dynamically. For reference please take a look at the links below and let us know if you need further assistance.

Getting started with test recording
Test Studio Verifications
Recording Quick Verifications

Regards,
Konstantin Petkov
Telerik
 
Quickly become an expert in Test Studio, check out our new training sessions!
Test Studio Trainings
 
Tags
General Discussions
Asked by
jay
Top achievements
Rank 1
Answers by
Konstantin Petkov
Telerik team
Share this question
or