Micro Focus QTP (UFT) Forums
Results based on iteration - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: Results based on iteration (/Thread-Results-based-on-iteration)



Results based on iteration - joncfrazier - 05-04-2012

I need to test a wide range of items. One of which is to see if certain links are hidden from certain users. I currently have the test running on iterations based on username/login. Any items not present report a warning.

Is there a method to compare iteration with the current action/test and provide a pass/fail report depending on which iteration?



RE: Results based on iteration - Shridevi.Salagare - 05-04-2012

Could you please provide some more information and whta exactly is the requirement.


RE: Results based on iteration - joncfrazier - 05-04-2012

User A logs in, verify links A, B and C exist, if they exist run a test specific to that link.
If they don't exist report failed (but continue testing)

User B logs in, verify that links A, C exist and B does NOT exist. Run test on existing links.
If A,C do not exist report failed
If B does exist, report failed (and possibly do not run test)


Rather than making a seperate test for each user, I'd like to parameterize the user login/pw.

Here is my current code, though it doesn't do what I want. Only reports a warning if links don't exist.
Code:
If Browser("...").Page("...").Link("...").Exist (1) THEN
    Reporter.ReportEvent micPass, "...", "Pass"
    Browser("...").Page("...").Link("...").Click
    RunAction "...[...]", oneIteration    
    Else
    Reporter.ReportEvent micWarning, "...", "...does not exist"
End If



RE: Results based on iteration - sshukla12 - 05-07-2012

Hi,
Find the attached document it might help u:
Let me know if I can help u further[attachment=981]

Regards,
Sankalp


RE: Results based on iteration - joncfrazier - 05-07-2012

Unfortunately I'm not able to download .doc files


RE: Results based on iteration - sshukla12 - 05-08-2012

[attachment=983][quote='joncfrazier' pid='20922' dateline='1336400614']


RE: Results based on iteration - joncfrazier - 05-10-2012

That's still a .doc file and I still can not download them (I'm behind a firewall that doesn't allow certain file types).

Anyway, I figured out the answer (I think):
Each link is done like this:
Code:
'before link these are added, where [linkname] is the term being defined for later (can be anything)
Iteration = DataTable.GlobalSheet.GetCurrentRow 'defines what Iteration is
If Browser("...").Page("...").Link("...").Exist (1) THEN [linkname] = True Else     [linkname] = False End if       'Defines a link true/false for quick referene later

'now for the link
If [linkname]= True Then
    If Iteration = 1 OR Iteration = 2 OR Iteration = 3 OR Iteration = 4 Then
        Reporter.ReportEvent micPass, "...", "Pass"
        Browser("...").Page("...").Link("...").Click
        RunAction "...", oneIteration
    ElseIf Iteration = 5 THEN
        Reporter.ReportEvent micFail, "...", "... exist for an invalid user"
    End If
End If

If [linkname]= False Then
    If  Iteration = 1 OR Iteration = 2 OR Iteration = 3 OR Iteration = 4 Then
        Reporter.ReportEvent micFail, "IQ24C", "IQ24C does not exist"
    ElseIf Iteration = 5 THEN
            Reporter.ReportEvent micPass, "...", "... does not exist"
    End If
End If

At least that's my theory, haven't tried it yet Smile Is there a more condensed way to do this? For several links this gets to be a long piece of code, though perhaps for my purpose it wouldn't make sense to shorten as each user (iteration) can contain different links.

edit: Previous code didn't actually solve anything and was just a rehash of what I previously did.


RE: Results based on iteration - sshukla12 - 05-10-2012

Gud, finally u come across a solution. that's great.

Regards,
Sankalp