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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T13:44:38+00:00 2026-05-26T13:44:38+00:00

I have a need to add integration tests to my test suite. Although the

  • 0

I have a need to add integration tests to my test suite. Although the name is PHPUnit, I find that there’s plenty of support for running non-unit tests here. My layout is something like this:

<root>
    lib/
        Foo/
            Component.php
    tests/
        lib/
            Foo/
                ComponentTest.php
        resources/
            fixtures/

There are (as I see it), three ways to add higher-than-unit level tests here:

Adding a parallel structure

<root>
    tests/
        unit/
            lib/
                Foo/
                    ComponentTest.php
        integration/
            lib/
                Foo/
                    ComponentTest.php
        resources/
            fixtures/

This should work, except now there isn’t a 1:1 class : test class relationship which might (and probably will) confuse Netbeans.

Adding <root>/tests/lib/Foo/ComponentIntegrationTest.php

Has the same problem as above, with less directories.

Adding the tests to the existing test class, with notation like @group integration

This keeps the 1:1 relationship, but adds significant complexity to the test suite. Also, as the SUT will need to be invoked in changing environment, I can’t just reuse the _setup() from unit tests.

Ideas?

  • 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-26T13:44:39+00:00Added an answer on May 26, 2026 at 1:44 pm

    Unit tests are used to test a single unit (class) in isolation. Integration tests are designed to test multiple units together. As such you probably won’t have a 1:1 correlation between classes and the integration tests to which they belong.

    I would create a separate directory structure–perhaps even a separate project–to house the integration tests. NetBeans won’t be able to open “the test” that a class belongs to because it will belong to multiple tests, but it will continue to open its matching unit test.

    We have a separate project for our integration tests (called sanity tests before I arrived) using Selenium, and it works well enough so far.

    Update

    The directory layout for our integration tests is pretty simple: one directory per site. We have a single codebase for the site and use views to allow single sites to override the layout (more than just skinning). We haven’t spent as much time on these tests as I’d like. We use Selenium to run the tests after pushing the sites to a staging server. I haven’t had a chance to hook them up to our continuous integration server (Jenkins) yet, but that would be ideal.

    I’d recommend organizing them by functional area or module on your site. Mostly, it depends on how you think about the project you’re testing. An example might look like this:

    src/
        Model/
            Cart.php
        ...
    tests/
        unit/
            phpunit.xml
            bootstrap.php
            Model/
                CartTest.php
            ...
        integration/
            account/
                login/
                register/
                subscriptions/
            products/
                listing/
                details/
                search/
            cart/
                shop/
                checkout/
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code that I need to add an additonal object to
I have two raw sound streams that I need to add together. For the
For a customer we need to generate detailed test reports for integration tests which
I have a need to add business reporting for an application I am working
I need to add a specific column if it does not exist. I have
I have an ASP website which I need to add a RegEx match to.
I have a situation where I need to add an arbitrary unique id to
I have a COM interface and need to add an accessor method to it.
i have a string and i need to add a number to it i.e
What code do you need to add in PHP to automatically have the browser

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.