Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
changing the font color of text of object column in resultdetails page in test result
#1
Solved: 10 Years, 8 Months, 4 Weeks ago
need a urgent help

I am new to QTP.I want to know how to change the font color of a text dynamically and want to see object text in the specified color in the result details page in result viwer.

for example :

str = "this is a sample text"
// now change the font color of str ( "this is a sample text" - earlier it was balck but after changing dynamically color should be green or red )

// now i m using Reporter.ReportEvent

Reporter.ReportEvent micDone, str,"just checking the color of font color str"

so that in the test result I can identify pass or fail by seeing the font color of the text(which is present in object column in result details page in result viwer) as micDone does not specify any color in result details page.
is that possible through code that we can change the font color of text through QTP and pass it through Reporter.ReportEvent micDone?

If possible Please let me know how to do that.Please provide a solution or if it is not possible please let me know why?



Thanks in Advance..





Reply
#2
Solved: 10 Years, 8 Months, 4 Weeks ago
Prodipto,

There are micPass, micFail and micWarning as well under ReportEvent.

Why don't you press F1 while QTP is focused in your machine? I hope you understand!
Reply
#3
Solved: 10 Years, 8 Months, 4 Weeks ago
Prabhat -
The question is related to the color of text depending upon the event triggered and not about different events.

Prodipto -
I think it is impossible to alter the report viewer. There is a standard defined by QTP and i guess they wouldnt let you modify. I may be outdated, if you dont find a reasonable answer for your thread then you must call up HP and see if they can help you.
If i were you, i would do my custom reports to achieve my objective. Like htmlmor excel reporting are really tweakable, programmable and can be made colorful if thats what you are looking for Smile.
Makes sense?
Basanth
Give a fish to a man and you feed him for a day..Teach a man how to fish and you feed him for life.
Reply
#4
Solved: 10 Years, 8 Months, 4 Weeks ago
Hi,
I,m new to qtp and working on networking side .
Qtp not supporting Telnet on windows7,i tried with below code

Code:
Set objSh = CreateObject ("WSCript.shell")
objSh.Run "telnet 10.64.105.141"
wait(5)
objSh.AppActivate "telnet"
objSh.SendKeys "CISCO15"+chr(13)


this code working in windowsXp but i have w7 machine,So please Help me.

Thanks,
Anil.sp
Reply
#5
Solved: 10 Years, 8 Months, 4 Weeks ago
thanks for your reply.Even I feel that it wont possible.But wanted to take a chance if anybody did something like that earlier, can give some idea.nyways really thanks to you.
Reply
#6
Solved: 10 Years, 8 Months, 4 Weeks ago
Hi Prodipto,

see if this is what you are looking for. I usually change the color of pass/fail actual result depending on the status. I am using undocumented Reporter.LogEvent.

Code:
Function CustomResult(nStatus, sStep, sActual, sExpected)
        Set oEventDesc = CreateObject("Scripting.Dictionary")
        oEventDesc("ViewType") = "Sell.Explorer.2"
        oEventDesc("Status") = nStatus
        oEventDesc("EnableFilter") = False
        oEventDesc("NodeName") = sStep

        Dim sHTMLInfo
        sHTMLInfo = "<TABLE border='0'>"
        If nStatus = 1 Then
            sHTMLInfo = sHTMLInfo & "<TR><TD><font color='red' size='2'>Actual Result: " & sActual & "</font></TD></TR>"
        Else
            sHTMLInfo = sHTMLInfo & "<TR><TD><font color='green' size='2'>Actual Result: " & sActual & "</font></TD></TR>"
        End If
        sHTMLInfo = sHTMLInfo & "<TR><TD><font color='blue' size='2'>Expected Result: " & sExpected & "</font></TD></TR></TABLE>"
            
        oEventDesc("StepHtmlInfo") = sHTMLInfo
        newEventContext = Reporter.LogEvent ("Replay",oEventDesc,Reporter.GetContext)
End Function
        
If 5 > 6 Then
    CustomResult 1,"Check 5>6","5 is greater than 6", "5 should not be greater than 6"
Else
    CustomResult 0,"Check 5>6","5 is not greater than 6", "5 should not be greater than 6"
End If
see the snap attached for how it looks in the result viewer

let me know if this works for you.


Attached Files Image(s)
   

Reply
#7
Solved: 10 Years, 8 Months, 4 Weeks ago
Thanks Saket.It looks like the once what i wanted .Now I will use your code and If get into any problem while using your code i will inform you through this forum.
Reply
#8
Solved: 10 Years, 8 Months, 4 Weeks ago
Hi Saket,

Is it possible to remove the html tag from left pane of result page?I have attached the screenshot.I want only the object name("Custom Report Example")
For this I am using this code,
Code:
Function CustomReportEntry(strStatus, strStepName, strMessage)
            Set objDict = CreateObject("Scripting.Dictionary")
            objDict("Status") = strStatus
            objDict("NodeName") = strStepName
            objDict("StepHtmlInfo") = strMessage
            objDict("DllIconIndex") = 206
            objDict("DllIconSelIndex") = 206
            objDict("DllPAth") = "C:\Program Files\HP\QuickTest Professional\bin\ContextManager.dll"
            Reporter.LogEvent "User", objDict, Reporter.GetContext
End Function


CustomReportEntry micPass, "<font color='green' ><b>Custom Report Example</b></font> ", " <font color='green' ><b>This is a custom report entry!</b> </font> "


Attached Files Image(s)
   
Reply
#9
Solved: 10 Years, 8 Months, 4 Weeks ago
I dont think that would be possible, pass the step name as plain text.

Reply
#10
Solved: 10 Years, 8 Months, 4 Weeks ago
Thanks for your reply.
I used plain text as step name, but it didn't work.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Problems with Text color recognition Treirk 0 966 06-17-2019, 12:19 PM
Last Post: Treirk
  Getting background color of an object on mouse over Surya 2 3,707 06-27-2018, 08:51 PM
Last Post: vensas3181
  How can we get the Windows application Text box background color Using UFT 11.53 Kuppampattu 3 5,666 06-06-2017, 11:12 AM
Last Post: workrohit08
  SwfTreeview - Color validation for child item YogeshCallappa 0 2,055 11-10-2016, 04:55 PM
Last Post: YogeshCallappa
  Page element keep changing chong67 4 4,272 11-08-2016, 09:17 PM
Last Post: Paul Rammone

Forum Jump:


Users browsing this thread: 1 Guest(s)