Micro Focus QTP (UFT) Forums
changing the font color of text of object column in resultdetails page in test result - 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: changing the font color of text of object column in resultdetails page in test result (/Thread-changing-the-font-color-of-text-of-object-column-in-resultdetails-page-in-test-result)

Pages: 1 2


changing the font color of text of object column in resultdetails page in test result - prodipto_dutta - 04-12-2011

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..








RE: changing the font color of text of object column in resultdetails page in test result - PrabhatN - 04-12-2011

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!



RE: changing the font color of text of object column in resultdetails page in test result - basanth27 - 04-12-2011

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?


How to open Telnet using qtp in windows7 os machine - Anilkumar - 04-13-2011

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


RE: changing the font color of text of object column in resultdetails page in test result - prodipto_dutta - 04-14-2011

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.


RE: changing the font color of text of object column in resultdetails page in test result - Saket - 04-14-2011

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.


RE: changing the font color of text of object column in resultdetails page in test result - prodipto_dutta - 04-14-2011

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.


RE:changing the font color of textofobject column in resultdetailspage in test result - atanu - 05-07-2011

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> "



RE: changing the font color of text of object column in resultdetails page in test result - Saket - 05-10-2011

I dont think that would be possible, pass the step name as plain text.


RE: changing the font color of text of object column in resultdetails page in test result - atanu - 05-10-2011

Thanks for your reply.
I used plain text as step name, but it didn't work.