Unit test are much faster and it's not only for testing urls.
Let's say that you have an authors table containing last name and first name.
Like this
1 | Jordan | Robert
And you want to display it like this in your view
Jordan, Robert
Then you can write a test for that like this
/**
* @test
*/
public function name_property_returns_the_authors_last_name_and_first_name()
{
$author = factory(Author::class)->create([
'first_name' => 'Robert',
'last_name' => 'Jordan'
]);
$this->assertEquals('Jordan, Robert', $author->name);
}
As you see this does not even hit a route, it just tests the method that it returns the desired value.
You can use the browser to test this yes but if you have hundreds of this little helpers and such it will take a long time to test everything manually.
You can test your validation of your request to make sure you have the correct validation rules.
/**
* @test
*/
public function author_first_name_is_required()
{
$author = factory(Author::class)->make([
'first_name' => null,
'last_name' => 'Jordan'
]);
$this->post('/authors', $author->toArray())->assertSessionHasErrors('first_name');
$this->assertEquals(0, Author::count());
}
If you need to implement a new feature then you can do so and then check if you have broken anything quite fast instead of once again testing everything in the browser.
You also use it when you make changes to your code to make it cleaner aka refactoring.