For questions regarding automated Drupal tests (Simpletest). These include questions regarding DrupalWebTestCase, DrupalUnitTestCase, WebTestBase and UnitTestBase.

learn more… | top users | synonyms

0
votes
1answer
29 views

Testing an update hook that updates fields?

I wrote an update hook for a site that moves data from one field to another. It looks a lot like this gist: foreach ($node_ids as $node_id) { try { $node_wrapper = ...
3
votes
1answer
43 views

How to inject a fake class into container when running WebTestBase tests?

I've got a form class, and I'm injecting my custom functionality class into it via constructor. That class is added to the container via the services.yml file defined in my custom module. I'd like to ...
1
vote
1answer
38 views

How to see if the test works?

There is a way to see if the Drupal tests are working? I wanted to test the FileSystemTest, but when I type phpunit command on the test folder this error appears: 1) ...
1
vote
0answers
57 views

How to unit test custom console ContainerAwareCommand in Drupal 8

I have a custom console command that extends Drupal\Console\Command\ContainerAwareCommand. Inside the command I need to access the container to fetch a service. But now I'm struggling with figuring ...
0
votes
1answer
17 views

With the core testing, how do I set a database variable?

I am trying to establish a test suite for my project using the core testing module. But I can't get past such a trivial thing as setting a database variable. A lot of tutorials on the web tell you to ...
1
vote
1answer
29 views

Proper directory layout for tests

I'm coming across what seems to be contradictory information, and I'm hoping someone here can clarify. The basic question is "what is the correct folder structure for PSR-4 style auto-discovery of ...
1
vote
1answer
22 views

Is it possible to write test against the current database?

I'm building some modules onto an existing and somewhat active site. From my understanding, SimpleTest creates a new, temporary database and effectively reinstalls a copy of Drupal. However, I'd ...
1
vote
0answers
25 views

Selenium IDE for testing Drupal 7 with Media and Paragraphs

I'm writing Selenium IDE tests for my Drupal 7 site and it's great. The issue is recording/writing tests for actions that aren't simple "clicks". I have instructions for using the RunScript action to ...
0
votes
0answers
29 views

Using variable_get from DrupalWebTestCase

I would like to pull certain configuration items from settings.php from a DrupalWebTestCase in order to test my module (in this case, a SFTP module). I want to do it this way so that I don't hardcode ...
0
votes
0answers
20 views

How can i import views in drupal web testcases?

I have created a view by using the views bulk operations module and wrote the code for when bulk operations are done through view mails are sent to users,this code wrote in custom module. Now i have ...
0
votes
2answers
72 views

How do I inspect mail messages in Behat tests?

I am writing a Behat Scenario that checks that an email generated by the Drupal system under test is sent to the correct recipient but I [could not] capture the mail messages from ...
1
vote
2answers
61 views

Run Simpletest tests on Jenkins

I am trying to run a group of tests(Simpletest) for my custom modules through Jenkins. Firstly I tried drush test-run (...) which has been removed from drush. Then I tried php scripts/run-tests.sh ...
1
vote
1answer
46 views

Should QA engineers directly update Drupal database tables via SQL?

Is it generally accepted that it's ok in the Drupal community for QA testers to directly update and delete data in Drupal core tables via SQL? Or is it considered a bad practice? I'm talking about ...
1
vote
1answer
133 views

Can the Devel Generate module generate content for all possible permutations and combinations?

I love the Devel Generate module as it helps me to create test content very quickly. Random content that the module generates is sufficient most of the times. But at times I would like to have ...
1
vote
1answer
73 views

How to add a view dependency to a Drupal 8 functional test

I'm working on a contrib module port to Drupal 8 and am currently adding additional test coverage (#2586125). The module provides both a field formatter and a views style plugin. I have good working ...
0
votes
0answers
10 views

How to refresh a drupalGet() request in a test case?

My test case checks a particular page (/filter/tips, specifically) both before and after changing the site configuration. If I comment out the first drupalGet() call, it works. If the page in ...
0
votes
0answers
25 views

How to run web test cases in Drupal Console

Whenever I attempt to run a test class extending WebTestBase from the Drupal console (via console test:run --url <Url> <ClassName>), the test case fails to create some site folders ...
0
votes
1answer
54 views

adding a contrib dependency to simpletest

Is it possible? I am trying to contribute to a drupal module (first time) and I have uploaded a patch. But the test keeps failing because of an unmet dependency on the libraries API. I have added the ...
1
vote
1answer
31 views

Create a mock Form for WebTestBase?

Is there a way in the testing framework to define a generic form intended only when tests run? I have created some custom form item Element classes. I have working Unit tests with them, but I would ...
1
vote
1answer
102 views

Error running a PHPUnit test only under run-tests.sh

I'm working on an 8.x module that uses PHPUnit tests. I've been running these from the command line using the embedded phpunit script that's installed with Drupal 8: ../vendor/bin/phpunit ...
2
votes
1answer
354 views

Which version of Behat (Guzzle) would be okay to use on a RHEL server with PHP 5.4?

On a Red Hat Enterprise Linux Server release 7.1 (Maipo) development server using [Behat Drupal Extension][1], a RHEL 7 / PHP 5.4 installation. When I try to run behat from the command line on a dev ...
0
votes
1answer
54 views

Debugging your code under SimpleTest when the behavior is different

I'm dealing with a weird problem where a few of my tests are dying from exceptions when run inside of SimpleTest, but I'm unable to reproduce the problem outside of the SimpleTest environment. In ...
0
votes
0answers
16 views

Simpletest drupalGetMails()

I am testing my cusom module and sending two Emails in one function. Emails are being send and I can see them in xampp/mailoutput but $this->drupalGetMails() returns an empty array. The Emails are ...
0
votes
0answers
46 views

Attempt to create an instance of a field field_image that doesn't exist or is currently inactive

I am having a custom module with hook_install(), custom content types and fields are created. When I try to add instance of a field_image to my custom content type, I get the error message: ...
0
votes
1answer
43 views

Update custom fields on hook_user_login

I have implemented hook_user_login(&$edit, $account) and some of custom fields from $account should be updated. I am doing this with user_save(). These changes are not visible in Simpletest. I ...
0
votes
1answer
77 views

How can I write users table data in custom file?

I have a number of users in my site,I have developed custom module for drupal mail functionality. But I want to write test cases for custom module. then here is the problem is how can I get the ...
3
votes
1answer
50 views

How to test Drupal distributions and see examples

Is there a way to see Drupal distributions already installed for testing as demo sites? I was searching drupal.org, where I only found 'case studies'. Sites there are sorted only by categories, not by ...
0
votes
1answer
90 views

How to write a simple test case for users by using drupal_mail() function?

I have written a custom module for sending email to registered users. And I want simple test case for that users email module. In this module I am taking a user from database and selected users ...
1
vote
1answer
23 views

Are tests built into contrib modules a reliable way of testing the success of a module upgrade?

I have been updating some modules including Views and Feeds. Given these modules are quite complex, I thought a good method of testing whether the update was successful or not was to run the tests ...
1
vote
1answer
31 views

module_load_include fails on WebTestCase post

I am writing test cases for my website using SimpleTest module. One of my test cases uses the following sequence $this->drupalGet( "myurl" array('query' => $params)); ...
0
votes
1answer
55 views

Unit testing on windows

I hope this question is not very naive, the problem is that in Drupal 8 there are several unit tests written for modules and I want to test them. But since I am on windows os I am not able to figure ...
0
votes
1answer
107 views

Functional testing without using simpletest

I have recently joined a Drupal project at work that is approx 50% finished. Functional testing was never part of the project. The site has about 8 custom modules and they are not going to be used ...
1
vote
0answers
41 views

Fatal Error while sending a multipart POST request to a image upload created using Field API

While testing a site i created using "Acunetix" web vulnerability scanner, it posted a multipart request to a image upload field created using Field API. The test manipulated a POST statement and ...
0
votes
2answers
38 views

Is there an efficient easy way to test Drupal code while developing it?

While writing code making sure, for example, I'm access the correct array property I keep refreshing the browser.(Or, that I didn't make a semantic mistake like that last sentence but in code) Is ...
1
vote
1answer
18 views

