Summer Sale! All accounts are 50% off this week.

andywhit's avatar

Remove Included tests

Is it common to remove included tests that come with starter kits like Breeze and Jetstream? Do people find value in keeping them?

0 likes
1 reply
LaryAI's avatar
LaryAI
AI
Best Answer
Level 58

Yes, it is quite common to remove the included tests that come with starter kits like Breeze and Jetstream, especially if they do not align with the specific requirements of your project. However, whether to keep or remove them depends on your project's needs and your team's practices.

Reasons to Remove Included Tests:

  1. Irrelevance: The included tests might not be relevant to your application's specific functionality.
  2. Maintenance: Keeping tests that are not useful can add to the maintenance burden.
  3. Clarity: Removing unnecessary tests can make your test suite clearer and more focused.

Reasons to Keep Included Tests:

  1. Learning: They can serve as good examples for writing your own tests.
  2. Baseline: They provide a baseline to ensure that the starter kit's functionality works as expected.
  3. Modification: You can modify them to fit your application's needs rather than writing new tests from scratch.

Example: Removing Tests in Laravel

If you decide to remove the included tests, you can simply delete the test files from the tests directory. For example, if you are using Laravel, you might have a structure like this:

tests/
├── Feature
│   └── ExampleTest.php
├── Unit
│   └── ExampleTest.php

To remove these tests, you can delete the files directly:

rm tests/Feature/ExampleTest.php
rm tests/Unit/ExampleTest.php

Example: Modifying Tests

If you prefer to modify the included tests to better suit your needs, you can open the test files and adjust the test cases. For example, modifying a test in ExampleTest.php:

<?php

namespace Tests\Feature;

use Tests\TestCase;
use Illuminate\Foundation\Testing\RefreshDatabase;

class ExampleTest extends TestCase
{
    use RefreshDatabase;

    /** @test */
    public function it_checks_homepage_loads_correctly()
    {
        $response = $this->get('/');

        $response->assertStatus(200);
        $response->assertSee('Welcome');
    }
}

In this example, you might change the URL or the content you are checking for to match your application's requirements.

Conclusion

Ultimately, the decision to keep or remove the included tests depends on your project's context and your team's preferences. If the tests are not useful, feel free to remove them. If they provide value, either as examples or as a baseline, consider keeping or modifying them to better fit your needs.

Please or to participate in this conversation.