neliCZka neliCZka - 2 months ago 23
Python Question

Robot framework - generate random data

I have a problem with generating the random string in robot. I am very new in robot and really dont know how to figure it out..
I found some solutions here and I tried to follow then, but I am doing something wrong obviously..
I got this error message in console: No keyword with name '${random_string} = Generate Random String' found.
My test case:

*** Settings ***
Library String
Resource resource.robot

*** Test Cases ***
Add New Project
${random_string} = Generate Random String 12 [LOWER]
Fill In Project Mandatory Fields ${random_string} descriptiondunno
Verify Added Project
[Teardown] Close Browser

In the resource file I have defined the keywords I am using in test:

Fill In Project Mandatory Fields
[Arguments] ${random_string} ${description}
Wait Until Element Is Visible ${PROJECT TITLE}
Input Text ${PROJECT TITLE} ${random_string}

and also:

Verify Added Project
[Arguments] ${random_string}
Click Element ${PROJECTS}
Table Should Contain ${GRID} ${random_string}

I really appreciate any help, because I am really lost in this now :(


What are you using as a separator? Just spaces? If so, maybe increase to using four spaces to clearly separate things

Based on the error it seems to think ${random_string} = Generate Random String 12 [LOWER] is a keyword, this is not what you want, you only want it to consider Generate Random String a keyword.

Try the below and let us know what happens:

${random_string}=    Generate Random String    12    [LOWER]