Search code examples
javajmeterbeanshell

BeanShell: String + function's value


Who can help me?

BeanShell:

  • Works:

    ${__setProperty(MyProperty, ${__UUID()})};
    

    Result: 3d63d204-ce35-4c82-9ac6-4479197f76c0

  • Doesn't work:

    ${__setProperty(MyProperty, ${__UUID()}+"Test")}; 
    

    Result: +Test

    Expectations: 3d63d204-ce35-4c82-9ac6-4479197f76c0Test

Oleg


Solution

  • In BeanShell, it's easier to do this:

    props.put("MyProperty", UUID.randomUUID().toString() + "Test");
    

    In your previous syntax though, don't add +, and it should work too:

    ${__setProperty(MyProperty, ${__UUID()}Test)}; 
    

    Otherwise, please show us which elemnt do you use to set it.