SimpleTest is Drupal's custom testing framework.

learn more… | top users | synonyms

2
votes
2answers
32 views

How do I post a node that has its created field set to the past in a test class?

I am creating a test class using the framework of the core Testing module for a module that is supposed to autoexpire nodes some time after they've been created. Nodes have two timestamp fields: ...
0
votes
1answer
11 views

Why are no tests shown on testing overview?

I want to run DrupalWebTestCases on my custom Drupal 7 module. Following the Tutorial at https://drupal.org/simpletest-tutorial-drupal7 i'm stuck at running the tests: also after cache deletion no ...
0
votes
0answers
14 views

How do I speed up `drush test-run` (compared to the SimpleTest UI)?

I have a number of Feature modules for which I've written tests to assure they work as expected. For performance reasons, I've overridden the parent's setUp() method in each test case so that it ...
0
votes
0answers
16 views

Why does DrupalWebTestCase (SimpleTest) encode multiple select options with indices?

Summary: I've written a module that uses the Form API. When multiple form select options are POSTed using my web browser, they get encoded (by the browser) like this: option[]=Value A option[]=Value ...
0
votes
0answers
18 views

Order of tests in test group

Is there a way to set order of tests (or weights) in test group. I'm referring Sipmletest. Something like: static public function getInfo() { return array( 'name' => 'test name', ...
2
votes
0answers
36 views

Running simpletest tests with clean urls on nginx

Having Drupal 7 on nginx with enabled clean urls. nginx config: location @drupal { rewrite ^/(.*)$ /index.php?q=$1 last; } When trying to run tests getting message: You are not authorized to ...
2
votes
1answer
55 views

Which test cases/tests should I run?

I'm a bit confused about best practices for testing in Drupal 7. When I'm going to deploy, should I run the entire test suite—including all Drupal core tests—every time? This seems like a bit of ...
0
votes
1answer
24 views

Core Testing vs SimpleTest

I have a query concerning the core Testing module and the SimpleTest module. When I install a new site, the Testing module is available but disabled. When enabled, a list of tests are available for a ...
1
vote
1answer
44 views

How do I enable a features module in the setup of a simpletest testcase

I'm trying to test some permissions that are related to custom node types and Organic Groups that I've built and packaged as a feature using the features module. I'm trying to enable the feature (and ...
0
votes
0answers
54 views

Simpletest failed to set field problem

I'm stuck with this problem. I have a form with 3 select fields: year_level, section, subject. The year_level field has a select event that calls ajax to populate the section options (and the subject ...
3
votes
2answers
777 views

Simpletest on select field loaded by ajax

I have searched through Google and haven't found an answer. Stack Exchange is my last resort. In my form, I have two select fields: $form['system']['foo'] = array( ... '#type' => 'select', ...
0
votes
0answers
41 views

Simpletest and examples module

I've enabled SimpleTest module and simpletest_example module in the Examples module I've cleared all caches and i do not see anything about simpletest_example in this page : ...
0
votes
0answers
53 views

How can I avoid Simpletest fatal errors when switching between git branches of a module?

Ok, so I'm trying to do some tests on the privatemsg module so I have several different git branches for different issues. For example, one branch has a new privatemsg_forward submodule. I'm ...
1
vote
1answer
22 views

How do I block a user/cancel a user account in Simpletest?

I'm trying to write some tests for a module for situations in which a user is blocked. I know I can use drupalCreateUser() to make new users, but how do I block a user I have created in Simpletest?
0
votes
1answer
65 views

DrupalWebTestCase::drupalLogin() doesn't work if the Domain access module is enabled

DrupalWebTestCase::drupalLogin() doesn't work when the Domain access module is enabled. It seems the issues is with Drupal sessions / the Domain access module. Is there any work-around for this?
3
votes
1answer
35 views

Why are comments enabled on my content types in Simpletests?

When I run Simpletest, it's showing comment forms at the bottom of all the nodes, even though I don't even have the comment module enabled, nor permissions assigned for it. These comment forms showing ...
2
votes
0answers
65 views

How to test AJAX Callback with simpletest on Drupal 6

