Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What test methods do you use for developing websites?

Tags:

tdd

testing

There are a lot of testing methods out there i.e. blackbox, graybox, unit, functional, regression etc.

Obviously, a project cannot take on all testing methods. So I asked this question to gain an idea of what test methods to use and why should I use them. You can answer in the following format:

Test Method - what you use it on

e.g.

  1. Unit Testing - I use it for ...(blah, blah)
  2. Regression Testing - I use it for ...(blah, blah)

I was asked to engage into TDD and of course I had to research testing methods. But there is a whole plethora of them and I don't know what to use (because they all sound useful).

like image 490
yretuta Avatar asked Feb 14 '10 06:02

yretuta


2 Answers

1. Unit Testing is used by developers to ensure unit code he wrote is correct. This is usually white box testing as well as some level of black box testing.

2. Regression Testing is a functional testing used by testers to ensure that new changes in system has not broken any of existing functionality

3. Functional testing is testing conducted on a complete, integrated system to evaluate the system's compliance with its specified requirements. Functionality testing falls within the scope of black box testing, and as such, should require no knowledge of the inner design of the code or logic

.

This Test-driven development and Feature Driven Development wiki articles will be of great help for you.

For TDD you need to follow following process:

  1. Document feature (or use case) that you need to implement or enhance in your application that currently does not exists.
  2. Write set of functional test cases that can ensure above feature (from step 1) works. You may need to write multiple test cases for above feature to test all different possible work flows.
  3. Write code to implement above feature (from step 1).
  4. Test this code using test cases you had written earlier (in step 2). The actual
    testing can be manual but I would recommend to create automated tests if possible.
  5. If all test cases pass, you are good to go. If not, you need to update code (go back to step 3) so as to make the test case pass.

TDD is to ensure that functional test cases which were written before you coded should work and does not matter how code was implemented.

like image 55
Gladwin Burboz Avatar answered Nov 01 '22 17:11

Gladwin Burboz


There is no "right" or "wrong" in testing. Testing is an art and what you should choose and how well it works out for you depends a lot from project to project and your experience.

But as a professional Test Expert my suggestion is that you have a healthy mix of automated and manual testing.

(Examples below are in PHP but you can easily find the correct examples for what ever langauge/framework you are using)

AUTOMATED TESTING

  • Unit Testing
    Use PHPUnit to test your classes, functions and interaction between them.
    http://phpunit.sourceforge.net/

  • Automated Functional Testing
    If it's possible you should automate a lot of the functional testing. Some frame works have functional testing built into them. Otherwise you have to use a tool for it. If you are developing web sites/applications you might want to look at Selenium.
    http://www.webinade.com/web-development/functional-testing-in-php-using-selenium-ide

  • Continuous Integration
    Use CI to make sure all your automated tests run every time someone in your team makes a commit to the project.
    http://martinfowler.com/articles/continuousIntegration.html

MANUAL TESTING
As much as I love automated testing it is, IMHO, not a substitute for manual testing. The main reason being that an automated can only do what it is told and only verify what it has been informed to view as pass/fail. A human can use it's intelligence to find faults and raise questions that appear while testing something else.

  • Exploratory Testing
    ET is a very low cost and effective way to find defects in a project. It take advantage of the intelligence of a human being and a teaches the testers/developers more about the project than any other testing technique i know of. Doing an ET session aimed at every feature deployed in the test environment is not only an effective way to find problems fast, but also a good way to learn and fun!
    http://www.satisfice.com/articles/et-article.pdf

This answer is (almost) identical to one that I gave to another question. Check out that question since it had some other good answers that might help you. How can we decide which testing method can be used?

like image 38
Jonas Söderström Avatar answered Nov 01 '22 18:11

Jonas Söderström