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

Can a url be parameterized and verified?

3 Answers 95 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Y
Top achievements
Rank 1
Y asked on 17 Feb 2014, 09:30 AM
Hi, admin

   We do a POC recently, for more than 400 urls redirects validation.

  During the recording, it can catch the actual redirects url, eg.  'Navigate to : 'http://google.com/' ' 

  I want to parameterize the url ' 'http://google.com/'' to a variable named 'redirectUrl'

 And then verify the redirect Url  to the expectedRedirectUrl in the data excel.


Can the telerik current version implement it?


Looking forward to hearing from you.
Many thanks.

 
  

3 Answers, 1 is accepted

Sort by
0
Boyan Boev
Telerik team
answered on 18 Feb 2014, 02:34 PM
Hi,

Thank you for contacting us.

You can parametrize the URL into a variable with the following coded step:



Then you can compare it with the data from Excel again in a coded step:

Assert.AreEqual<string>(Data["nameOftheColumn"].ToString(), GetExtractedValue("redirectUrl").ToString());

Hope this helps.

Regards,
Boyan Boev
Telerik
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
0
Y
Top achievements
Rank 1
answered on 19 Feb 2014, 09:08 AM
Hi, Admin

  Thanks for you quick and detailed response, that's very helpful.

  As the POC scenario has more than 400 urls need to be validated,  each iteration run one different url.
  I'm not sure if the SetExtractedValue method can catch each url in each iteration, or just the the specific url in you steps.

 I refer to another thread in forum as below

SetExtractedValue("redirecteUrl",ActiveBrowser.Url)

It should catch the real-time url in each iteration,right?

And for the 2nd coded steps you created, can it be run directly? sorry for my little knowledge in coding.
There are compilation errors when i run directly (suppose the code is in VB)

"C:\Users\cyang087\Documents\Test Studio Projects\POC Testing\WebTest.tstest.vb: Line 105: (BC30516) Overload resolution failed because no accessible 'AreEqual' accepts this number of arguments.
C:\Users\cyang087\Documents\Test Studio Projects\POC Testing\WebTest.tstest.vb: Line 105: (BC32093) 'Of' required when specifying type arguments for a generic type or method.
C:\Users\cyang087\Documents\Test Studio Projects\POC Testing\WebTest.tstest.vb: Line 105: (BC30203) Identifier expected.

"

Can you help to figure out what i should do next?

Thanks .
0
Boyan Boev
Telerik team
answered on 24 Feb 2014, 10:29 AM
Hi,

Yes, ActiveBrowser.Url will catch the actual Url.

You should cast it to string:

SetExtractedValue("redirecteUrl", ActiveBrowser.Url.ToString());

Regarding your second question, no this is not VB it is C#.

In this particular step the difference is only in semicolon. There are no semicolons in VB.

Hope this helps.

Regards,
Boyan Boev
Telerik
The New Release of Telerik Test Studio Is Here! Download, install,
and send us your feedback!
Tags
General Discussions
Asked by
Y
Top achievements
Rank 1
Answers by
Boyan Boev
Telerik team
Y
Top achievements
Rank 1
Share this question
or