Forum Discussion

wdbian's avatar
wdbian
Occasional Contributor
5 years ago

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!

  • 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.

  • nmrao's avatar
    nmrao
    Champion Level 3

    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.

    • nmrao's avatar
      nmrao
      Champion Level 3

      wdbian 

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

  • nmrao's avatar
    nmrao
    Champion Level 3
    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?
    • wdbian's avatar
      wdbian
      Occasional Contributor

      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. 

      • HimanshuTayal's avatar
        HimanshuTayal
        Community Hero

        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.