TestBash Sydney: Automated e2e Testing at WordPress.com

This is an approximate transcript of the talk I delivered at TestBash in Sydney on Friday 19th October 2018.

Alister Scott Test Bash Sydney Oct 2018-1-1

Today I’d like to share my story about how we started with automated end to end testing at WordPress.com since I started at Automattic over 3 years ago.

Alister Scott Test Bash Sydney Oct 2018 2-2

Continue reading “TestBash Sydney: Automated e2e Testing at WordPress.com”

AMA: Separate Repository for e2e Tests?

Liam asks…

“I did enjoy reading the article about e2e test on wordpress. I noted that e2e test are in a separate repo.

My question will be what is the workflow to make sure new changes does not break the e2e test on pull request ?

For example, if a developer work on some changes, then they need to change the e2e test first and make sure everything pass, however the environment on the pull request might not be stable, developer can overwrite each other changes”

My response…

Thanks for your question Liam.

We have reasons for and benefits in having the WordPress.com e2e tests in a separate repository:

  1. The e2e tests test the entire WordPress.com experience so these test things that happen in different repositories (for example our Calypso user interface or services/API) and having them in the user interface repository isn’t really representative of what the breadth of their scope;
  2. Making changes to the e2e tests are easier in a separate repository since we don’t have to deploy e2e PRs that don’t contain functional changes (we deploy every merge to our master branch immediately dozens of times per day)

The obvious downsides are:

  1. How do we make sure e2e tests know about incoming AB tests?
  2. How do we couple new changes to updates in the e2e test repository?

For incoming AB tests we make sure that our e2e tests know about the change by ensuring we create a matching PR in our e2e tests that override our AB tests during our test runs.

If someone updates the AB tests in Calypso they’re politely reminded to update the e2e tests:

Screen Shot 2018-09-19 at 3.31.47 pm
example prompt

For making sure e2e tests are up to date we automatically run two (of about 40 total) of the most critical e2e tests (in three browsers) when a PR is ready to be reviewed. These can fail and indicate a change is necessary to the e2e tests (or something is broken!)

There’s also a label we can add to any PR that runs the entire set of e2e tests against a PR running live and reports the result back to that PR:

Screen Shot 2018-09-19 at 3.38.29 pm
e2e Test Results against a Calypso PR

If changes are required to the e2e tests someone can create an e2e PR with the exact same branch name which will be used to run against the feature changes before they are merged. This means PRs can be coupled and tested together but merged separately.

To answer the second part of your question I understand it to be about conflicting changes? One of our key philosophies for work is “merge early and merge often” so we make sure that PRs are short-lived and merged quickly to minimize the chance of conflicts. These still do happen occasionally, we just deal with them as they come up.

Whilst there’s been some downsides to the separate repositories all-in-all the benefits continue to outweigh the downsides but we constantly assess and at any point in time we can easily merge them if need be.

Three Years of Working From Home

This month marks my three year anniversary (Matticversary) at Automattic, which  means I have been solely working from home for three years now.

Working from home every day can at times feel like either, or both, the best thing in the world, or the worse thing ever invented. I personally don’t believe that full-time working from home is suitable for everyone as I’ve found it orders of magnitude more difficult than working in an office environment.

i-cant-remember-do-i-work-at-home-or-do-i-live-david-sipress

It’s taken me almost three years to really work out what works well for me as a full time “telecommuter” – and I thought I’d use my work anniversary to share some of these.

