Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Negative Tests - Checking for links which should NOT be present.
#1
Solved: 11 Years, 4 Months, 4 Weeks ago
I am total newbie and I am playing with QTP and I would like some help. I am running some tests on a website. The website has a logon with different classes of user. An "Admin" user has access to a host of links which enable the administration of the site, a "ReadOnly" user has a limited number of links available. Once logged in as a "ReadOnly" user how do I check that the links which are available to an "Admin" user are NOT available to a "ReadOnly" user ?

I have set up some standard checkpoints on the additional links when logged in as "Admin" but when I use these same checkpoint when logged in as "ReadOnly" it complains the object is not available.

What is the best way to test this scenario ?

Any help would be appreciated.
Reply
#2
Solved: 11 Years, 4 Months, 4 Weeks ago
You will have to use object.Exist to check if the perticular link object exist or not.
Reply
#3
Solved: 11 Years, 4 Months, 4 Weeks ago
Ok so how would I make the test fail ? For example the following link should NOT exist when logged in as "ReadOnly" user

Code:
Browser("My Web").Page("Reporting").Link("Update and Check").Exist

so how would I code it ?
Reply
#4
Solved: 11 Years, 4 Months, 4 Weeks ago
I resolved my problem

Code:
IF  Browser("My Web").Page("Reporting").Link("Update and Check").Exist(4) THEN
    reporter.ReportEvent micFail, "Admin Links", "Admin Links should only be available for Admins"
ELSE reporter.ReportEvent micPass, "Admin Links", "This is correct as no Admin Links are available"
END IF

I am using QTP 9.5, If anyone knows of a better way of doing this please let me know.

Thanks
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Adding negative amount in webedit Rose 1 2,197 06-30-2016, 09:34 PM
Last Post: babu123
  [UFT] Fixed web tests with dynamic parts jdd 3 2,679 04-05-2016, 02:56 PM
Last Post: vinod123
  How to check expected cookies are present or not priyanka.agarwal 0 2,008 07-02-2015, 12:43 PM
Last Post: priyanka.agarwal
  This code does not give total no of links present on page plz help it returns 0 excellentpawan 8 5,725 01-17-2015, 07:49 PM
Last Post: yogi4tech
  how to get a link present under mouseover action priyadarisini 1 2,358 12-03-2013, 08:59 PM
Last Post: Parke

Forum Jump:


Users browsing this thread: 1 Guest(s)