Tag: testing
-
Working with an old codebase today, I moved a method from one file to another. CI was happy.
Then I realised the method didn't have any automated tests, so I wrote one. It turns out its entire (new) file didn't have any, so my change would improve test coverage. Nice.
But it didn't. CI complained that test coverage had dropped. Wait, what? All I did was move some code and add a unit test.
Then I realised that the coverage analysis tool was only counting files that actually contained any tested code. By adding a test to part of a previously-untested file, that file became part of the scored codebase. Uh-oh.
Looked deeper. Turns out the code coverage tool was also counting the test files themselves as being part of the code-under-test.
Fixed all of the above. Code coverage score dropped by about 40%. ๐ฑ
Now I've got more work to do.
Happy Friday. Check what your coverage tool is inspecting, folks.
-
Note to self: ignore search results that say to install a plugin; the absolute fastest way to send a test email from a WordPress/ClassicPress installation (assuming you're using WP-CLI) is just to run something like:
wp eval 'wp_mail("recipient@example.com", "Test Email", "A test email from WP-CLI");' -
Highlight of my workday was debugging an issue that turned out to be nothing like what the reporter had diagnosed.
The report suggested that our system was having problems parsing URLs with colons in the pathname, suggesting perhaps an encoding issue. It wasn't until I took a deep dive into the logs that I realised that this was a secondary characteristic of many URLs found in customers' SharePoint installations. And many of those URLs get redirected. And SharePoint often uses relative URLs when it sends redirections. And it turned out that our systems' redirect handler... wasn't correctly handling relative URLs.
It all turned into a hundred line automated test to mock SharePoint and demonstrate the problem... followed by a tiny two-line fix to the actual code. And probably the most-satisfying part of my workday!
-
April Features!
The start of April's a perfect time for a "Spring refresh" of a personal website. This year, I'm enabling a handful of experimental new features; visit DanQ.me and you might randomly be selected to try one out!
-
Gutenberg versus Elementor - the beginners challenge
Dan comments on "Gutenberg versus Elementor - the beginners challenge" and what WordPress developers might learn from it about UX.
-
Joe's First Computer Encounter
Jennifer Morrow shares a story about a user testing experience during which a serendipitous encounter taught her more than she could have expected.
-
Why You Only Need to Test with 5 Users
Some people think that usability is very costly and complex and that user tests should be reserved for the rare web design project with a huge budget and a lavish time schedule. Not true. Elaborate usability tests are a waste of resources. The best results come from testing no more than 5 users and running โฆ