How do I run Drupal SimpleTest example from Examples for Developers from the CLI?

I've been running tests from a helper_module_preprocess_html function that I trigger on reload. I think I need to level up with testing. I have a vanilla installation of Drupal, downloaded and enabled ...
0
votes
1answer
22 views

Different page appear when testing

What I want to do is checking whether a link is exist on frontpage. I've set up a content with with node id 5 as my frontpage. But when testing it, and see the verbose message ...
4
votes
1answer
31 views

How do I re-queue a test that has been postponed on Drupal.org?

I'm trying to run the tests on a patch on Drupal.org. The relevant issue is here. The status is marked as Test request sent but more than a week has passed and the test hasn't been run. I tried ...
3
votes
1answer
343 views

Drupal 8 trying TDD with PHPUnit

I'm trying out the built in test driven development method in Drupal 8 but I'm running in to a problem.. I'm getting the following errors when trying to run ./core/vendor/bin/phpunit --list-groups ...
0
votes
1answer
328 views

How to log in to Drupal 7 website with jmeter

I am trying to set up an load test using jmeter. As part of the test I want to be able to log in as the site administrator and then go to admin page. For some reason the test is not able to login as ...
0
votes
2answers
103 views

How do I debug a the output errors on SimpleTest when I'm not sure where in the script the error occurred?

