Menu Sidebar

WordPress needs automated browser/integration/end-to-end testing

One thing I love most about WP-CLI is its Behat-based test suite. In fact, if you consider WP-CLI successful at all, I'd attribute said success to the test suite.

Having a great test suite ensures exceptional build quality because:

  • It’s easy to write new tests, which means they actually get written.
  • The tests interface with a command in the same manner as users interface with a command, and they describe how the command is expected to work in human-readable terms.

WordPress should have amazing integration tests too.

Historically, PhantomJS has been the de-facto standard for headless browser testing. PhantomJS is also Yet Another Abandoned Open Source project, and generally a pain to deal with. But we're in luck! Headless Chrome shipped in Chrome 59. It's pretty amazing. For your next side project, try out the Puppeteer library.

Now that we're over the headless browser hurdle, implementing automated browser testing is simply a matter of:

  1. Picking a framework. Behat is one option (see WordHat for an example), and Codeception is another. I like Behat, but Codeception is based on PHPUnit which might be a perk.
  2. Setting up a Docker container to provide a WordPress install in an isolated environment. For ease of use, Chrome headless could be provided in another container.
  3. Writing some tests. Prior to writing tests though, it would be helpful to plan out all major UX flows we want to cover with tests.

In fact, I'd argue that integration tests will be key for managing breakage when Gutenberg lands in WordPress core.

What would be really neat is if the test suite supported importing some base "state", such that it'd be possible to easily run the same test against dozens of scenarios. This would let us perform an experiment where run the test suite against every plugin in the plugin directory.

Titles for blog posts I haven’t written

  • The many different correct ways to write a WordPress plugin
  • How raising kids has taught me to give zero fucks about open source
  • If you work in tech, income equality is the real problem you should hack on
  • What I’ve learned about personal finance in the last year, and how it’s completely changed my perspective
  • All of the code I regret to have written
  • Open source is debt, not an asset

Going for it

Today’s milestone: I’m ready to kill the consulting cash cow and start a product business.

The startup media is full of stories of twenty-somethings grinding out long hours for little to no pay to build their business. When you have a wife and kids dependent on you keeping food on the table, reality is much different. A speculative gamble is exactly that: a gamble.

However, I’ve finally achieved enough confidence to start pursuing my dream more aggressively. The contributing factors include:

  • Late November and December are slow in the consulting world, which makes it the perfect time to explore.
  • Our family monthly expenditure is relatively stable, so that part of the budget is manageable.
  • Good amount of cash runway for if/when I decide to go all-in on a given product idea.

I feel I’ve hit 70% degree of certainty in knowing what I need to do. The why is the motivating factor. A fulfilled life is one full of actively-sought challenges. Once you’ve de-risked the opportunity sufficiently, it’s just a matter of getting out there to do it.

Massive list of links: November 13, 2017

In honor of Nat Torkington’s Four Short Links, I present you: a massive list of links.

  1. The Personal MBA (Josh Kaufman) — As the title implies, everything you’d get from a MBA in one book. Except the school name and associated tuition bill, of course.
  2. The Quarterlife User Manual (Rob Montz) — Succinct set of guideposts for those who haven’t figured out their careers yet.
  3. Building Habit-Forming Products with Nir Eyal, the Author of “Hooked” (The Indie Hackers Podcast) — Seems sketchy, but actually really useful framing for product development.
  4. How Business Contributes To Income Inequality (Money For The Rest of Us) — Big companies used to put their customers, employees, and communities first. Now they put their shareholders first. Lo, problems arise.
  5. Extreme Ownership: How U.S. Navy SEALs Lead and Win (Jocko Willink and Leif Babin) — I thought this book would be too bro-y and ended up loving it. If you like action movies at all, you get a two for one: business lessons told in an entertaining way.
  6. On Writing Product Roadmaps (Gaurav Oberoi) — Well-communicated overview to quarterly vs. long-term planning.
  7. Barba.js (Luigi De Rosa) — Single-page app experience without a complex SPA framework.
  8. Being a Startup Founder is a minimum wage job — Here’s the proof (Brandon Evans) — Brutal economics of VC-backed companies.
  9. The Power of Anti-Goals (Andrew Wilkinson) — Instead of focusing on aspirations, prioritize based on avoiding negatives (tired, too busy, etc.).
  10. The Minimally-nice Open Source Software Maintainer (Brian Anderson) — Identified tactics: respond quickly, give thanks, pay a compliment, say “yes”, be clear about what you expect, admit your mistakes, be effusive.

Social media suicide

Today I deleted my Facebook, Twitter and LinkedIn accounts. It’ll be 30 days before it’s a permanent decision. And yes, I did this once before.

But why?

They’re addicting, and I don’t want to be addicted anymore. I also believe their businesses are morally reprehensible, dependent on exploiting human psychology.

But you can always reset your password so you can’t log in.

I did that. It’s like locking the alcohol in a cabinet that you still have the key to.

Blogs are cooler. You should blog too!

Slack is the new email

Does this look familiar?

Person A [6:37 AM] Please ping me when you are online.

Person B [7:42 AM] What’s up?

Person A [8:56 AM] What do you think about topic X?

In case it’s not immediately obvious, this conversation is horribly ineffective. It’s imprecise, has a high degree of latency, and is hugely wasteful.

Email gained a bad reputation because people started abusing it. Slack is the new email because it’s become an “all-day meeting with random participants and no agenda.

I deleted the Slack desktop app a while back. Being signed in to a dozen plus Slack organizations led to notification paralysis — the unread indicator made it impossible to get anything done. Since then, I open the corresponding Slack organization when I’m actively working on a given project, and leave it closed otherwise.

But, this approach still has the problem of mentions / direct messages, email notifications, and high latency. Going forward, I’m instituting a new policy of encouraging email (or some other async medium) when I’m not actively signed in to Slack. If you see me online, feel free to ping me. Otherwise, please use a more appropriate medium.

Thank you, Grandpa

Thank you for your love of the outdoors, because of which I appreciate them too.

Thank you for introducing me to dehydrated foods, yet another under appreciated quality of life.

Thank you for your strong sense of sensibility. Even though it can be difficult to resist desire, delayed gratification is always more rewarding.

Thank you for encouraging higher education. Even though I didn’t manage to graduate college, your expectations set a high bar to reach.

Thank you for my father. I obviously wouldn’t be here today without him. But even more so, I am a strong reflection of him, and he a strong reflection of you. Everything I appreciate and value is a manifestation of your strength of character.

Thank you for my aunts, uncles, and cousins. As I’ve grown older, I’ve realized how lucky I am to be surrounded by a loving, fun, thoughtful and caring extended family.

Grandpa, you’re neither gone nor forgotten.

You’re still here with every one of us — in fact, we’re inseparable. I know that I can always spend time with you by going mushrooming in the woods, cooking good food for my entire family, and holding myself to higher standards.

I’m only 30 and still my time on earth is limited. I’ll consider myself successful if I manage to have half the impact you’ve had.

Love you, Grandpa.

Newer Posts
Older Posts

Daniel Bachhuber

Proud father and husband. Principal, Hand Built. Maintainer, WP-CLI. Sales, rtCamp.