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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:27:49+00:00 2026-05-14T02:27:49+00:00

I’m new to Unit Testing, and I’m only getting into the routine of building

  • 0

I’m new to Unit Testing, and I’m only getting into the routine of building test suites. I have what is going to be a rather large project that I want to build tests for from the start.

I’m trying to figure out general strategies and patterns for building test suites. When you look at a class, many tests come to you obviously due to the nature of the class. Say for a “user account” class with basic CRUD operations, being related to a database table, we will want to test – well, the CRUD.

  • creating an object and seeing whether it exists
  • query its properties
  • change some properties
  • change some properties to incorrect values
  • and delete it again.

As for how to break things, there are “fail” tests common to most CRUD classes like:

  • Invalid input data types
  • A number as the ID key that exceeds the range of the chosen data type
  • Input in an incorrect character encoding
  • Input that is too long

And so on and so on.

For a unit test concerned with file operations, the list of “breaking things” could be

  • Invalid characters in file name
  • File name too long
  • File name uses incorrect protocol or path

I’m pretty sure similar patterns – applicable beyond the unit test one is currently working on – can be found for most units that are being tested.

Now my question is:

  • Am I correct in seeing such “breaking patterns”? Or am I getting something completely wrong about Unit testing, and if I did it right, this wouldn’t be an issue at all? Is Unit Testing as a process of finding as many ways to break the unit as possible the right way to go?

  • If I am correct: Are there existing definitions, lists, cheat sheets for such patterns?

  • Are there any provisions (mainly in PHPUnit, as that’s the framework I’m working in) to automate such patterns?

  • Is there any assistance – in the form of check lists, or software – to aid in writing complete tests?

  • 1 1 Answer
  • 4 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-14T02:27:49+00:00Added an answer on May 14, 2026 at 2:27 am

    You are basically right. Looking for ways that could possibly break your code is a key part and skill in unit testing. However, unit testing as applied in TDD works a bit differently. In TDD you first write a test for a new piece of functionality, then create the code to make that test pass. So the emphasis is different here, even though the end result is similar.

    In TDD, one “changes hats” constantly – a little bit of testing, a little bit of coding. So in this method, testing is not an automatable part, but one could almost say it is the key to the creative process. While writing tests, you are also designing the interface of your unit and are thinking from the point of view of its (future) clients – what can they expect, and what are they supposed to provide? Then you switch hats and go inside the unit to fulfill these expectations.

    So I don’t feel this can be replaced by simply checking items on a list. Of course, once you run out of ideas to test the actual unit, it never hurts to check such a list. However such sheets by their nature can only contain generalizations which may or may not apply to a specific project and a specific class to test. But you apparently have the experience and the mindset to find good test cases for your specific units anyway 🙂

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I want use html5's new tag to play a wav file (currently only supported
I have a French site that I want to parse, but am running into
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a jquery bug and I've been looking for hours now, I can't
I have just tried to save a simple *.rtf file with some websites and
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.