Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [testing]

The tag has no usage guidance.

-1
votes
0answers
9 views

How to create KDF framework in selenium?

How to create KDF framework in selenium? Exception in thread "main" java.lang.NullPointerException at executionEngine.DriverScript2.execute_Actions(DriverScript2.java:61) at executionEngine....
0
votes
0answers
17 views

Faster Unit Testing in WordPress?

I'm using WordPress Unit Testing to develop a plugin. The Unit Testing is the one provided by WP-CLI with the wp scaffold plugin-tests command: https://make.wordpress.org/cli/handbook/plugin-unit-...
0
votes
0answers
22 views

Integration test - remove the mu plugins in the test

As a recurring theme these past few questions I asked, I'm doing integration testing and want to check the activate static method that gets called in my register_activation_hook in the main plugin ...
1
vote
0answers
18 views

Integration testing - test is_wp_error in the code?

I'm testing ajax callback in my plugin that is used to import users from JSON file. I have tested everything, but one thing. In my import callback I have: $user_id = wp_create_user( $username, $...
1
vote
0answers
20 views

Am I testing this right?

Since I need to have 100% test coverage for the client, I'm writing integration and unit tests in my plugin. And I have a method in a class that is hooked to admin_menu hook, which adds submenu. ...
0
votes
0answers
16 views

Advice on automated testing

Hey I need to automate e2e tests for a site in wordpress I normally just use WDIO, Cucumber and Selenium for my web tests but this isn't working for this site the content is always in flux customers ...
0
votes
0answers
16 views

Integration tests test script enqueue/register fails

This question is related to this SO post I'm testing a plugin, and in it I have public function enqueue_scripts() { $main_style = 'public/scripts/application.js'; wp_register_script( '...
3
votes
2answers
55 views

Revert WordPress default options after a PHPUnit test has run

tl;dr: is there a way to make changes to WordPress options during a PHPUnit test suite execution, and have the changes reverted to the WordPress defaults before the next test suite is executed, ...
0
votes
1answer
61 views

.PO file is found but I don't see translations: how to debug the problem?

I have installed the Stack theme, and I want to make Danish translations. I have downloaded the Stack.pot file, made the modifications I need, and uploaded them to: /wp-content/themes/stack/languages/...
2
votes
0answers
310 views

Deploy WordPress From Local Docker to Hosting Provider

I've seen articles that teach how to migrate WordPress into Docker containers (see also here). I want to do the opposite. I am already running WordPress locally via Docker on my Windows 10 laptop. I ...
1
vote
1answer
189 views

How to create a network using a command line script?

I would like to run UI automated tests for my WordPress plugin. I am using Docker to run a WP instance and it runs my tests, that is fine. I am using wp-cli to install and config a testing site. I ...
1
vote
1answer
214 views

Why is WP_Mock not used instead of WP_UnitTestCase for writing unit tests by most plugins?

For writing unit-tests, why do most plugins use WP_UnitTestCase instead of popular libraries like WP_Mock? The reason I am asking this is because WP_UnitTestCase doesn't seem to be a unit test case ...
0
votes
2answers
26 views

Making sure updates didn't break anything

