Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 31

Use it for questions about automated Drupal tests.

5 votes

How can I do Test Driven Development?

The only thing that I'm aware of is that for contributed modules, you can enable automated testing of commits and patches in the issue queue, see http://drupal.org/node/689990. …
Berdir's user avatar
  • 83.5k
3 votes
Accepted

Software testing and regression testing

Drupal 7 comes with a Testing module, and for Drupal 6 you can download http://drupal.org/project/simpletest. …
Berdir's user avatar
  • 83.5k
1 vote
Accepted

How to create a user with custom profile fields for a SimpleTest

While setting the user_register variable works by automatically logging you in, if you want to test the default mail confirmation, you can inspect the mail as described over in your other question: Ho …
Berdir's user avatar
  • 83.5k
5 votes
Accepted

SimpleTesting-PDOException: SQLSTATE[42S02]

This behavior is correct. SimpleTest sets up a new site environment for every test case, using a table name prefix. You probably forgot to install your module by overriding the setUp() method. Once y …
Berdir's user avatar
  • 83.5k
2 votes
Accepted

How to SimpleTest a module's use of drupal_alter() or module_invoke_all()?

You can create a test module and place hidden = TRUE in the .info file. This will hide the module in the user interface but you can still enable it in your setUp() method. See http://drupalcode.org/ …
Berdir's user avatar
  • 83.5k
2 votes

Should a fresh install of Drupal have failing tests and what to do with the failing tests?

All tests are run on every patch that is posted on drupal.org, fully automated. Nothing is commited unless all tests are passing (It happens that something is commited that breaks the tests (for examp …
Berdir's user avatar
  • 83.5k
12 votes
Accepted

Trying TDD with PHPUnit

My guess is that you're not including the phpunit.xml.dist file, which sits in the core folder. Either run tests from there (./vendor/bin/phpunit ../modules/your_module) or specify that file with -c. …
Berdir's user avatar
  • 83.5k
2 votes
Accepted

The test case is not recognized by the Simpletest module

file like this: files[]=yourmodule.test Then, let it rebuild by submitting the modules page or use the "Clear information" (or similar, not sure about the exact label right now) at the bottom of the Testing
Berdir's user avatar
  • 83.5k
3 votes
Accepted

Get currently active 'simpletest' user during test

Inside the test method? No idea what in $GLOBALS['user'] is, but you certainly can't rely on it. You are never "logged in" in that context, you are only logged in when doing requests with drupalGet() …
Berdir's user avatar
  • 83.5k
1 vote
Accepted

using DrupalWebTestCase - any trick to prevent it from running from scratch each time?

Use the testing profile by adding a protected $profile = 'testing'; to your test class. …
Berdir's user avatar
  • 83.5k
2 votes
Accepted

Using SimpleTest to test an image upload

There is a base image field test class in image.module, which has a uploadNodeImage() method. You can either re-use that by extending from that class or steal the code there. See testStyleReplacment( …
Berdir's user avatar
  • 83.5k
1 vote
Accepted

"Failed to set field" Problem with SimpleTest, testing a form

Permissions would be my first guess. Enable debug output in the Simpletest settings and then check if your module is installed and you have permissions to visit that page.
Berdir's user avatar
  • 83.5k
4 votes
Accepted

Redirect SimpleTest queries to a different database

The most important thing is defining $profile = 'testing'; in your test class, that will only install the absolutely required modules for Drupal to run. Speeds up test runs by ~50%. …
Berdir's user avatar
  • 83.5k
4 votes
Accepted

Writing functional tests for a controller that makes call to external service?

It is sometimes more complicated to set up, but has the advantage that you are testing much more of your actual code and integration. … Testing all possible cases, error handling/conditions and so on. …
Berdir's user avatar
  • 83.5k
1 vote
Accepted

adding a contrib dependency to simpletest

I don't understand why you need libraries module for swiftmailer? Swiftmailer dependencies in 8.x-1.x are installed using composer (manager). Which is something that the testbot currently simply does …
Berdir's user avatar
  • 83.5k

15 30 50 per page