Solved

It it possible to buffer a random generated number in API request ?

  • 4 March 2024
  • 3 replies
  • 31 views

Badge

Hi,

i found this topic… 

 

But this is not the solution for my problem.

My problem is following:

I create a random number with syntax {RND[8]} as value in my API request testcase.

So it works and the random number is generated.

 

But I need to buffer this random generated value for a later testcase.

When I create a Buffer for this testcase

And I start the request, then Tosca give me an error back.

My question is, how can I generate a random number and buffer this value in one step?

Or is there another solution to my problem?

 

I hope you can help me.

BR Franz

icon

Best answer by brendon.russell 4 March 2024, 20:09

View original

3 replies

Userlevel 3
Badge +1

Hi,

i found this topic… 

 

But this is not the solution for my problem.

My problem is following:

I create a random number with syntax {RND[8]} as value in my API request testcase.

So it works and the random number is generated.

 

But I need to buffer this random generated value for a later testcase.

When I create a Buffer for this testcase

And I start the request, then Tosca give me an error back.

My question is, how can I generate a random number and buffer this value in one step?

Or is there another solution to my problem?

 

I hope you can help me.

BR Franz

I’m not sure if it’s possible to achieve this in one step.

What I would do is use TBox Set Buffer to generate the random value first. Then use the buffer value in the API request step.

Badge

Hi Brendon, thank you for your support. It works fine.

TBox Set Buffer…. 

Oh my God. I'm wondering why I didn't think of this solution 🤔

Userlevel 3
Badge +1

Hi Brendon, thank you for your support. It works fine.

TBox Set Buffer…. 

Oh my God. I'm wondering why I didn't think of this solution 🤔

No problem! With a UI test you can certainly use the solution you were attempting, e.g. enter a dynamic value into a text box then immediately buffer it. But I’ve found I prefer the TBox Set Buffer solution anyway - I like to define any such dynamic values at the beginning of the test (under the Preconditions folder) since I find them easier to maintain and reuse that way.

Reply