Functional vs non-functional testing

Functional testing checks what a system does: a function is given an input and the result is compared with the behaviour specified for it. Non-functional testing checks how well the system does it, measuring qualities such as performance, security, usability and compatibility against agreed thresholds. The same feature can be given tests of each kind, at any test level.

The longer version

The ISTQB Foundation Level syllabus, version 4.0.1, addresses four test types, and these are two of them. Functional testing "evaluates the functions that a component or system should perform", and the syllabus adds that the functions are what the test object should do. Its main objective is checking functional completeness, functional correctness and functional appropriateness. Non-functional testing "evaluates attributes other than functional characteristics of a component or system" and is described as the testing of "how well the system behaves". For the qualities concerned the syllabus points to ISO/IEC 25010 and lists eight: performance efficiency, compatibility, usability, reliability, security, maintainability, portability and safety. The other two test types in the list are black-box and white-box testing, which classify a test by what it is derived from. Functional and non-functional classify it by what it is looking for, so the two pairs cut across each other.

A profile photo upload shows the difference on one feature. The functional tests follow the specified behaviour. A JPEG under the size limit is accepted and appears on the profile. A file over the limit is refused with a message that states the limit. A PDF is refused. A second upload replaces the first. Each test has one right answer, and the result either matches it or does not. The non-functional tests use the same upload and ask other questions. For performance: does a photo at the size limit finish uploading within the agreed time on the agreed connection? For security: is a script renamed to look like an image rejected, and can one user's photo be replaced from another user's account? For usability: can a first-time user find the control and recover from the size error without help? For compatibility: does the upload work in each browser on the support list, and from a phone's camera as well as from a file? None of these has an answer until somebody sets the threshold: the time, the connection, the list of browsers.

The two kinds are closer in practice than the names suggest. The syllabus notes that many non-functional tests are derived from functional tests: the same test is run, and the check is that a non-functional constraint holds while the function is performed, for example that it completes within a specified time. The upload test and the timed upload test are one script with two assertions. Both kinds can be applied at every test level, and the syllabus does not reserve non-functional testing for the end. It says that it is sometimes appropriate for non-functional testing to start early, as part of reviews or component testing, and that the late discovery of non-functional defects can pose a serious threat to the success of a project. Non-functional testing may also need an environment of its own, and the syllabus gives a usability lab as its example. What each kind is tested against, the functional and the non-functional requirements, is covered in a separate entry.

Lists of the types of functional testing usually mix three classifications. Unit, integration, system and acceptance testing are test levels, which the syllabus names component testing, component integration testing, system testing, system integration testing and acceptance testing, and functional and non-functional tests can both be run at each of them. Smoke and regression testing describe when a test is run, after a new build or after a change, and either can hold checks of both kinds. Positive and negative testing describe the input, valid or invalid. The non-functional types are easier to sort, because each serves one quality characteristic: load, stress and endurance testing serve performance efficiency, penetration testing and vulnerability scanning serve security, cross-browser and cross-device testing serve compatibility, usability and accessibility testing serve usability, failover and recovery testing serve reliability, and installation testing serves portability. The results differ in form as well. A functional test ends in pass or fail against an expected result, and a non-functional test ends in a measurement, which passes or fails only against a threshold that somebody agreed beforehand.

Common questions

Functional vs non-functional testing: what is the difference?

Functional testing checks that each function produces the specified result for a given input. Non-functional testing checks qualities of the system as it performs those functions, such as speed, security, usability and compatibility. The ISTQB Foundation Level syllabus puts it as what the test object should do against how well the system behaves.

What are examples of non-functional testing?

Common examples are load testing and stress testing for performance, penetration testing for security, cross-browser testing for compatibility, usability testing with real users, accessibility testing against a standard such as WCAG, failover testing for reliability and installation testing for portability. Each one measures a quality of the system against a threshold, such as a response time, a list of supported browsers or a recovery time.

What are the main types of functional testing?

Functional tests are usually grouped by the level at which they run: unit or component testing, integration testing, system testing and acceptance testing, including user acceptance testing. Smoke, sanity and regression testing are often added to the list, although they describe when tests are run and can include non-functional checks too. At every level, a functional test compares a result with the specified behaviour.

What are examples of functional and non-functional tests on the same feature?

On a photo upload, a functional test checks that a valid image is accepted and shown, and that a file over the size limit is refused with a clear message. Non-functional tests on the same upload time a large file against an agreed limit, try a disguised script, watch a new user complete the task, and repeat the upload in each supported browser.

Which comes first, functional testing or non-functional testing?

A function has to work before its speed or ease of use can be measured, so the functional checks on a feature come first. Non-functional testing should not wait for the end of the project, though. The ISTQB Foundation Level syllabus says it is sometimes appropriate to start it early, as part of reviews or component testing, and warns that late discovery of non-functional defects can seriously threaten a project.

Is usability testing functional or non-functional testing?

Usability testing is non-functional testing. Usability is one of the non-functional quality characteristics the ISTQB Foundation Level syllabus lists from ISO/IEC 25010, where it is also known as interaction capability. The ISTQB glossary describes usability testing as evaluating the degree to which specified users can use the system with effectiveness, efficiency and satisfaction, which is a question about quality and not about a correct result.

Can one test be both functional and non-functional?

One test run can serve both purposes. The ISTQB Foundation Level syllabus notes that many non-functional tests are derived from functional tests: the same steps are performed, and a further check confirms that a non-functional constraint is met, such as finishing within a specified time. The two results are still reported separately, since a function can be correct and too slow.

Bug reports that arrive ready to triage.

Collect replay, console, network and browser context with the Free plan.

<script src="…/widget.js" data-key="pb_pub_…">