what kind of error message do u get?
Start unti testin for an existing Laravel project
Hello everyone,
I'm currently working on a Laravel project that doesn't have unit tests set up yet. The database is a critical component for my application, but I've run into an issue.
When I try to create a test database using php artisan migrate, I encounter numerous errors. Because of this, I'm looking for an alternative method to generate the database without relying on the usual migration process.
Additionally, I'm considering duplicating the existing database on a test server and using this copy for unit testing. Is this approach feasible?
Any advice or suggestions would be greatly appreciated!
Thanks!
@GodziLaravel Here is my thought:
-
Make sure you have a seeder for seeding the entire application's data.
-
(Make sure) you have all the migration files.
-
Then write tests slowly for your project.
- If you want to use automated (paid) service, then you can try this
- Alternatively, you can ask Github co-pilot to write test for a function. You just need to confirm the test based on the co-pilot's suggestion.
-
A free package blueprint might be helpful for you to generate the test but needs some adjustment/tweaking. You can get some starting point here also.
BTW, also you can check out this discussion to get some idea.
Please or to participate in this conversation.