Drupal 8

Complete as of #2551981: Add --directory option to run-tests.sh test discovery

Drupal 7/6

Short term: ?
Long term: Backport of #2551981: Add --directory option to run-tests.sh test discovery

The old testbots appear to have scanned for tests,

[06:19:46] Scanning sites/default/files/checkout/sites/default/modules/ubercart for .test files.
[06:19:46] Scanning sites/default/files/checkout/sites/default/modules/ubercart for /Tests/*.php files.

and the new testbots are using "--module" to specify tests, which is causing test discovery to fail in some cases:

Ubercart has a good example of this:

https://dispatcher.drupalci.org/job/default/1705/console

Compare with:
https://qa.drupal.org/pifr/test/675093

Comments

jthorson’s picture

Manually scanning for the files caused all sorts of conflicts on the old test runners ... every directory change and/or PSR standard change would break testing, and force us to go update the code on the test runners.

Because each testing framework is going to have it's own syntax, format, and default locations, I would prefer to leave 'test discovery' as a function of the individual testing frameworks, rather than building in this somewhat arbitrary discovery logic into DrupalCI, and then adjusting it for other testing frameworks that we try to integrate in the future.

So to address the test discovery problem identified here, my proposed solution would be that run-tests.sh be augmented to support a --directory argument, and have *it* perform it's own test discovery; rather than the hacky method used by PIFT/PIFR (which scanned for all test files, and then passed the complete list of discovered test files as individual command line arguments; resulting in a fifty-line command invocation).

berdir’s picture

+1

This would also solve the weird problem that testbot finds unported 7.x tests in 8.x modules and completely breaks on that. Would have to be backported to 7.x as well before it could be used and it needs to work on all operation systems no idea if recursive glob() or something like that works on windows?

jthorson’s picture

Issue tags: +D8 Accelerate
Mixologic’s picture

I agree that test discovery should be the responsibility of whatever testing framework we have, however, since this is a blocker for removing the old testbots (and the cost associated with them), we need to proceed with migrating the brokenish method we have on the legacy bots to drupalci, and when the feature gets added to run-tests.sh and it's able to run tests for a module on its own, we can take advantage of that feature.

Is there a corresponding core issue to fix run-tests.sh to do proper discovery?

jthorson’s picture

Since the code has to be migrated anyway ... the 'right' thing to do would be to migrate it only once - into run-tests.sh instead of into DrupalCI.

Test discovery in PIFT consists of parsing over the appropriate directories, generating a string of all of the valid test classes which need to be passed onto the run-tests.sh command invocation, and then executing run-tests.sh with that complete list as individual arguments on the command line. It generates a ton of noise that will severely impact readability of the test results, and degrades the overall end user experience.

I would suggest that moving this over to run-tests.sh actually requires much less effort than porting it into DrupalCI ... as such, I am advocating for *not* trying to port this over into DrupalCI as an 'interim' step. Since run-tests.sh is actually a php script, the same directory parsing code can be put there instead; and as a net-new feature and testing unblocker, I'd argue it would be rather easy for us to fast-track it into the core codebase.

jthorson’s picture

Mixologic’s picture

We need to proceed with importing the less than ideal test discovery into drupalci. We will need this for drupal 6, 7, and 8 testing, and will be unable to wait for a 'fast track patch to d6/d7 run-tests.sh' in order to have a clean way of doing this.

jthorson’s picture

Fine ... I understand that we're in a hurry, but am concerned that approach means duplicated effort.

We don't have D6/7 drupalci testing yet, and the 'fast track' patch for D6/7 is a very minor tweak to the already existing D8 patch ... maybe 5 minutes work to port it to D6/7. The bigger question becomes whether the file scan is the best approach for D8.

hestenet’s picture

Patch made it into D8 core in #2551981: Add --directory option to run-tests.sh test discovery - however we may still need our workaround for for D7/D6 depending on how long it takes to backport and get in.

hestenet’s picture

Title: Contrib Testing Test discovery not working » Contrib Testing Test discovery not working for d6/d7
Issue summary: View changes

  • Mixologic committed 3374b5b on 2538462-contrib-test-discovery
    Issue #2538462: Adds d7 test discovery patch.
    

  • Mixologic committed ea76ed7 on 2538462-contrib-test-discovery
    Issue #2538462: updates the patch
    

  • Mixologic committed 4a6fb68 on 2538462-contrib-test-discovery
    Issue #2538462: updates the patch, correctly
    

  • Mixologic committed 6f981e5 on 2538462-contrib-test-discovery
    Issue #2538462: updates the patch to the latest version
    

  • Mixologic committed 1bc63bc on 2538462-contrib-test-discovery-d6
    Issue #2538462: Adds a patch to the job to have a --directory to run...
  • Mixologic committed 3374b5b on 2538462-contrib-test-discovery-d6
    Issue #2538462: Adds d7 test discovery patch.
    
  • Mixologic committed 4a6fb68 on 2538462-contrib-test-discovery-d6
    Issue #2538462: updates the patch, correctly
    
  • Mixologic committed 6f981e5 on 2538462-contrib-test-discovery-d6
    Issue #2538462: updates the patch to the latest version
    
  • Mixologic committed ea76ed7 on 2538462-contrib-test-discovery-d6
    Issue #2538462: updates the patch
    

  • Mixologic committed a533e58 on 2538462-contrib-test-discovery-d6
    Issue #2538462: permissions issues on applying the patch, as well as...
Mixologic’s picture

Status: Active » Fixed

Currently drupalci is working utilizing the following d6 simpletest patches and d7 core patches:

https://www.drupal.org/node/2551981#comment-10452015

https://www.drupal.org/node/2598676#comment-10476814

When they are either merged into d7/d6 simpletest, we'll remove them from drupalci. Until such time we'll run patched, and therefore this can be closed.

In all likelyhood the d6 testing will never get merged in as d6 testing will be shut off in Feb 2016, and theres no real reason to worry about that.

I'll open a follow up for "remove d7 patch when https://www.drupal.org/node/2551981 lands"

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.