Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

DhPandya's avatar

Unit testing VS Automation VS Manual Testing

Hi everyone,

For the past few days, I have been working on the Unit testing in Laravel, This creates some confusion in my mind.

  1. How is Unit testing better than the manual testing?
  2. There are even other tools available to make testing automated like Selenium and TestNG, How will they be helpful for in the testing automation?

Also, suggest a perfect way to make the product more stable and bug-free.

Thank you

0 likes
7 replies
Sergiu17's avatar
  1. Unit testing is faster and you have a guarantee that you don't break other parts of your application by working on a new feature or refactoring some parts of your code
  2. With tools like Selenium you will write end to end tests

suggest a perfect way to make the product more stable and bug-free.

Write more tests

DhPandya's avatar

@Sergiu17

  • A little more question: Is unit testing more effective than Selenium or TestNG?

With tools like Selenium you will write end to end tests

What end to end tests means here?

Sergiu17's avatar

@DhPandya there are so many articles about this, check for example: https://www.selenium.dev/documentation/test_practices/testing_types/ here you will find useful information

In terms of effectiveness, it depends as always, just unit testing is better than without unit testing, just integration testing is better than without, having both unit and integration tests is even better. Both bring value and both are important. Usually in your Laravel application you will write Feature tests ( https://laravel.com/docs/11.x/http-tests )

Also check Laravel Dusk https://laravel.com/docs/11.x/dusk

https://laracasts.com/series/build-a-laravel-app-with-tdd

Shivamyadav's avatar

ChatGPT 3.5

You

How is Unit testing better than the manual testing? There are even other tools available to make testing automated like Selenium and TestNG, How will they be helpful for in the testing automation?

ChatGPT

ChatGPT

Unit testing is better than manual testing in several ways:

Speed and Efficiency: Unit tests are automated, meaning they can be executed quickly and repeatedly, allowing for rapid feedback on code changes. Manual testing, on the other hand, is time-consuming and prone to human error.

Isolation of Issues: Unit tests focus on testing individual components (units) of code in isolation. This allows for easier identification and debugging of issues, as problems are localized to specific units rather than being buried within larger systems.

Regression Testing: Automated unit tests can be run whenever code changes are made to ensure that new changes do not introduce regressions. Manual testing would require redoing tests for the entire system, which is inefficient and error-prone.

Cost-Effectiveness: Unit testing reduces the need for manual testers, saving time and resources in the long run.

Selenium and TestNG, on the other hand, are tools for automated integration and end-to-end testing. They offer several benefits in testing automation:

Cross-Browser and Cross-Platform Testing: Selenium allows for testing web applications across different browsers and platforms, ensuring compatibility.

Scripting Capabilities: Selenium provides a powerful scripting interface for creating automated tests, allowing for complex interactions with web elements.

Parallel Testing: Selenium can execute tests in parallel, speeding up the testing process.

Integration with Continuous Integration (CI) Systems: Selenium tests can be integrated into CI systems like Jenkins, enabling automated testing as part of the development workflow. Genrated by Chatgpt

DhPandya's avatar

@Shivamyadav I know we can ask chatGPT but sometimes something more clear when there is human inputs.

puklipo's avatar

Laravel sometimes breaks with minor version updates.

If a test fails during deployment, you can prevent deployment to the production server and break the service.

Testing, CI, and CD are required to achieve this.

adityakunhare's avatar

I would like to add some input.

My cousin started learning Selenium with Java.

Earlier I have been following TDD approach for a while from Laracasts. So I had idea of automation test process.

Even gone through Cypress as well of course its a @Jeff's tutorial.

Then I got to know similar to Selenium laravel already has a first party package called Dusk. And it works like charm. You will be able to interact with front end as well as backend in your test.

So in the end. I am preferring Dusk and with phpunit for end to end testing to make the product more stable.

I hope this helps you.

Please or to participate in this conversation.