I know there is drupalPostAJAX() available on Drupal 7 to do this, but I want to use it on Drupal 6. So I found on this link : http://tiger-fish.com/blog/drupal-6-posting-ajax-callbacks-simpletest a ...
0
votes
1answer
66 views

How to SAVE a webform in Simpletest?

I am able to save a sample webform in Simpletest if I only use title and body: $edit = array(); $edit['title'] = 'Sample webform'; $edit["body[$langcode][0][value]"] = $this->randomName(); ...
1
vote
1answer
52 views

EFQ propertyCondition Doesn't work in Simpletest

This Entity Field Query works as expected outside of simpletest: $query->entityCondition('entity_type', 'node') ->fieldCondition('field_exhibition_window_start', 'value', $date, '<=') ...
1
vote
0answers
24 views

How to reuse custom methods in a simpletest class?

I have created several test methods that I find useful in a lot of other situations. All I need is to define an include file of higher visibility which contains an utility class which is autoloaded ...
0
votes
1answer
159 views

How do I run unit tests against datasets? (DrupalWebTestCase and DrupalTestCase)

I am testing a module that I am writing against the Unit Testing framework that comes with Drupal 7. All makes sense, and everything asserts as it should. My question though, is it possible to run ...
1
vote
2answers
61 views

What is the most robust way to assert for a validation error?

I want to test the validation function in my custom module, and so I've written a simpletest that inputs an illegal value in a field and then attempts to save the node. Currently I'm using ...
1
vote
0answers
41 views

Press 'continue' button in simpletest

I am trying to enable modules via POSTing to /admin/modules in a simpletest. It works fine, except that there are dependencies (the whole reason I want to do it this way) and when it requires then ...
0
votes
1answer
215 views

Simpletest fails to create the field_config table

I'm only just getting into TDD with Drupal and unfortunately run into trouble right away. For some reason the simpletest####field_config table isn't being created, and I don't get why; many other ...
3
votes
1answer
264 views

Why do PAreview/codesniffer gripe about missing “scope modifier”?

I am writing a simpletest file for my Drupal module. It works OK, but when I use PAreview (automatic tool based upon PHP codesniffer to check correctness of Drupal code), I get the following error ...
0
votes
1answer
200 views

Impossible to enable modules in SimpleTest

I am building SimpleTests for my modules: It seems like the standard procedure for enabling modules it doesn't work for me: function setUp() { parent::setUp('mymodule'); } I constantly get a ...
6
votes
1answer
164 views

webTestCase->drupalPost() or drupal_http_request()?

I'm writing a simpletest for a module that posts XML directly to a URL (it's on a closed system so there's no user or auth or anything at this point). I've manually tested getting the response code ...
1
vote
1answer
80 views

drupal 7 entity and simple test

What I can't workout is what steps I need to see if the entity is loaded using simple test. Any direction will be greatly appreciated thanks. /** * @file * Definition of creation of a entity. */ ...
0
votes
1answer
34 views

testing a function

I have setup a file called mymodule.test and in the module I have file called mymodule.inc. Every is working but I am unsure about the following. Below is mymodule.test file. class MyModule extends ...
0
votes
2answers
151 views

Drupal registry table not populated with test class files

I tried to write tests for custom modules and I found that registry database table is not populated with .test files and thus admin/config/development/testing displays only one SimpleTest test. I ...
0
votes
1answer
74 views

Why is my alias “NULL” in a test?

I am using Drupal 7, I have Pathauto enabled, and my user has permissions to create new aliases. When I manually create a node, uncheck the checkbox for automatic alias generation, and enter a custom ...
2
votes
1answer
64 views

Version numbers of dependencies in testing

If I'm submitting a test to the qa.drupal.org testbot, and my module requires a dev version of another module in order to function properly, is it adequate to declare the version in my module's .info ...
0
votes
1answer
104 views

Creating custom node aliases inside a simpletest

I am attempting to write simpletests to replicate the steps to reproduce on this d.o issue. I need to create a test node with a custom alias, as if I had unchecked the "Generate automatic URL alias" ...
0
votes
1answer
156 views

