F
Filament3mo ago
James

What should I be testing?

This isn't necessarily specific to Filament, but also I feel like this is even harder in a Filament app. At least I find myself thinking traditional testing of fill out a form, submit, check that its in the database it too much because it gets into testing Filaments internal logic? Any videos or articles with some practical walkthoughs of what and how to test a Filament app would be great if there are any someone could recommend.
5 Replies
Povilas K
Povilas K3mo ago
I may be unpopular here, but you don't need to test Filament form logic as it's already been tested internally. That's the reason why there's not much written or talked about testing for Filament, same with Livewire. I guess you could be testing that the data is successfully saved after submit, but might be pointless a little. That said, I'm marking this topic for discussion for a future video on my YouTube channel, will try to find examples and cases.
James
James3mo ago
Yeah that's kind of where I am at trying to deal with the tension between being redundant with FIlament's own test suite, and testing that I implemented it correctly. It would almost be nice if there was some Filament test helper that could assert an implementation without having to actually run any Filament code to save it to the DB, almost be able to do a Unit style test with no DB.
Povilas K
Povilas K3mo ago
So you can still do unit testing on Laravel level, outside Filament
James
James3mo ago
I mean like a way to assert that a Filament resource is implemented correctly without having to go though a full integration test of fill out this form and make sure its in the DB.
awcodes
awcodes3mo ago
Definitely a fine line here. But think about this. Imagine you forgo testing a filament form because you feel like you’re just testing Filament, but in reality you’re not testing filaments functionality, you are testing all the rules / validation around the crud of a record. There could also be times where fields are shown or hidden based on the data, while filament makes that work, you still need to test that the data is correctly handled to make sure filament is even working as expected.