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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:51:09+00:00 2026-05-13T16:51:09+00:00

Here is my situation. Before my tests are run, in the beforesuite, I instantiate

  • 0

Here is my situation.

Before my tests are run, in the beforesuite, I instantiate a bunch of “environment objects” These objects get created based on my environment configuration file. It is my tests that will actually be using these environment objects. The problem is how can I pass them to the tests.

Your first impulse might be to use a data provider, which will pass the correct objects to the test. The problem is that the data provider will have to know how to refer to the correct objects and then pass them. As it stands now the environment objects can only be referred to by name (string -> object)

My other option is to pass the test method a string which refers to the correct objects. But this has the same problem as above.

Both of these options create lots of dependencies and problems. I also have to make lots of assumptions about the type the key refers to.

Most of this problem stems from the fact that I abusing TestNG. What i really need is my own controller that can instantiate my Test object while passing the appropriate environment objects.

I was looking into testng’s TestRunner interface, but I’m not sure if this would work.

Any and all help appreciated.
Eric

  • 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-13T16:51:09+00:00Added an answer on May 13, 2026 at 4:51 pm

    Why not use a mix of @Factory and @DataProvider?

    The factory will be in charge of creating your test instances and passing them the correct parameters: either strings (in which case the data provider can then turn these strings into objects) or directly the objects, in which case your tests can use these values directly.

    Feel free to post some code if this doesn’t help you solve your problem.

    —
    Cedric

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

Sidebar

Related Questions

Here's the situation: I've got some lengthy non-UI code that needs to be run
Here the Situation . I am having 2 million records in table . Just
I have an situation here that looks very like a SELECT N+1 from the
I have a strange situation here. In my android app, I have a layout
I have a simple situation here. lets face html code first => <form name=geoKey
I got a little confusing situation here when I use the Context from django.template.
Here is my situation, I have a string as follows 'a':1 'b':2 'c':3 I
Here is the situation. I have received a WSDL (and included XSD) from someone
Here is my situation. I need to create a report that shows each open
Here is the situation, I have UIViewController class with a UITableView outlet. I would

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.