문제

In robot framework I am loading a library as keywords.

Those keywords are methods in the library.

I know that I can send information directly to the Robot Framework Log file with a simple print statement.

But when my method creates a file, in the same directory as the Log file, how can I create a link to it in the log file?

Example:

Robot Framework file:

| *Setting* |
| Library | Testtools
| *Test Case* |
|                   | LogMe

Library file: TestTools.py

def LogMe(self):
    file = open('testfile.txt', 'w+')
    file.write("Line of text")
    file.close()
    print "The test file is found at http://testfile.txt"   #This line is where I need help

I need to know how to put a link to my freshly created file in the log that robot framework will create.

도움이 되었습니까?

해결책

Turns out to be very simple. Just by adding HTML to the printed string, robot framework will treat it as preformatted text.

All I need to do is change the last line of my code to this:

print "*HTML* The test file is found at <a href=testfile.txt>this location</a>"

And it all works.

Yah!

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top