Looking for a way to have some more nice aligned output on Robot Framework (set test message or log). Here's the example on how I done it on python:
print "%-12s" % "received:", "%-5s" % 1323
print "%-12s" % "sent:", "%-5s" % 123
Output:
received: 1323
sent: 123
Is it possible to do the same on Robot Framework?
Currently my code is:
Set Test Message received: ${rx}\nsent: ${tx}
and my output is like this (2 examples with different values):
received: 847383
sent: 9511
received: 4814
sent: 9511111
My expected output should be
received: 847383
sent: 9511
received: 4814
sent: 9511111
or
received: 847383
sent: 9511
received: 4814
sent: 9511111
You can use the Evaluate keyword to run a short snippet of python code to format the string. Here's a keyword that does that for you:
*** Keywords ***
Record sent and received
[Arguments] ${sent} ${received}
${message}= Evaluate
... "%-12s %s\\n%-12s %s\\n" % ('received:', '${received}', 'sent:', '${sent}')
set test message ${message}