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

  • Home
  • SEARCH
  • 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 7728245
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:40:13+00:00 2026-06-01T05:40:13+00:00

I have a few unit tests that require very large strings for the test

  • 0

I have a few unit tests that require very large strings for the test data. I do not want to declare the HTML string in the test itself as this can obscure that actual test. Rather, I would like to load these strings from an external resource for each test.

Though I am not running the same test with different sets of data, parameterized tests looks to be a viable solution; however, I am having difficulty getting the following example to work.

Note: This code is based on the TestNG example.

package flexUnitTests
{
    import helpers.HTMLDataHelper;

    import org.flexunit.runners.Parameterized;
    import org.hamcrest.assertThat;
    import org.hamcrest.text.containsString;

    [RunWith("org.flexunit.runners.Parameterized")]
    public class SimpleTestCase
    {
        private var parameterized:Parameterized;

        public static var dataLoader:HTMLDataHelper = new HTMLDataHelper("data/layer.html");

        [DataPoint(loader="dataLoader")]
        public static var htmlContent:String;

        [Test(dataprovider="htmlContent", description="Tests something.")]
        public function mustPassThisSimpleTest(htmlContentParam:String):void
        {
            assertThat(htmlContentParam, containsString("head"));
        }
    }
}

When I run this test I receive the following error message:

Error: There was an error retrieving the parameters for the testcase:
cause invalid value for parameterized field htmlContent: null

Any thoughts as to what might be the solution to this problem might be?

  • 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-06-01T05:40:15+00:00Added an answer on June 1, 2026 at 5:40 am

    One solution I found was to run the tests in the class with the Theories runner as shown below.

    package flexUnitTests
    {
        import helpers.HTMLDataHelper;
    
        import org.flexunit.experimental.theories.Theories;
        import org.flexunit.runners.Parameterized;
        import org.hamcrest.assertThat;
        import org.hamcrest.object.equalTo;
        import org.hamcrest.text.containsString;
    
        [RunWith("org.flexunit.experimental.theories.Theories")]
        public class SimpleTestCase
        {
            public static var dataLoader:HTMLDataHelper = new HTMLDataHelper("data/layer.html");
    
            [DataPoint(loader="dataLoader")]
            public static var htmlContent:String;
    
            [Test(dataprovider="htmlContent", description="Tests something.")]
            public function mustPassThisSimpleTest(htmlContentParam:String):void
            {
                assertThat(htmlContentParam, containsString("head"));
            }
        }
    }
    

    However the side effect is that all of your tests within the test class will display cryptic error messages when the tests fail. For example,

    Error: mustWorkWithRegularTests

    instead of the much more useful

    Error: Expected: a string containing "head"
    but: was "this is some text"
    

    Though this does “solve” the problem I was having, IMHO the trade off in message clarity is not worth being able to load data from external sources.

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

Sidebar

Related Questions

I want to write a few unit tests that do not make any changes
I have a unit tests that test if the first name of a baby
I'm running a few unit tests that requires a connection to the database. When
I have a few projects that are scripted via javascript. Not a web pages,
I currently have a few unit tests which share a common set of tests.
I have multiple unit tests that have to connect to a MySQL Server to
I'm trying to unit test a few .NET classes that (for good design reasons)
i want to undertake some unit tests and a few functional tests on a
I have few nested DIVs at page. I want to add event only for
I have few Question for which I am not able to get a proper

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.