Need a help in printing the text with specific color/background in the robot test result file log.html / result.html

663 views
Skip to first unread message

Dinesh Krishna Bhatta

unread,
Sep 23, 2019, 5:17:42 PM9/23/19
to robotframework-users
Hello,

i want to print some specific texts highlighting them with different color/background . I could able to write the robot script and when i run it, it will show the results on the console with the specific color chosen. But, this is not displaying with the same color in the log.html result file. Can someone help on this?

Copying the script snipped here for your reference:
*** Settings ***
Documentation     Test Suite for OPNFV Verification Program test scenarios


*** Variables ***
${WHITE}       "\\033[7m"
${GREY}        "\\033[5m"
${UNDERSCORE}  "\\033[4m"
${RED}         "\\033[31m"
${REDBK}       "\\033[41m"
${BLUE}        "\\033[34m"
${GREEN}       "\\033[32m"
${YELLOW}      "\\033[33m"
${PINK}        "\\033[35m"

*** Test Cases ***
Text color tests
    ${message}=  Evaluate  ${WHITE} "\\nThis is WHITE bagkground Text\\033[0m\\n"
    Log To Console  ${message}
    ${message}=  Evaluate  ${GREY} "\\nThis is GREY bagkground Text\\033[0m\\n"
    Log To Console  ${message}
    ${message}=  Evaluate  ${REDBK} "\\nThis is RED bagkground Text\\033[0m\\n"
    Log To Console  ${message}
    ${message}=  Evaluate  ${UNDERSCORE} "\\nThis is UNDERSCORE bagkground Text\\033[0m\\n"
    Log To Console  ${message}
    ${message}=  Evaluate  ${RED} "\\nThis is RED Text\\033[0m\\n"
    Log To Console  ${message}
    ${message}=  Evaluate  ${BLUE} "\\nThis is BLUE Text\\033[0m\\n"
    Log To Console  ${message}
    ${message}=  Evaluate  ${GREEN} "\\nThis is GREEN Text\\033[0m\\n"
    Log To Console  ${message}
    ${message}=  Evaluate  ${YELLOW} "\\nThis is YELLOW Text\\033[0m\\n"
    Log To Console  ${message}
    ${message}=  Evaluate  ${PINK} "\\nThis is PINK Text\\033[0m\\n"
    Log To Console  ${message}

robot_highlighting_result.jpg

hari kiran vankayala

unread,
Sep 23, 2019, 8:46:50 PM9/23/19
to dineshbh...@gmail.com, robotframework-users
Try log instead of log to console

--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/robotframework-users/bd3dcb6f-95ab-4a98-bd46-6be6525aef42%40googlegroups.com.
--
Thanks & Regards, Hari.
Reply all
Reply to author
Forward
0 new messages