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 6975039
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:19:00+00:00 2026-05-27T17:19:00+00:00

Is there an accepted way (or code already written) to input complex data to

  • 0

Is there an accepted way (or code already written) to input complex data to TestNG from external file(s)?

For example, using TestNG and HTMLUnit, I might want to define a bunch of URLs, and custom Xpath tests in either a separate XML file, or in the testng file, extract it and then use it as a dataProvider.

For example inputing this file to testNG (either as a separate file, or as part of testng.xml):

<pages>
   <url value="http://www.bar.com">
       <element-exists>
           <xpath>//div[@class='baz']</xpaths>
           <xpath>//div[@class='bat']</xpath>
       </element-exists>
   </url>
   <url value="http://www.bar.com/foo">
       ...
   </url>
</pages>

Would tell my tests to run against bar.com and bar.com/foo, running some element-exists assertions against the pages. Possible? If so, how? I understand using dataProviders to parameterize tests and using @Factory to conditionally create test cases, but how to get TestNG to read the input? Any best practices are appreciated.

  • 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-27T17:19:00+00:00Added an answer on May 27, 2026 at 5:19 pm

    Read the data in your @DataProvider and feed it in your test method, which will receive this data as parameters. It should be quite straightforward.

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

Sidebar

Related Questions

Is there a way to convert from System.Windows.Forms.HtmlElement to mshtml.IHTMLElemenet3? --edit after answer accepted
Is there a best practice or widely accepted way of structuring and validating data
Is there an accepted way of performing (pinch) zoom on a view that is
There doesn't seem to be an accepted way of sending down a header parameter
Is there an easy (or generally accepted) way to load up a binary column
when using either the '.', '->' or '->*' operators is there any way of
A generally accepted way to pass all data to a view is to have
I'm currently using the following XAML code to add my xml file as a
Is there a built in method, function, API, commonly accepted way, etc. to dump
Is there an accepted/expected best-practice way to encapsulate the model portion of ASP.NET MVC

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.