1

I have to insert incremental values in a column of the table using Fitnesse. The incremental value I'll get from a stored procedure which returns the last inserted value. So I have to increment the value and store it.

For example: I'll get a value from the stored procedure output. And I have to increment the value by 1 and insert into the table.

Any ideas?

  • Output from stored procedure is like : ACRDE0001 (PK)
  • Value to store in table : ACRDE0002, ACRDE0003, .....

Expected output

!|insert|table1|
|col1|col2|col3|
|ACRDE0001|abc|def|
|ACRDE0002|abc|def|
|ACRDE0003|abc|def|
.
.
.
.
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Benny
  • 432
  • 1
  • 6
  • 21

1 Answers1

1

As far as I'm aware the only way to change (e.g. increment) a value you get during your test is by writing some code in a fixture. There is a pull request to allow more dynamic Slim expression directly in the wiki, but that has not been merged (let alone released) yet.

Your questions suggests that the value is something you get from a database and that you then want to send back the generated/incremented value with new records you insert. In that case I wonder whether the increment is actually that useful to actually have in your wiki (your test case is not about the generated values, is it?). Maybe your fixture could just retrieve the initial value (or have it supplied as constructor value) and the fixture could generate the a new value for each row and send them to the database.

Fried Hoeben
  • 3,247
  • 16
  • 14
  • thanks for responding. I will export multiple rows from excel. sometimes 10 sometime 30 it depends on the test. so all the time i cannot manually hardcode the PK data. my test case not about generate values. – Benny Jan 29 '18 at 05:46
  • I was not thinking of hard coding but having Java (or whatever language you use for your fixture) generate the numbers. If you have the rows in Excel, why don't you generate the numbers there. – Fried Hoeben Jan 29 '18 at 06:03
  • i am not good in java. can u post a sample java code for the above dynamic value generation. it will more helpful.Cause in java we can generate dynamic value but don't know how to print while inserting. thanks in advance. – Benny Jan 30 '18 at 04:50
  • I won't write the fixture for you. What code are you using in the sample above, who wrote that? Maybe they can help you add this feature. – Fried Hoeben Jan 30 '18 at 06:58