I am tasked with updating plugins and core on a number of blogs that I am completely unfamiliar with (nothing weird about them, but I haven't worked with them before today). What I need to do is ...
0
votes
1answer
100 views

Duplicated site isn't recognized as a site

I've duplicated a site using the following code. All code worked fine until the last row (the site itself goes up on the web but the last row of code fails and I get an error): echo "Please enter the ...
3
votes
1answer
69 views

Best way to notify WordPress plugin users of new release candidates for beta testing?

Over the years I have developed a few WordPress plugins for my own use and shared some via the WordPress.org plugins directory. I have recently made some changes to one of my shared plugins and would ...
2
votes
1answer
857 views

How to login to WordPress site using basic authentication HTTP headers?

I'm looking to run some of my automated acceptance tests as a logged in user. My acceptance tests are run using Ghost Inspector which can send basic authentication headers. There is a basic ...
0
votes
1answer
900 views

Testing localhost WordPress site over LAN with iPad, iPhone

1 down vote favorite I am developing a Wordpress theme that requires testing with multiple devices over my local network. I use the localhost server XAMPP which runs apache on port 80. When I access ...
0
votes
1answer
46 views

How to set up a development/staging site to make major changes to the theme then update on the live site?

I made a site a few months ago without using a development or staging environment. I just updated everything on the live site, which was fine at the time because the domain wasn't public. We were ...
0
votes
1answer
45 views

Testing Plugins for Multisite

I have recently published a WordPress plugin and it works great on single sites. I was informed that the plugin is not working correctly on multi-site installations and I understand a few of the ...
1
vote
1answer
93 views

How can I test why the comment hook is not working?

I am trying to perform an action after a comment is approved. What this action is, is to register the commenter automatically using register_new_user, using the commenter's name as the username, and ...
0
votes
1answer
33 views

Identifying where plugins are being used in your wordpress install

I've inherited an existing wordpress installation and there are several plugins (active and inactive) that I'm unfamiliar with and unsure if they're even still being used in any fashion. Once I see ...
0
votes
1answer
18 views

Limit Google Ads to particular blog posts

I want to introduce Google Ads on my website. But to start on I want to do it only on a particular blog post. It is part of some real-time testing that I need to do. I want to use Google AdSense ...
3
votes
1answer
192 views

Using wp_mail during an integration test

I'm working on some tests for WordPress, and I discovered that WordPress' PHPUnit automatically captures and doesn't send emails (using MockPHPMailer) when I try to use wp_mail. I've looked, but I ...
-1
votes
3answers
300 views

How do I set up a test environment in a sub-folder?

I have my first-ever, live client who needs a website completely re-done. We're leaning towards setting up a premium WordPress theme. I've done this for close friends and family members before (set ...
0
votes
0answers
26 views

How to test if in dashboard, bypassing Ajax quirk

As the function is_admin() will be fooled bay Ajax requests, what is the best what to test if we are in the dashboard? We could test the URL, spotting "wp-admin" but it doesn't look as a very elegant ...
0
votes
1answer
34 views

Set up PHPUnit with WordPress: The WordPress tests are 3 - 4 years old; does it matter?

I'm trying to set up PHPUnit with WordPress, and the tutorial I found tells me to download this repository so that I can bootstrap the WordPress environment to run my tests. The only issue I have is ...
7
votes
1answer
307 views

Unit tests - Dealing with dependencies

This might be seen as a corollary of Testing hooks callback. The issue: I want to test a class which creates a new instance of a My_Notice class defined outside the plugin (let's call it the "Main ...
0
votes
2answers
41 views

Best way to move a site to a subfolder for testing purposes?

I have to make several changes to a website, and I'm willing to setup a copy of the current one on a subdirectory, on the same server. I.E. if my site is www.example.com, what I'm trying to do is to ...
0
votes
1answer
360 views

Unable to find PHPUnit code coverage stats

Where should I check for the code coverage stats when using PHPUnit for WordPress? My WordPress setup: I have setup WordPress using VVV and my testing suite includes PHPUnit and WP-CLI. How I ...
8
votes
1answer
448 views

Writing test cases for a WordPress Plugin that has translations

What is my aim? I'm looking forward to write test cases for the available translations of a WordPress plugin. My approach: I have setup WordPress using VVV and my testing suite includes PHPUnit and ...
0
votes
1answer
160 views

How to automate post update website check?

I maintain clients' Wordpress websites (~25 installations) as a part of my job. To do this quickly and efficiently I use Jetpack's "Manage" feature. In case something went wrong I have fully automated ...
1
vote
1answer
68 views

How to test drive WordPress on VPS with LEMP stack before going live?

I have example.com up and running on a VPS droplet running Ubuntu 16.04. The website was built with WordPress on LEMP stack (Linux EngineX MySql and PHP) which was done using EeasyEngine. EasyEngine ...
8
votes
1answer
445 views

Proper unit testing in WordPress

There are different threads available for Unit Testing in WordPress. As far as concern, there should be a proper unit testing for every piece of customization done in WordPress. I have checked couple ...
2
votes
0answers
62 views

Can I check plugins and themes for PHP 5.6 ahead of global PHP server Update

My server is updating to PHP 5.6 next week. I manage about 30 WordPress websites. I looked for a plugin that would check if any of the code throughout the other plugins and theme would break with the ...
1
vote
0answers
57 views

Is there a way to mock update_option for unit testing?

I'm currently building some unit tests, and have just started playing around with WP_Mock. I'd like to test a function that fetches the site description; I want to test if it responds as expected when ...
0
votes
1answer
73 views

A/B test options at the widget level [closed]

I am looking for a method to show 1 of 3 different widgets on my site's homepage. I could do this with javascript, but this would increase page weight and I would rather do it at time of render (...
5
votes
1answer
1k views

Unit testing in the WordPress backend (is_admin() is true)

I've asked this on IRC, Twitter, Slack — am utterly astonished by how difficult it is to locate the answer to this: I have a bunch of plugin code that only runs when is_admin() returns true, i.e., ...
1
vote
0answers
126 views

How to run subversion and staging environments when running Wordpress

I come from a .NET world with custom solutions, where I am used to multiple staging environments and subversion for everything. I've been googling a lot, and have some questions on how handle highend ...
1
vote
0answers
307 views

How to use Wordpress methods (themes, plugins, context) with Behat?

My Wordpress project is running with a composer inside my plugin folder, just to test Behat a little bit, i'm not using Bedrock Wordpress yet. I can run Behat to do some behavior tests using the ...
0
votes
1answer
57 views

How to properly maintain a testing version of a site?

At my place of work we host many sites that almost all run Wordpress. Some of them are changed quite frequently, and emply e-commerce solutions such as WooCommerce. Consequently, these sites also use ...
2
votes
1answer
34 views

Is there a way to activate different theme for specified users? [closed]

I'm looking to allow beta testing of a theme on WordPress site in production. I was thinking of a plugin to check if WordPress user has been selected for beta phase, and if this evaluates to true ...
0
votes
1answer
356 views

Duplicate WordPress site to subdirectory but use same db?

I have tried to just copy the whole root folder into a subdirectory. I understand the .htaccess file has to be changed. But can't get it to work right. Is it something more than changing the htaccess ...
9
votes
3answers
395 views

Vagrant script to setup all the common PHP / WordPress version combinations

I am looking for a way to quickly and repeatedly set up testing / debugging environment for our plugin, most probably using Vagrant. Projects like VVV focus on a single-environment setup (or, a couple ...
0
votes
1answer
30 views

Available methods for a/b testing the content

I've been looking around for split testing solutions for wordpress and most answers point to the now-outdated shrimptest plugin. I'm not really interested in using a plugin anyway, unless I write it ...
1
vote
2answers
843 views

How to add an image for unit testing?

I have to test the function where it calls wp_get_attachment_image_src. How do I add an image for testing, because right now if I call this method it returns false.
28
votes
1answer
6k views

Testing hooks callback

I'm developing a plugin using TDD and one thing that i completely fail to test are... hooks. I mean OK, i can test hook callback, but how could I test if a hook actually trigger (both custom hooks ...
1
vote
1answer
700 views

How to initialize something in unit test before the init hook being called?

I've a simple PHP Unit written for WordPress and want the initialize code before the main 'init' action being called from the plugin I want to test, e.g. class MyPlugin_Test_Example extends ...
0
votes
0answers
37 views

Unit Test ignores stubbed method second time around in a dataProvider

I am writing a sample unit test that checks a title of a post for a token and if it exists add the post to a category. https://gist.github.com/matstars/bebedbacedd7a85d8dc7 In my test for this I am ...
1
vote
2answers
803 views

Activate different theme for temporary preview

I wanted that when i access my site with specific parameter, my site used a different theme at that moment (only temporarily, to show only to me as a preview). I want it for test purposes. Is there ...
2
votes
1answer
1k views

How to properly test a method that is called by an action hook

The constructor in my class adds an action to the 'init' action hook: class My_Custom_Post_Type { function __construct( $type ) { $this->type = $type; add_action( 'init', ...