cancel
Showing results for 
Search instead for 
Did you mean: 

How to access an array list

SOLVED
Highlighted
Occasional Contributor

How to access an array list

an array list variable is declared in the setup script of a test case. To use this list variable in other test steps of this test case, what is needed to do?

Thanks for any answer!

Tags (1)
1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Hero

Re: How to access an array list

@wdbian 

 

Your question made to create this sample project hosted on github

This smaple project has multiple sample test cases.

Hope you may find it helpful.



Regards,
Rao.

View solution in original post

9 REPLIES 9
Highlighted
Community Hero

Re: How to access an array list

Is it possible to show the line of code how did you do that?

And in which type of test step is the value required? And in how many such steps the same is needed?


Regards,
Rao.
Highlighted
Occasional Contributor

Re: How to access an array list

screenshot.jpg

Actually I want to load external data to a list in the test case setup script, then use this list in the "Groovy Script - Data Source" step. But it seems that the variable declared in setup script cannot be accessbile from test step. 

Highlighted
Community Hero

Re: How to access an array list

If that is to be accessed in the groovy script, then there are two ways:
1. Using context variable. However this works only if the test case is run at one. i.e., it won't work if you run the step separately
2. Using custom property. Add the data as string (which might read it as string from source as well) and access that property in groovy step and have the logic to convert the string to list.


Regards,
Rao.
Highlighted
Community Hero

Re: How to access an array list

@wdbian 

 

Your question made to create this sample project hosted on github

This smaple project has multiple sample test cases.

Hope you may find it helpful.



Regards,
Rao.

View solution in original post

Highlighted
Community Leader

Re: How to access an array list

@wdbian 

 

The best way is to store the list value in custom properties at TestCase level or store it in Properties step in your testcase.

 


Click "Accept as Solution" if my answer has helped, and remember to give "kudos" 🙂 ↓↓↓↓↓



Thanks and Regards,
Himanshu Tayal
Community Hero

Re: How to access an array list

Hope you are aware that properties only supports string type.


Regards,
Rao.
Highlighted
Occasional Contributor

Re: How to access an array list

I have awared of that. thanks!

Highlighted
Community Hero

Re: How to access an array list

Sorry didn't get you.

Has the sample project helped to resolve the issue? You may consider accepting the solution provided.


Regards,
Rao.
Highlighted
Community Hero

Re: How to access an array list

@wdbian 

Marking this has solution. If you have questions, please feel to reply.



Regards,
Rao.
New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors