Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4084678
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:28:15+00:00 2026-05-20T18:28:15+00:00

Would it be possible to pass a list in the testNG parameters. Below is

  • 0

Would it be possible to pass a list in the testNG parameters. Below is sample code

Example: Trying to pass list of numbers in XML. Not sure if TestNG does not support this feature. Or am i missing anything?

 <suite name="Suite" parallel="none">  
     <test name="Test" preserve-order="false">  
         <parameter name="A" value="1"/>   
         <parameter name="B" value="2"/>   
         <parameter name="C" value="3"/>   
         <parameter name="D" value="{4,5}"/>   
         <classes>  
             <class name="TestNGXMLData"/>  
         </classes>  
     </test>  
 </suite>  

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.thoughtworks.selenium.Selenium;
import static org.testng.Assert.assertTrue;
import org.testng.annotations.*;
import com.thoughtworks.selenium.*;

public class TestNGXMLData {

    @Test
    @Parameters(value = { "A", "B", "C", "D" })
    public void xmlDataTest(String A, String B, String C, ArrayList<String> ls) {

        System.out.println("Passing Three parameter to Test " + A + " and " + B + " and " + C);

        Iterator it = ls.iterator();
        while (it.hasNext()) {
            String value = (String) it.next();
        }
    }
}

Thanks,
Siva

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T18:28:15+00:00Added an answer on May 20, 2026 at 6:28 pm

    You can only pass basic types like this, so you should declare your last parameter as a “String” and then convert “{3, 4}” to a List. I suggest using “3 4” instead and simply parse it with String#split.

    If you want to pass more complex parameters and you don’t want to bother with converting, switch to using a @DataProvider.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to implement EventArgs to pass a list of parameters to my messaging
I would like to know if it's possible to pass a parameter to a
I was wondering if it would be possible to retrieve the complete list of
I would like to know how I can pass a list with values in
Is it possible to pass a list constructor parameter when resolving a type? I
Is it possible to pass regular expression to the list of allowed html attributes
How do I pass 2 lists into Parallel.ForEach ? Example: List<Person> a = new
Any other tweaks for making emacs as vim-like as possible would be appreciated as
Hey, I'm just wondering if it would be possible to convert videos to mp3
Would it be possible to print Hello twice using single condition ? if condition

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.