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

[Solved] Passing only when certain events happen

3 Answers 17 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.
James Cook
Top achievements
Rank 1
James Cook asked on 10 Aug 2009, 10:15 PM
Hello

I'm having problem finding this in the documentation and might be looking in the wrong area and need some help.

I'm just testing this software out and trying to do some very basic tests - mainly I want to login with an account and verify that the login was successful.

I've written the login successfully, that works. However, if I put in bogus username and password the login fails, but the test will still pass. I'm having a hard time finding if there's a way that I can check to verify that the page hit is the correct page (such as making sure the URL matches up).

Any help would be appreciated, thanks!

3 Answers, 1 is accepted

Sort by
0
Missing User
answered on 11 Aug 2009, 02:38 PM
Hello James,

Is there something on the page after a successful or failed login attempt that you can verifiy? Here is a video for reference on verification in WebUI that you could add that would pass/fail depending on the login outcome.

Or if there is a redirect, the next test step after the login process you could create would be on the redirect page. And if the login fails, then the following step on the redirect would also fail. To simplifiy this further, you could create the login as a 'Test as a Step', described in this video, to add to your other tests so that the first step will fail after the login.

As far as direct URL verification, WebUI navigates to the URL that is entered manually or via data binding set to multiple URLs without any type of verification, all verifications instead done against the page itself. In the case of a login/redirect, direct URL verification would be a better indication and I'll add that as a feature request. Thanks for the feed back.

Kind regards,
Nelson Sin
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
James Cook
Top achievements
Rank 1
answered on 11 Aug 2009, 04:14 PM
Thanks for the help, however, I'm trying to do this from a code perspective (using C#).

I had an idea to verify that there is a logout link on the page (since it only shows if you are logged in) as a way of verification. There's probably a better way to do this but just trying to get my feet wet.

How do I check in the content of the page to see if a logout hyperlink is there? I'm assuming I use the Assert class but not sure how to go beyond that.

I have to apologize - I'm fairly new to coding as well.
0
Missing User
answered on 11 Aug 2009, 05:18 PM
Hi again James,

You can convert any of the verification steps that you added in WebUI to C# code. As described in the verification demo video, if you add a quick verification step using either a 'Verifiy' or 'Wait for' -> 'Element is Visible' on the hyperlink, you can then right click on that test step and select 'Convert to Code'.

From here you'll see the C# implementation of that step using the underlying WebAii Framework. You can then add custom code based on this generated code to do further testing depending on what you wanted to do. You can find references and examples on the WebAii Framework here and a demo on adding custom code in WebUI here.

If you have any questions on the WebAii framework, you can try searching or posting to this forum or replying back with any further questions

Best wishes,
Nelson Sin
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
General Discussions
Asked by
James Cook
Top achievements
Rank 1
Answers by
Missing User
James Cook
Top achievements
Rank 1
Share this question
or