<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mirko Lorusso</title>
    <description>The latest articles on DEV Community by Mirko Lorusso (@mloru).</description>
    <link>https://dev.to/mloru</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F153325%2Feeeb9ae6-069a-4f2b-96ba-653be794f5ca.jpeg</url>
      <title>DEV Community: Mirko Lorusso</title>
      <link>https://dev.to/mloru</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mloru"/>
    <language>en</language>
    <item>
      <title>Speed up your Laravel test suite</title>
      <dc:creator>Mirko Lorusso</dc:creator>
      <pubDate>Sun, 28 May 2023 13:09:53 +0000</pubDate>
      <link>https://dev.to/mloru/speed-up-your-laravel-test-suite-c14</link>
      <guid>https://dev.to/mloru/speed-up-your-laravel-test-suite-c14</guid>
      <description>&lt;p&gt;If you work with Laravel and TDD, you certainly know how fast your test suite can grow and even take several minutes to run.&lt;br&gt;
With the latest versions of Laravel there are a couple of things you can do to speed it up.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reset your database status only when you need to
&lt;/h3&gt;

&lt;p&gt;Laravel 8 and up include a new &lt;code&gt;LazilyRefreshDatabase&lt;/code&gt; trait, which can be used in place of &lt;code&gt;RefreshDatabase&lt;/code&gt; to only migrate and seed the database if the previous test changed it.&lt;br&gt;
See &lt;a href="https://laracasts.com/series/jeffreys-larabits/episodes/10"&gt;this episode of Laracasts&lt;/a&gt; for further information.&lt;/p&gt;

&lt;h3&gt;
  
  
  Use parallel testing
&lt;/h3&gt;

&lt;p&gt;Another thing you can do to improve the running time of your tests is running them in parallel instead of sequentially.&lt;br&gt;
&lt;a href="https://github.com/paratestphp/paratest"&gt;The paratest composer package&lt;/a&gt; will help you with that. &lt;br&gt;
Just follow the instructions in the README to install and use it.&lt;br&gt;
Quick tip: with parallel testing, every test will run on a different database. Make sure your database user is allowed to create and operate on each of them, setting his permissions accordingly :)&lt;/p&gt;

&lt;p&gt;Do you have any other suggestion to share about improving the test running time?&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