Like anything, you’re mileage my vary, but these tips have definitely helped me over the years.

    1. Create a morning routine: since I don’t commute I’ve found it hard to mentally separate finishing non-work time and starting work time in the morning which is something a commute provides (without you realising). Since I have a flexible schedule I make sure that in the mornings I have a routine. I am lucky enough to live right next to a beautiful forest so I go for a 4-5km walk each morning which not only provides exercise and nature exposure benefits but symbolises to my brain that work  begins at the end of my morning walk. This can sometimes be hard to justify to myself as some of my colleagues are finishing up around the same time as I am walking – and I may miss checking in with them – but I definitely need this morning routine.
    2. Dedicate a home office space: as a family of five we live in a small cottage so it’s hard to justify a dedicated home office space in our home, but I’ve found it vital for separating my home and work lives. When I’m in the office I am working – when I am not in the office I am not working. My three children know they can’t play in my office – if I take a break to spend time with them I come out of my work space. I read in The Organized Mind book that “students who studied for an exam in the room they later took it in did better than students who studied somewhere else”. I believe this is due to the mental association.
    3. Dedicate a computer just to work: again this seems luxurious but having a dedicated work computer, or at least a dedicated computer profile/account, creates a good association between that computer and work. From The Organized Mind book again: “Create different desktop patterns on them so that the visual cues help to remind you, and put you in the proper place-memory context, of each computer’s domain“.
    4. Disable app notifications on your phone: unless I’m an in person work meetup (which happens a few times a year) I disable app notifications on my phone for work apps (like Slack, WordPress and GMail) which means I rarely check or open those apps outside of my work environment (see #2 and #3).
    5. Avoid checking work in bed: it’s very tempting to check on work things on my mobile phone in bed, particularly when you work for a global 24×7 365 company like I do, but this disrespects the importance of sleep in our lives. As Matthew Walker, one of the world’s leading sleep scientists says in Why We Sleep: “The silent sleep loss epidemic is the greatest public health challenge we face in the twenty-first century in developed nations. If we wish to avoid the suffocating noose of sleep neglect, the premature death it inflicts, and the sickening health it invites, a radical shift in our personal, cultural, professional and societal appreciation of sleep must occur.” You can use a morning ritual (see #1) to signify when you’ll start checking work things, instead of opening your eyes in bed and checking work immediately.
    6. Create an end of work day ritual: I am my most productive in the hours leading to dinner time so I use dinner time as my end of the work day ritual when I transition from working to not-working. I also have a couple of apps on my phone I like using and I don’t let myself use them during the day so I can signify at the end of the work day when I’m not working. Like a play reward that a working dog gets when they’re finishing working.
    7. Find social activities outside of work: working from home all the time can get very, very lonely and you can feel particularly isolated – especially working for a global company with flexible work hours, and having no team members close to your timezone. It’s important to find social activities outside of work as working in an office a lot of this is a given – even something like chatting to someone in the coffee room you won’t get working from home. I’ve tried attending Toastmasters, hiking groups and making sure I get along to meetups and user groups. Also I recommend meeting up with friends and ex-colleagues for lunches – travelling to where they work. This gives you a good break from working from home and can reduce the feeling of isolation.
    8. Spend some time away from home on holiday: this is one of the most expensive parts of working from home in my opinion, and it is easy to blow all the cost savings of not-commuting on holidays away from home that you need so you don’t feel like you’re at work. If you take time off and just stay at home (sometimes known as a “staycation”) I have found I don’t feel like I’ve really disconnected from work as I’m still thinking about work being home (even though I have a dedicated workplace – see #2). I’d love to work out a way to solve this one without spending more and more money on holidays away from home.
    9. Have something to listen to: I listen to electronic dance music mixes on Mixcloud all day long – but your tastes may vary. This provides a soundtrack for working.
    10. Set yourself a daily goal: I work in a Results Only Work Environment where my employer doesn’t care so much about my hours as long as I achieve results. This is both good and bad (I could write an entire post on it) but you need to be disciplined and set your set a daily goal and stick to it. Sometimes this means working longer than you planned, other times it’s important if you achieve your daily goal earlier than expected you finish earlier than expected to make up for all those other times. Otherwise you can get caught in a never-ending work loop.
    11. Close loops: working in a distributed work environment I find I have lots of different things on the go at any one time – this is because I might be expecting a reply or some work from someone else on something and everyone works different hours and lives in various time-zones. I find it’s important to re-visit all these “open loops” and close them, just so your mind doesn’t think about them anymore. This is sometimes a case of leaving a comment like “I didn’t hear anything back on it so I’ll close it” to close the loop – and remove it from your focus and bandwidth.
    12. Find tasks that you can finish to completion outside of work: most of the things I work on have a medium-to-long event horizon – or an indefinite horizon as I await asynchronous feedback – so I’ve found hobbies that I can finish completely in one attempt – gardening, cooking a meal, washing the car etc. are very important for my mental well-being as I get a good sense of accomplishment with these tasks and hobbies. See #11
    13. Getting things done creates motivation to do more things: when I lack motivation to start something I find the smallest thing that I can get done and complete that. The sense of accomplishment of getting something done motivates me to do more.
    14. Over-communicate: I can’t emphasise this enough – no one will see you in the corner of an office getting stuck on a problem – you need to constantly communicate everything you’re doing – good and bad. Communicating context creates empathy in a distributed team.
    15. Set expectations for family and friends: some people assume you’re not really “working” if you work from home. Setting aside a work space (#2) helps – but you’ll need to continually explain to people that even though you are at home you are actually at work.
    16. Don’t be afraid to ask ‘stupid’ questions: in a work from home environment there’s bound to be other people thinking the exact same thing as you – so ask away!
    17. Don’t be afraid to be a bit weird:Today you are you, that is truer than true. There is no one alive who is youer than you” (Dr Seuss)

 

That about covers it for now. As I said, working from home can be very rewarding, but it’s one of the hardest challenges I’ve ever faced, and after three years I’m still working at it!

Testbash Australia 2018

I only speak at one conference a year and this year that conference will be the first ever Australian Testbash in Sydney on October 19, 2018:

TestBash_Australia_2018_Adverts_DOJO_EVENT_BANNER.png

My talk:

At WordPress.com we constantly deliver changes to our millions of customers – in the past month alone we released our React web client 563 times; over 18 releases every day. We don’t conduct any manual regression testing, and we only employ 5 software testers in a company of ~680 people with ~230 developers across . So, how do we ensure our customers get a consistently great user experience with all this rapid change?

Our automated end-to-end (e2e) tests give us confidence to release small frequent changes constantly to all our different applications and platforms knowing that our customers can continue to use our products to achieve their desires.

Alister will share how these automated tests are written and work, some of the benefits and challenges we’ve seen in implementing these tests, and what we have planned for future iterations.

Takeaways: How to effectively use automated end-to-end testing to ensure a consistent user experience in high frequency delivery environments

Grab a ticket before they sell out #

→ How Canaries Help Us Merge Good Pull Requests

I recently published an article on the WordPress.com Developer’s Blog about how we run automated canary tests on pull requests to give us confidence to release frequent changes without breaking things. Feel free to check it out.

AMA: BA roles in Automattic?

Iroy asks…

Automattic uses interesting and fun names for different roles (QA being excellence wrangler). Are there Business Analyst roles in Automattic? If so, what is it called?

My Response…

At Automattic we differentiate between a Job Title and a Role. My (current) job title is indeed Excellence Wrangler and my role is Code Wrangling. Anyone is free to change their job title to anything they like at any time so we have some fun ones, whereas the roles are pretty static.

Continue reading “AMA: BA roles in Automattic?”