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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:48:04+00:00 2026-06-05T07:48:04+00:00

I have a unit test which contains huge data that needs to compared with

  • 0

I have a unit test which contains huge data that needs to compared with actual custom object. So I have to create an expected custom object and populate it with huge data, rightnow I am hard coding the expected custom object in code. There is a scenario where I have test with differenct set of data as a input for the method I am testing. Depanding on the set of data I have to get relative output which will be the actual respons (huge data). Is there any best practice for the above scenario other than hard coding expected values in code? (some thing like XML or CSV).

  • 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-05T07:48:06+00:00Added an answer on June 5, 2026 at 7:48 am

    You can create code that will serialize object using XmlSerializer.

    You need to call that code when application is running and you have correct object in memory.

    Save XML into the file and construct object in test from XML.

    You may have several XML files that can cover different scenarios.

    In my application I had code that imports data from external webservice. I generated a few XMLs for service response objects (they were huge) and use them to test my parsing logic.

    Update: That trick works only for Entities objects. You cannot serialize/deserialize class that works with files or database.

    Here you can find sample code.
    http://www.jonasjohn.de/snippets/csharp/xmlserializer-example.htm

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

Sidebar

Related Questions

I have a load test which contains only a single unit test. The unit
I have a method named RenderContent which returns object[] In my unit test, I
I have a unit test which contains the following line of code Site.objects.get(name=UnitTest).delete() and
I have a simple unit test which tests that a validation function picks up
I have created a unit test in my c# project which builds into a
I have some classes(call it Class A) which I would like to unit test
I have a unit test that creates a mock calls my method to be
I have a unit test that tests if an Exception is throw, but this
Say I have a unit test that wants to compare two complex for objects
How can I unit test a method which uses a session object inside of

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.