Serial Number Generator
How to generate a series of positive integers?Howdy folks,
I'm writing soatest-cases for a set-of-webservices which implement a "logical conversation". I need to pass a unique conversationId (as a soap-header parameter) with each service request. At the moment I'm just choosing a random number between 1 and 10,000,000 for each scenario... but (now I'm upto over a hundred scenarios) finding & resolving the inevitable collisions is getting UGLY!
Please could anyone advise on How might I go about writing a serial number generator? I'm thinking of a python (or java) method which returns 1 the first time it is called, 2 the second time, 3 the third, and so on upto (2^31)-1... within an execution of my test-suit. Alternately, maybe the number of milliseconds since midnight (0..86,400,000) might be simpler? and do the trick just as well? Concurrency/contention is NOT an issue I think as the test-cases will allways be run synchronously, and by a single user at any one time.
I was thinking I'd save my serial-number in a soatest-variable, and then use it's value in the parameterised soap-header-parameter of each request within a scenario. Where/how could I call the serial-number-generator script at the start of each scenario? Is there a scenario-init method I can hijack, or would I need to manually retrofit every scenario with an initialisation-test-case.
I would appreciate any pointers in right direction. I shall undertake some heavy googling in meantime.
Cheers all, Keith.