I’ve been working with angular a while now but I have to admit, the testing side throws me. Every time I start to tackle it, I find myself distracted from the test I want to write by all of the things I need to mock. Sometimes it feels like I need to build an entire mock framework to test one feature. Maybe I’m doing it wrong. Any tips appreciated, whether practical or even just the right headspace for approaching it :)
I haven’t worked with angular applications directly but I’ve worked on React applications and I’m guessing the approach to unit testing these will be similar.
I would start as simple as possible with the smallest test that would possibly work. If you find that you need an entire mock framework to test a feature it sounds like your components may need to be broken down further into smaller components as you have too many dependencies that need to be mocked. If you have smaller components that only require a single dependency then these components should be easier to test as the dependencies will be easier to mock.
If retrofitting unit tests into your app is still too difficult you could try to automated some key end-to-end scenarios using Protractor, but I’d discourage you from going overboard since these can quickly get out of hand. You may still benefit from having a few of these tests even if you get unit testing of small components working well to ensure the small components work well together.
I hope this helps you Ben 😊
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?
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?”
It’s been a while since I wrote something on this blog as you could say my life has been a bit complicated.
Continue reading “A brief update & AMA II”
One of the themes I talked about during my presentation in Wellington was the blurry line between test and development in a distributed environment like Automattic.
I was recently having trouble with a complex method in our WordPress.com e2e test page objects, so I used my skills as a developer and wrote a change to our user interface which adds a data attribute to the HTML element.
This meant our page object method immediately went from this:
Continue reading “The blurry line between test and development”
I recently saw Basecamp made their employee handbook available online1 and this statement stood out to me in their moonlighting guide:
2. Go out on a regular speaking circuit tour which is going to require multiple days of travel multiple times a year. That’s too disruptive to our own work schedule and to your fellow teammates.
For this exact reason, without knowing, I created my own personal rule2 of only committing to doing one conference presentation per year.
Continue reading “Staying focused with one conference presentation per year”
This are my slides during my presentation on distributed testing at the ANZTB Test 2017 Conference in Wellington, New Zealand last Friday 5th May 2017.
Continue reading “The future of testing is distributed”
“Most of us are anxious pretty much all the time – but frequently imagine that other people aren’t. It’s time to admit the truth. Anxiety is just a basic fact about being human.”
~ Alain de Botton
We are all human, we are all worried and anxious pretty much all the time, people just don’t tell you that they are. We wear masks and we hide it well.
But why do we test like we’re not anxious or worried? Why don’t we test for real life?
Continue reading “Test for Real Life”