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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T22:11:03+00:00 2026-05-12T22:11:03+00:00

Recently I wrote a suite of unit tests that relied on a large set

  • 0

Recently I wrote a suite of unit tests that relied on a large set of test data. The set contained twelve elements and while this does not sound like a lot it was when used with the tests.

Each element required several properties to be set with unique vales. The issue was using this method was that the factory method that created this set of data was huge.

What are the best practices regards this issue? My application actually reads data in via a file but for tests I used mock data from an in memory store.

Any advice?

  • 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-12T22:11:03+00:00Added an answer on May 12, 2026 at 10:11 pm

    What do your tests look like?

    Are you sure that you are writing unit tests and not higher level tests of multiple components of your code? A pure unit test should only be calling a single method, and that method will hopefully have limited calls to other methods (possibly via mocking).

    By focusing on the smallest unit possible, you can write code to test specific edge cases. Whereas, if you are testing at a higher level, you will often have to write all types of permutations of edge-cases. Once you have all the smallests units covered, you can write some higher level integration tests to make sure that all those units are assembled correctly.

    For example, if I had an application that reads in a CSV file of stock quotes and averages all the quotes for a given day, I would write several tests:

    • Unit tests around the CVS parsing
    • Unit tests around the date grouping
    • Unit tests around the averaging
    • Unit tests around the display of the answer
    • And a small number of integration tests that might take a very small CVS file and pass it through the entire process.

    I apologize if I am making assumptions about your unit tests, but from my experience, I find that often what people call unit tests are not real unit tests and rather integration tests (or whatever you prefer to call them, e.g. functional tests, etc.). I am personally very guilty of writing tests that were too broad, and every time I now write tests I have to force myself to remember to really test a unit at a time.

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

Sidebar

Related Questions

I recently wrote a program that takes inputted char data, tests if it is
I recently wrote some data access methods (plain old Java) that use immutable objects
In one of my Django projects I have a suite of unit tests that
I recently wrote a program that used a simple producer/consumer pattern. It initially had
So I recently wrote a java class that extends exception and used an instance
I recently wrote a java crawler program that finds the video links in a
I recently wrote some javascript code that filled a drop down list based on
I recently wrote an iPad app that I would like to make a universal
I recently wrote a script that does a sed command, to replace all the
I recently wrote a theme function to add a class to my primary links

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.