I'm trying to build a simple test. I'm having trouble submitting webforms. With help form a previous question I've cobbled together these functions within the larger class. They completely work in ...
1
vote
1answer
94 views

Asserting a failed login attempt on Simpletest

I want to test a module that adds an additional login validation clause. Only users whitelisted somewhere else are allowed to log in to the system. In order to test this behaviour with Simpletest, I ...
2
votes
3answers
812 views

Creating webform submissions programatically in order to use with SimpleTest

I'm trying to build out a SimpleTest to test out functionality on submitted webforms. I need to simulate loading a drupal webform node, applying fake data, and submitting the form (triggering a ...
1
vote
1answer
91 views

Simpletest fatal error without message

locally my unit tests run just fine. On my online dev server, they fail and I don't get any error message despite "The test did not complete due to a fatal error." in the test messages and "An ...
3
votes
1answer
266 views

How to bypass CAPTCHA during Behat functional testing?

We have a site that uses the CAPTCHA and CAPTCHA After modules to protect forms from invalid submissions. We're doing some functional and BDD testing using Behat and the tests are sometimes triggering ...
1
vote
0answers
11 views

Understanding Pantheon Workflows and Best Practices for Deployment to an Active Site [duplicate]

I've currently moved an active user site over to Pantheon. It's structured and themed extensively using Panels Everywhere, Panels, Views, and Display Suite. What I would love to do now, is on the ...
0
votes
0answers
52 views

Simpletest: working with sessions and custom function

I need to add a simpletest case to my custom module. Module functionality: The module has a function to store data on $_SESSION, on the next page load if $_SESSION has a custom value a javascript ...
1
vote
2answers
130 views

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

I'm working on the D8 version of the CAS module. To integrate with a single sign on CAS server, this module will have to redirect the user to the CAS server often, and occasionally make cURL requests ...
2
votes
0answers
23 views

Views not working with Simpletest

I have just started using the Simpletest module for Drupal 7. I am trying to use the drupalGet function to pull a URL. The URL is a views module URL. I am able to pull other pages using the ...
1
vote
0answers
25 views

How to non-destructively test file-detection functionality

I am writing tests for a module that is dependant on an external library, located in: sites/all/libraries/mylib I have written a hook_requirements to check for the presence of this library and ...
6
votes
2answers
3k views

How to run PHPUnit tests in Drupal 7?

Drupal 8 is supplementing the testing framework based on Simpletest with PHPUnit, and Simpletest could be removed in Drupal 9. I'm not upgrading yet to Drupal 8, but I was wondering how I can write ...