I'm sure you've already seen it - but for reference in case other people have not yet seen it, here is my tutorial on unit testing XenForo addons:
https://xenforo.com/community/resources/unit-testing-xenforo-addons-tutorial.7508/
I explicitly mention that my tutorial only covers the "unit testing" side of things - not functional tests or feature tests or end-to-end tests or whatever else you like to call it when you test a full HTTP request/response cycle. I'm going to refer to these as "feature tests" - because that's what Laravel calls them.
Feature tests are where you simulate a browser HTTP request to a certain route using a HTTP GET or POST commands which exercise entire paths through your application and examine the response, setting expectations on things that should have occurred during execution.
After thinking about it for a while while writing that original tutorial, I concluded that attempting to do feature testing in XenForo - as it is currently architected - was too difficult, mainly due to the bootstrapping process.
When feature testing, you need to inistantiate an almost fully-hydrated XenForo install so that you have data in the system to test against.
When you think about how long it takes to install a new instance of XenForo and how much data is pre-populated into the database during install (tempates, phrases, permissions, default nodes, admin user, etc) - it is a fairly significant process. Take a look at the database after performing a fresh install - it's already got a lot of data in it.
More importantly, to properly feature test, you likely need to do this process for every single test - which is going to take a long time, especially if using an on-disk database like MySQL.
When testing Laravel applications, I will use SQLite database operating in-memory - so all database operations are ephemeral and fast. I also only bootstrap the parts of the application that are required for testing.
I did investigate whether it would be possible to write an SQLite adapter for XenForo to use for testing purposes, but I believe that there are some MySQL-only functions used by XenForo which would make this quite difficult.
So between the lack of SQLite support and the challenges of bootstrapping a working XenForo install with sufficient data in it to be able to perform feature tests - I put it in the too hard basket.
I guess you could perform feature tests against an existing XenForo install - but the issue there is repeatability. If you aren't discarding your application after every test and re-instantiating it for the next test, you're not going to be testing the exact same application every time. Which means that multiple executions of your tests could lead to different outcomes making reliable testing difficult and automated testing pretty much impossible.
Laravel also provides useful tools for mocking data by way of factories - classes that extend their models and provide a set of attribute values using the
Faker PHP library. This makes it really easy to quickly populate your database with meaningful fake data for testing purposes.
If attempting to do feature tests on XenForo - this Faker library is probably the first thing I would investigate for providing mock data.
I'd be very interesting to hear if any other devs have gone down the path of creating a feature test system and how they approached it.