Eval Testing LLMs in PHPUnit
– joshhornby.com - submitted by Joshua Hornby
Prompts break silently. Here's how to catch regressions with PHPUnit evals before your users do.
Read more [joshhornby.com]
Posts tagged with phpunit
– joshhornby.com - submitted by Joshua Hornby
Prompts break silently. Here's how to catch regressions with PHPUnit evals before your users do.
Read more [joshhornby.com]
Learn how to automatically clear Ray's screen when running a test
Read more [myray.app]
Join thousands of developers
Every two weeks, I share practical tips, tutorials, and behind-the-scenes insights from maintaining 300+ open source packages.
No spam. Unsubscribe anytime. You can also follow me on X.
A good intro on how to customize PHPUnit
Read more [localheinz.com]
A couple of months I go I had the honour giving a talk at the GPUG usergroup on how to convert a PHPUnit testsuite to Pest.
Nowadays, I use Pest as the default testrunner for every package / project that I start.
Jason McCreary explains why and how he created his cool Pest converter
Read more [jasonmccreary.me]
Data providers are a PHPUnit feature (and many testing frameworks have an equivalent) that lets you run a single test method multiple times but with different data. Larry Garflied shows some cool things you can do with them.
Read more [peakd.com]
When your unit test suite gets larger, it can take quite a long time. One of the many ways to speed this up is to hunt down and fix slow tests. Let’s use PHPUnit’s test listeners to do just that.
Read more [www.aaronsaray.com]
Paratest is an extension on top of PhpUnit that adds support for parallel testing. For our unit tests, we could just add Paratest and it works without any configuration!
Read more [blog.mollie.com]
Sebastian Bergmann, creator of PHPUnit, walks us through some history and design decisions for PHPUnit.
Read more [thephp.cc]
Here's a little tip: you can use `yield` in phpunit data providers to make them a little more readable pic.twitter.com/rQeKw7jBed
— Brent (@brendt_gd) 12 december 2019
Read more [twitter.com]
It's a bit of a click baity title, but reading it I learning that all PHPUnit's asserts have a function equivalent.
During the preparation of TDD workshops, I began to think about how to write assertions. It turns out that there are several possibilities, but is there the only correct one?
Read more [arkadiuszkondas.com]
Over at the Tighten blog, Chris Trombley published a new post on how to use data providers in PHPUnit.
PHPUnit gives us a way to consolidate this common logic while varying our setup data, without losing the benefit of dedicated, smaller test methods. In this post, we'll explore PHPUnit's data providers. While data providers are available in any PHPUnit test suite, let's look at how they can help us tidy up our tests in a Laravel application.
Read more [tighten.co]
On the Laravel News blog, Tim MacDonald wrote a nice collection of tips on how to make PHPUnit tests run faster.
Having a fast test suite can be just as important as having a fast application. As a developer, getting feedback quickly about the state of your code allows for a much quicker development turnaround. Here we are going to run through some tips you can implement today to make your tests run faster.
Read more [laravel-news.com]
In a new post on her blog Jessica Mauerhan has some good examples on the various types of test doubles.
Did you know that a Mock is only one type of a test double? Most of us use the word “mock” to mean any kind of test double, but there’s actually five different types. It really can help you understand what you’re trying to accomplish with your test if you know a little bit more what you’re doing with your test doubles, so this article will explain the kinds of test doubles, when you use them, how you use them and why.
Read more [jmauerhan.wordpress.com]
In an older but still relevant blogpost Matt Stauffer explains how you can extend PHPUnit's native @requires annotation. It's pretty handy if you want to only run certain tests in certain environments.
I was primarily interested in learning—how do PHPUnit annotations work? What does it look like to extend a pre-existing annotation? How do you not just check for the annotation, but also check its value? I'll show you what I found and then you can run willy-nilly with your own naming schemes.
Read more [mattstauffer.com]
If you find yourself having a bunch of slow tests that don't need to execute every time you run the tests, take a look at PHPUnit's defaultTestSuite setting. TJ Miller explains it in a blog post he wrote last year.
To avoid running the interactive test suite with the rest of my tests, manually or via a CI job, I had to explicitly include all the other suites using phpunit --testsuite Api,Feature,Unit. This felt a bit grim and I would rather exclude just that one suite. So I did some digging and found the defaultTestSuite configuration for phpunit.
https://medium.com/@sixlive/separate-interactive-test-suites-f6fd59316ec2
Beautiful, organized results in PHPUnit, where have you been all my life?
— Keith Damiani (@keithdamiani) December 21, 2017
Composer-install this bad boy, add one line to phpunit.xml, and enjoy the view. ????https://t.co/JJi4tEhWWo pic.twitter.com/4pndct3iZk
Read more [twitter.com]
In the JavaScript world Jest, built by Facebook, is an excellent tool to run tests. Not only can it automatically rerun your tests when source code changes, but there's also an interactive mode where you can set a filter on which tests to run while the tool is running. Would it be great if we could…