开发者

What test methods do you use for developing websites?

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).


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.


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?


I usually do the following things:

  • Page consistency in case of multi-page web sties.
  • Testing the database connections.
  • Testing the functionalities that can be affected by the change I just made.
  • I test functions with sample input to make sure they work fine (especially those that are algorithm-like).
  • In some cases I implement features very simply hard-coding most of the settings then implement the settings later, testing after implementing every setting.

Most of these apply to applications, too.


Well before going to the answer i would like to clear testing concept about multiple methods.

There are six main testing types which cover all most all testing methods.

  1. Black Box Testing
  2. White Box Testing
  3. Grey Box Testing
  4. Functional Testing
  5. Integration Testing
  6. Usability Testing

Almost all Testing methods lies under these types, you can also use some testing method in multiple types like you can use Smoke testing in black box or white box approach on the basis of resources available to test.

So for testing a web site completely you need to use at least following testing methods on the basis of resources available to test. These are at least methods which should be used to test a web site, but there may be some more imp methods on the basic of nature of website.

  1. Requirement Testing
  2. Smock Testing
  3. System Testing
  4. Integration Testing
  5. Regression Testing
  6. Security Testing
  7. Performance & Load Testing
  8. Deployment Testing

You should at least use all of above (8) testing methods to test a web site no matter what testing type you are focusing. You can automate you test in some areas and you can do this manually it all depends upon the resources availability.

There is specifically no hard and fast rule to follow any testing type or any method. As you know "Testing Is An ART" so art don't have rules or boundaries. Its totally up to you What you use to test and how.......

Hope you got the answer of question.


Selenium is very good for testing websites.


The answer depends on the Web framework used (if any). Django for example has built-in testing functions.

For PHP (or functional web testing), SimpleTest is pretty good and well... simple. It support Unit Testing (PHP only) and Web Testing. Tests can run in the IDE (Eclipse), or in the browser (meaning on your server).


The other answers posted so far focus on unit/functional/performance/etc. testing, and they are all reasonable.

However, one the key questions you should ask is, "how effective is my testing?".

This is often answered with test coverage tools, that determine which parts of your application actually get exercised by some set of tests. The ideal test coverage tool lets you test your application by any method you can imagine (including all the standard answers above) and will then report what part and what percentage of your code was exercised. Most importantly, it will tell you what code you did not exercise. You can then inspect that code and decide if more testing is warranted, or if you don't care. If the untested code has to do with "disk full error handling" and you belive that 1TB disks are common, you might decide to ignore that. If the untested code is the input validation logic leading to SQL queries, you might decide that you must test that logic to ensure that no SQL injection attacks can occur.

What test coverage tools let you do it to make a rational decision that you have tested adequately, using data about what parts of your code has been exercised. So regardless of how you test, best practices indicates you should also do test coverage analysis.

Test coverage tools can be obtained from a variety of sources. SD provides a family of test coverage tools that handle C, C++, Java, C#, PHP and COBOL, all of which are used to support web site testing in various ways.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