How to get cheap software for WordPress using Test Driven Development.
Post an ad on a site like Upwork.com or Freelancer.com for a low cost PHP programmer, and you’ll experience something unlike anything else in business. You’ll receive applications faster than you can possibly read them. A vertitable gusher of low grade computer programmers. Give me your tired, your poor, your huddled masses.
$5/hr software developers, what could go wrong?
Obviously a lot. However, these programmers represent a massive untapped talent pool, and Test Driven Development is the technique you can use to leverage this talent. Using TDD, you can safely, effectively, and efficiently use low cost human talent on your projects.
Issue #1: Quality of work
Issue #2: Onboarding and retention
Issue #3: Security
Concept Massive talent pool
Concept Cost comparisons
Concept No employees
Concept 24 hours a day
The quality of work done by low cost outsourcers is an obvious issue. You can overcome this problem by instituting a strict Test Driven Development cycle with your programmers.
The quality of work done by low cost outsourcers is an obvious issue. You can overcome this problem by instituting a strict Test Driven Development cycle with your programmers.
Technique: The 4/7 work unit
When hiring low cost outsourcers, I use what I call the 4/7 scheduling technique. The work day is 4 hours long, and one week out.
4 hour work day: I have noticed that computer programmers work approximetely for four hours. If you make them sit in front of their workstations for 8 hours, you get about the same ammount of work done as when you sit them down for 4 hours. I leave it to the philosophers to discuss why, it’s just true. Knowledge workers should work in 4 hour shifts.
One week out: I hire low cost LAMP programmers on sites like Upwork and Freelancer all the time. You can debate the morality of hiring overseas, or offering low wages, but you shouldn’t debate the metrics.
You can post an ad for a PHP programmer and from the moment you post the ad until the time the programmer is working can be as low as 15 minutes. So there is no lag time to get the worker.
The concept of “one week out” means that if you hire a programmer this way, he will work for approximately one week before you notice a significant drop off in the quality of work, or the outsourcer simply stops responding. This is just a fact of life. How long would you keep working an $8/hr job with zero chance of promotion? These people aren’t stupid, just broke. It’s fine to offer a low wage, because that’s money that human being wasn’t going to have before they met you. Be upfront. Don’t nickle and dime. But don’t expect that person to be happy about it, and don’t expect them to do any kind of work that requires them to sleep on it. They’ll decide there are greener pastures somewhere else.
This is fine though, and part of the paradigm. As long as you maintain security best practices, high turnover isn’t a problem.
Test Driven Development really shines as a methodology when you have low skilled programmers. It simply produces very high quality code, it’s just time consuming. With ultra low cost programmers, time isn’t a factor. You can just hire more manpower and go to a 24 hour schedule.
In terms of WordPress, the difficulty lies in setting up the test environment. Low cost programmers can easily understand the TDD cycle, and can be taught quickly how to write tests. It’s the setting up of the system that they can’t do.
You should setup the development server yourself, and simply give access credentials to the
What is a feature?
A featureis an aspect of software that is useful. Anything you can express, that is possible, and that you can afford, can be a feature. A bug is an aspect of software that isn’t useful.
Since we’re talking about development, we’re discussing software features that don’t exist yet. These are features that we would like to build, or existing features that we would like to make better. Describe a feature with should statements:
It should email all the clients once a month.
The client should have a setting page in the admin area.
The plugin should have a custom post type called GPS coordinates for each subscriber.
The div should show a timeline of Civil War battles in the footer area.
The next statement you should create is the reasonfor the feature you are requesting. What is the business value of this feature? Describe the reason by using a “Because”, or “So that” .
So that the clients are routinely updated.
So that the user can change the settings.
Because we need to store the GPS data.
Alternatively, you can use Gherkin syntax for feature development.
To do Behavior Driven Development [BDD] in WordPress, you need to get the tools! Here is the stack you should use:
Operating System
Ubuntu. I personally use an Ubuntu 20 development server on my MacBook Pro laptop. You can run Ubuntu on most machines with a USB memory stick, and it’s free. I use Ubuntu on the Amzaon AWS remote cloud servers and production servers. Ubuntu is a brand, but it’s just a Debian based Linux distro, so it’s future proof. If you stopped liking Ubuntu, you could switch to another distro without hassle.
You can also use Mac or Windows.
Containerize?
Many teams who do testing use virtualization like kubernetes or Docker. I don’t quite undertstand the rationale for this in 2020. An entire serve is virtually free, so why btoher with a server within a server? I prefer to use full blown, cloud based WordPress sites. Just use a dummy domain name.
Get the stack
Once you have a machine with Ubuntu running, you can load the entire development stack by running a single command: source <(curl -s https://raw.githubusercontent.com/johndeebdd/Remote-BDD-Setup/master/installScripts/wordpress.sh) Directions
Test Framework
Codeception with WordPress modules - PHPunit is the standard and default library for doing unit testing in PHP. CodeCeption INCLUDES PHPunit, as well as a whole series of libraries for doing BDD.
End to End [E2E] Testing
You should use the WPWebDriver and WPDb modules. You can use Selenium to drive a full browser. You can write your test in the Gherkin format, or in procedural PHP. Generally, I consider Gherkin cumbersome and not worth the candle. Sample acceptance.yml
WP-Unit testing
You should use the WPloader and WPQueries modules. Sample unit.yml
Where does code live?
Use a Git repo. Use Github for code that has a public face. Use Bitbucket for private repos [or pay Github for a private repo, either way].
How do you control outsourcer Git commit access?
First setup a few emails: freelancer1@yourdomain.com, freelancer2@yourdomain.com etc. These accounts are granted direct commit access to the repo. Give the outsourcer access to the email account. The repo itself can set a webhook to pull to the production server upon commit. When you want to freeze the outsourcer from the project, you just change the password on Github and email accounts. The project manager retains access to pull to production. The outsourcer can make a commit and it appears directly on the development server. When the commit is approved by the project manager, he does a manual pull to the production machine.
How does the outsourcer work on the code?
Some programmers will have their own IDE setups that they like and know how to use. Eclipse is the best free IDE, while PHPStorm is probably the best commercial IDE. If they know how to pull down from Github and run the code on a local host, great. If they don't know how to do that, setup a development server in the cloud for them. Our stack include the Codiad IDE, which is an open source IDE similar to PHPStorm. TO access it, just go to /codiad/ on your development server, it's all setup already.
How do you run the test suite?
cd /var/www/html/wp-content/plugins/{project dir}
bin/codecept run -vvv --html
How do I see the test results?
They appear in the terminal, or at http://yourdomain.com/wp-content/plugins/{project dir}/tests/_output/
Usually in the terminal you can use the up arrow shortcut.