Ask a Question

Use of Datasource step to get value from excel sheet


Use of Datasource step to get value from excel sheet

I have a specific requirement like below


I have an excel sheet which contains 150 tokens, I want to use that tokens only once since its non-reusable again, My test case also doesn't runs into a loop.


How can I get different value every time from data-source and how can we make sure that once all tokens are used , data-source doesn't provide me the used token. Is there any pointer to maintain which data was used last? 


def x= context.expand( '${DataSource#x}' ) x
//testRunner.testCase.setPropertyValue("xx", x)

testRunner.testCase.getTestStepByName('DataSource').next(testRunner, context)


I'm using this code as of now which gives me new value of x.

SmartBear Alumni (Retired)

Hi Henil,


Thank you for posting on our forum.


If I understand your requirement, Datasource loop is the best option you have. The loop goes through the value only once and when it reaches the 150th value in your excel sheet the loop automatically stops.


To test, just try it with first ten values, check the transaction log once you run the test case. It should provide you with the passed tokens information.


If this doesn't help, please open a support ticket, I can investigate further on your issue.







Did my reply answer your question? Give Kudos or Accept it as a Solution to help others.↓↓↓↓↓
Frequent Contributor

You can specify start and end row. Also add rows per iteration as 1.

If does not work, I would suggest using notepad with comma separated data.. that works better






Pattern works for me

Hi Lakshmi,


The requirement is not about the loop since I'll be using that token once per day only, when I come back to work on next day and re-open the project, it should start from token no.2. That is the scenario I'm facing right now.

Showing results for 
Search instead for 
Did you mean: