What is the difference between behavioral, functional and unit testing?
I am little bit confused about these terms. I am planning to build an application by using Laravel, Bootstrap and jQuery. Now I wanted to test my models, controller and offcourse bootstrap UI element on DOM. What should I do?
Going to add to what's already been said, specifically regarding behavioral testing. Behavioral testing is testing the user interaction with the application, and much like the different types of code testing, you can measure interaction with things as small as individual components on a screen (a form field, a button), up through each individual screen, all the way through full-stack interaction with the entire application. What a lot of people fail to realize is you don't need to write a single line of code to start behavioral testing.
If you have access to a group of your target users, you can start behavioral testing before ever writing a line of code. Print your screen designs or even just the wireframe for your web app or mobile app. Ask your users to touch it, click it, verbalize what they are thinking or trying to do. Give them a task to accomplish and watch how they attempt to do it. Where do they pause? What button can't they find? What are they able to do quickly and where do they get stuck? Don't ask them what they like or don't like until after you see them actually interact with it. Then modify the design and do it again (preferably with different users as well, so they're seeing it for the first time). Keep revising your User Interaction (UX) design until the users are flowing through the application with ease, not needing instruction. You'll save yourself a lot of coding time by knowing before you code how your users will interact with the application. As you are coding, try to do a cheap interactive mockup of the application screens using just HTML or a good wireframing tool like Axure and run another set of tests, only this time they'll be interacting on a screen or device instead of paper. Focus on the areas people had trouble with during the paper testing.
By the time the system is actually built, you will essentially already have designed and coded a system to support what you already know is successful user interaction.
I'm just going to take Katie's baton and run with it a little bit, because she hit the nail on the head with her descriptions of different testing methodologies. Behavior-driven-development (BDD) has made its way through the ranks in the last few years, and is now seen as an equal to test-driven-development (TDD). There are a few key differences between the two:
TDD is performed BEFORE any application code is written, in order to more greatly narrow the scope of development (and thus eliminate any "fluff").
BDD is performed after application code has been written, in order to mirror the most commonly-highlighted objectives of visiting customers. These objectives are usually unlocked in focus groups, polling, or just by thinking critically about your application (ie: A new, visiting customer will likely invoke authentication through OmniAuth and their Twitter account, if that's the sign up/login method you prefer).
Both of these testing practices should be utilized whenever possible. They really, really complement each other!
If you plan to use Laravel for your php framework, check out Behat as a BDD solution. It's a really elegant solution for php, and is the closest thing to Cucumber a php developer can get.
Here's a link (https://github.com/GuilhermeGuitte/behat-laravel)
All the best,
Unit tests are typically written to test functions or methods. A single class or interface might have multiple unit tests for each method. Each unit test should be independent of the others. A unit test shouldn’t require you to talk to a database or any other software modules. Strategies like method stubs and mock objects are used as a substitute for external dependencies like databases.
Integration tests are when you connect individual software components and test them together as a group. For instance, if you were designing a web app using a model-view-controller pattern, an integration test might consist of a user logging in and receiving the correct response from a website. That’s considered an integration test because it involves multiple controllers and exercises the entire stack from the database (to determine if the username and password are valid) all the way through the response received by the client browser.
“Behavioral testing” is a term I don't hear often. Usually it means a test or series of tests that mimic the workflow of an actual user. If you were creating an e-commerce site, a behavioral test could be a user logging in, browsing the website, adding and removing items from their shopping cart, then completing the transaction.
Whenever you can, you want to take advantage of test frameworks. That will save you significant development time.
Bootstrap has its own build system called grunt that supports testing.
Laravel also includes a number of tools to support testing.
A software unit test is a test of the smallest unit of code.
A software functional test is a test at a architectural level requiring actions by a collection of code units.
A software behavioral test is a test of software as it is interacted with by a user.