Is there a clean-URL-reflective version of file_create_url()?

I have a site with clean URLs enabled and in a test I've written, I compare the current drupalGetHeader('location') to file_create_url($file->uri). The tests passes on my site, but on the ...
0
votes
1answer
64 views

Does DrupalWebTestCase::drupalGet() use the permissions of DrupalWebTestCase::$loggedInUser?

I'm trying to test the permissions of a particular role, and this code: $this->drupalLogin($this->editor_user); $this->drupalGet($node->path['source']); returns a 200 (OK) status, when ...
2
votes
1answer
86 views

Programmatically save altered file

As I mentioned in my previous question I'm attempting to write tests for a patch that will, ideally, trigger the creation of a redirect if the URI of a file changes. My patch uses hook_file_update() ...
4
votes
1answer
81 views

$file->original: Where does it come from?

I am attempting to write a patch for the Redirect module that automatically creates a redirect from the old file path to the new one, whenever a file is updated. I added a hook to redirect.module: ...
3
votes
1answer
43 views

Checking if module has the right output on multilingual pages with simpletest_clone

I'm trying with simpletest_clone to check if my modules have the right output depending on the language. Now my problem is, that when I do the following Code: $this->drupalGet('de'); // check the ...
0
votes
0answers
110 views

Media module, file usage, and simpletest

I'm trying to write a test that will do the following: Create a user Create an 'article' node Upload a file via Media module Insert that file into the body via pre-determined markup Save the node ...
3
votes
1answer
248 views

Why not programatically created nodes in the simpletests?

Most core and many contrib simpletest test create nodes by preparing the interface, logging an admin in and then filling out the form on /node/add/foo. Not only is this terribly slow, it fails at the ...
2
votes
5answers
326 views

How to inspect a variable when testing with `drush test-run`.

When testing with my SimpleTests, I want to inspect a variable. var_dump() and the likes are not being rendered in the output of Drush, Xdebug interactive debugger does not work due to the simulated ...
4
votes
1answer
127 views

Invoking Drupal core tests from within a custom module .test script

I am writing a simpletest test script, where I would like to enable my module, and then invoke a Drupal core test to ensure that my module is producing core-compliant results (in particular, I render ...
1
vote
2answers
136 views

How to check if code is running inside simpletest?

Here's the best I've come up with so far: /** * Returns TRUE if our code is running via a simpletest. * * We don't check for the database prefix so that this can be used by Unit * Tests also. * ...
0
votes
2answers
99 views

Drupal + Simpletest + Class Autoloading = FALSE?

Just a quick question which I couldn't Google : is class autoloading not "enabled" when running tests using SimpleTest? I'm using the Drupal SimpleTest module, and I'm trying to instantiate a class ...
0
votes
1answer
255 views

How to write test cases for custom ajax functionality using simpletest in drupal7

I am trying to write the test case for my custom ajax functionality in Drupal 7. I am firing the event on click in my .js file but the test case gets a fail. In my .tpl.php template file I have the ...
2
votes
2answers
438 views

Headless Web Browser During Cron?

I need a headless web browser with JS support to use during cron. It seems like the simpletest module does what I need, but how could one initiate a browser and hand it a DOM? Outside the context of ...
0
votes
1answer
210 views

I can't enable SimpleTest due to open_basedir restriction being in force

I can't enable SimpleTest due to an open_basedir restriction being in force for my Drupal7 installaton which resides on a Linux server running PHP 5.2.12. I found the directive under my PHP.INI file ...
1
vote
2answers
124 views

How to view simpletest results?

It looks like it's something obvious but I can't find the web interface to view simpletest results. Where should I view the errors besides the DB?
0
votes
2answers
194 views

Why DrupalWebTestCase processing took so long?

I want to create a test that uses the database, so I must use the DrupaWebTestCase class. I create the following test class with this simple test: class MyModuleTest extends DrupalWebTestCase { ...
0
votes
1answer
192 views

Create a simpletest test to add additional form elements using the “Add another item” button

I am trying to create a test case for my custom module using simpletest in Drupal7. I want to create a node. The problem is that the node edit form contains a number of fields which can have ...