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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:39:41+00:00 2026-05-22T20:39:41+00:00

I am diving deeper and deeper in the world of unit testing. One issue

  • 0

I am diving deeper and deeper in the world of unit testing.

One issue I encountered, and this is where I would like feedback, is when one runs multiple test suites, maybe it is just me but I need to use the parameter –process-isolation for my tests to pass. I can run any of my suites individually without a problem, but running the 6-7 suites I have so far with 180 assertions spread between them fails if I run without –process-isolation. The problem is that using this parameter makes the test run last for 35 mins, versus the usual 2.5 minutes. That’s a loooong wait.

The problem is related to using mocked DI containers for specific tests and containers are not properly re-initialised when tests suites are running chained. Static properties set on DI-Container to test for expected failures make the tests in following suite fail. The container has a parameter that can hold contained object in a static var, to return the same instance at every call. A singleton in disguise. And this runs fine on application level, it’s just a nuisance for testing.

I could avoid that container parameter and code the application to not use static properties, but avoiding a useful language construct for the sake of a methodology seems like overkill.

Maybe I am doing something wrong (I sure hope so!) but I have the impression if one wants to run tests with the SUT in a clean state for every test, there is no getting around using –process-isolation. This makes testing very time consuming and takes the joy out of it a little bit. I have bypassed the issue somewhat by running suites and tests individually when I am coding, and running the suite in background before major commits.

Is what I am experiencing normal, and is there a way to counter this? How do you testers out there ensure testing time is reasonable? How are statics handled so as to not influence testing?

Any insight appreciated/comment appreciated.

  • 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-22T20:39:41+00:00Added an answer on May 22, 2026 at 8:39 pm

    You have several problems.

    The first is process isolation. Normally, it should not be necessary and you only want to use it to find out which specific test is the one that fatally breaks your tests. As you noted yourself, it’s awfully slow, which is something you cannot fix.
    You might want to disable backing up global vars which saves some milliseconds per test, though.

    The second problem, which leads to your first problem, is that your code is not testable because static vars are kept during tests – my most-hated singleton problem.
    You can solve that problem by providing a “cleanup” or “reset” method in your dependency containers. Those will get called from the setUp() method in your main test case class and reset everything to a clean state.

    Speed

    Regarding the runtime of tests – I recently wrote a blog entry about finding out which tests were too slow. Generally, tests are too slow if you can’t run them after saving the file or each commit on your own box. 10 seconds is barely acceptable for me. The more tests you have, the slower will running them be.

    If you really have 35 minutes, then split up your tests into sensible groups so that you can run the necessary ones on your own machine – only the tests that test the code you changed. Pyrus, the next-gen PEAR installer, has the nifty feature to automatically detect and run the tests that need to be run, depending on what files you changed.
    PHPUnit does not have that, but you can emulate that by hand and phpunit --group .. 🙂

    Always take care of mocking web services and databases, or at least running the database with only necessary data for each single test. Waiting 3 seconds for a web services response in a test that’s verifying if you can save the user to database is something you never want.

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

Sidebar

Related Questions

I just recently started diving into Real World Haskell and the book provides some
I'm diving into javascript and one of the concepts I'm playing with is XML
I'm just diving into WPF and find this a little odd and frustrating to
I'm diving into the world of prolog headfirst but I seem to have hit
I'm diving into iPhone development, so I apologize in advance if this is a
I'm trying to get something like this http://www.fotosearch.com/CSV008/k6834584/ But I have a trouble with
I'm diving into something without sufficient background, but I feel like there may be
One of the biggest issues currently holding me back from diving full steam into
http://pypi.python.org/pypi/simplejson I am just diving into the Python world and want to make a
We are implementing i18n using JSTL and encountered an issue that the resource texts

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.