1

I've built a draft collection for my microservice where i basically /insert a student, and after 15 minutes (external processing stuff time) i call the /get Student and the /delete student.

My idea is to make 3 different features, the /insert is executed first and inside there is a random function which assign a name (randomName ) to each student before inserting it.

After 15 minutes i want to call the /get and then the /delete but i need the randomName generated inside the first feature file.

I cant' use the standard approach of :

* def randomNameGenerated= call read('insertStudent.feature')

* def name= randomNameGenerated.randomName

because this recall the insert feature while i want to get the value of the last feature execution.

How can i replicate this behaviour without using a file for persist data and without declaring the 3 scenarios inside a single feature file?

Thanks

Zhaled Asufian
  • 87
  • 1
  • 1
  • 9

1 Answers1

0

Called features can update "global" data in shared-scope, use a JSON object as a "wrapper".

* def data = { name: '' }
* call read('called.feature')
* match data == { name: 'foo' }

Where called.feature is simply:

* data.name = 'foo'

If this doesn't work, last resort - write some Java code as a static / singleton.

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248