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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T17:15:28+00:00 2026-05-10T17:15:28+00:00

For example, I’m writing tests against a CsvReader. It’s a simple class that enumerates

  • 0

For example, I’m writing tests against a CsvReader. It’s a simple class that enumerates and splits rows of text. Its only raison d’être is ignoring commas within quotes. It’s less than a page.

By ‘black box’ testing the class, I’ve checked things like

  • What if the file doesn’t exist?
  • What if I don’t have permission on the file?
  • What if the file has non-Windows line-breaks?

But in fact, all of these things are the StreamReader’s business. My class works without doing anything about these cases. So in essence, my tests are catching errors thrown by StreamReader, and testing behavior handled by the framework. It feels like a lot of work for nothing.

I’ve seen the related questions

  • Should QA test from a strictly black-box perspective?
  • Rigor in capturing test cases for unit testing

My question is, am I missing the point of ‘glass box’ testing if I use what I know to avoid this kind of work?

  • 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. 2026-05-10T17:15:29+00:00Added an answer on May 10, 2026 at 5:15 pm

    This really depends on the interface of your CsvReader, you need to consider what the user of the class is expecting.

    For example, if one of the parameters is a file name and the file does not exist what should happen? This should not be dependent upon whether you use a stream reader or not. The unit tests should test for the observable external behaviour of your class and in some cases, to dig slightly deeper and additionally ensure certain implementation details are covered, e.g. the file is closed when the reader has finished.

    However you don’t want the Unit Tests to be dependent upon all of the details or to assume that because of an implementation detail something will happen.

    All of the examples you mention in your question involve observable behaviour (in this case exceptional circumstances) of your class and therefore should have unit tests related to them.

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

Sidebar

Ask A Question

Stats

  • Questions 63k
  • Answers 63k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer Given this HTML: <div> <table> <!-- contents --> </table> </div>… May 11, 2026 at 10:38 am
  • added an answer Could this be a bug that's fixed by MS Office… May 11, 2026 at 10:38 am
  • added an answer I have never come across a problem like that (and… May 11, 2026 at 10:38 am

Related Questions

For example, I issued an ALTER TABLE statement to create an index on a
For example, I have an ASP.NET form that is called by another aspx: string
For example, I want to populate a gridview control in an ASP.NET web page
For example, I rarely need: using System.Text; but it's always there by default. I
For example, I'm writing tests against a CsvReader. It's a simple class that enumerates
For example, I am trying to get a min date, a max date, and
For example, I want just the filename of a file in a field. Say
For example, I have a custom control called SampleControl. To simplify things for this
For example, I hate typing things like: $x = mysql_escape_string(stripslashes($_GET['x'])); Is there a way
For example, I have a pet table and a lost pets table. I want

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.