Skip to content
Tutorials Center
My learning

Topics

Lesson 11 of 50 ยท Requirements Engineering

Functional and Non-Functional Requirements

Learn the difference between functional and non-functional requirements, how to make quality attributes measurable, and how to write requirements you can test.

When you gather requirements (the previous lesson), you collect two quite different kinds of statements. Some say what the system does: "a customer can reset a forgotten password". Others say how well it does it, or under which limits: "the page loads in under two seconds on a mobile connection". The first kind are functional requirements; the second kind are non-functional requirements (NFRs), also called quality attributes or "-ilities".

Both matter. A system that does every listed function but takes a minute per click, loses data, or leaks passwords is a failure. This lesson explains the two kinds, shows how to turn fuzzy wishes into measurable statements, and gives you a checklist for writing requirements that a tester can verify. The examples are JavaScript stand-ins that analyze requirement text and measurements; the skill itself is careful writing.

Functional requirements

A functional requirement describes a behavior or service: an input, a rule, a result. It answers "what must the system do?"

  • The system shall let a registered user change their email address.
  • When an order is placed, the system shall send a confirmation email containing the order number and total.
  • The system shall reject a withdrawal that exceeds the account balance and display the available balance.

Functional requirements often come from use cases and user stories. A good test: can you describe a scenario, with a concrete input and expected output, that shows the requirement being met?

Non-functional requirements

A non-functional requirement describes a quality or a constraint on how the functions are delivered. The main families are:

Family Question it answers Example
Performance How fast, how much load? 95% of search requests complete in under 300 ms with 1,000 concurrent users
Reliability and availability How often does it fail? Available 99.9% of each month, excluding announced maintenance
Security Who can do what, how is data protected? Passwords are stored as salted hashes; a session expires after 30 minutes of inactivity
Usability and accessibility How easy and inclusive? A new user completes checkout without help in under 3 minutes; the site meets WCAG 2.2 level AA
Maintainability How easy to change? A new payment provider can be added by changing one module and its tests
Portability and compatibility Where does it run? Works on the two latest major versions of Chrome, Firefox, Safari and Edge
Scalability How does it grow? Supports ten times today's data volume by adding servers, not by redesign
Compliance and legal Which rules apply? Personal data of EU users is deleted within 30 days of a verified request

These ideas link back to qualities of good software. A key insight is that NFRs conflict with each other and with cost: extreme security slows the user down; extreme performance costs money; flexibility can reduce speed. Writing them down with numbers lets stakeholders choose trade-offs on purpose.

What versus how well

Functional What the system does.
Non-functional How well it does it.
Constraints Limits you cannot change.

Missing any of the three leads to a surprise later.

1 / 2

Constraints

A constraint is a restriction that the team does not get to negotiate (or at least not cheaply): "must run on the customer's existing Linux servers", "must be delivered by 1 March because of a legal deadline", "must use the company's single sign-on". Constraints are often grouped with NFRs, but they differ in that they restrict the solution space rather than describe a quality. Capture them early: a hidden constraint discovered late can invalidate a design.

The boundary between functional and non-functional is sometimes blurry. "The system shall encrypt card numbers" reads like a function but is really a security quality. Do not waste effort arguing about the label; spend it making sure each statement is clear, specific and testable.

Writing requirements you can test

Compare these two statements:

  • "The system should be fast and user-friendly."
  • "The product search page shall show the first 20 results within 1 second for 95% of requests, measured at the server, with up to 500 concurrent users."

The first cannot fail, so it cannot guide anything. The second can be measured and turned into a test. A well-written requirement usually has these properties:

  • Unambiguous: it can be read only one way.
  • Measurable or verifiable: a test, demonstration, inspection or analysis can show it passes.
  • Singular: one requirement per sentence. "Shall log in and send email" is two requirements.
  • Necessary and traceable: it traces to a stakeholder need and says why it exists.
  • Feasible: it can be built within the constraints.
  • Consistent: it does not contradict another requirement.

Use "shall" for mandatory items and avoid weasel words such as "fast", "easy", "user-friendly", "robust", "flexible", "adequate", "as appropriate", "etc.", "and/or", "minimal", "optimal", "state of the art". Each of these hides a number someone must decide.

The stand-in below scans requirement text for such words and for other smells (several "and"s that suggest more than one requirement, and a missing number in an NFR). It is a small heuristic linter, useful for the habit it builds.

JS Flag vague requirements

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The first, third and fourth requirements are flagged; the second and fifth pass. Notice that a linter cannot judge meaning. A requirement can pass every rule and still be wrong, which is why requirements are also reviewed by people.

Making a quality measurable: the scenario form

For NFRs a handy template is a quality scenario with six parts: the source of a stimulus, the stimulus, the environment, the artifact it hits, the response, and a response measure. For example:

  • Stimulus: 1,000 users search at the same time (source: customers, environment: normal operation, artifact: search service).
  • Response: the service returns results.
  • Measure: 95% of requests finish in under 300 ms.

The measure is what makes it testable. When you cannot state a measure, you do not yet understand the requirement. If stakeholders cannot agree on a number, ask what would make them unhappy, then work backward: "Would 5 seconds be acceptable? 3? 1?" Their reaction reveals the threshold.

The next stand-in checks measured results against NFR targets, which is how an NFR becomes a pass-or-fail test. The latency numbers are invented samples; the percentile function uses the "nearest rank" definition.

JS Check measurements against NFR targets

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The 95th percentile passes because the single slow request (600 ms) sits above the 95th rank, but the 99th percentile catches it and NFR-2 fails. Choosing which percentile to promise is itself a requirement decision: averages hide the slow tail that real users feel.

A requirements writing checklist

Before you accept a requirement, ask:

  1. Who needs this, and what goal does it serve (traceable source)?
  2. Could two people read it differently? If so, rewrite it.
  3. What test, demonstration or inspection would prove it? If none, add a measure.
  4. Is it one statement, or several joined by "and"?
  5. Does it describe what rather than how? (Say "authenticate users", not "use a database table named users".) Mixing in design closes options too early.
  6. Does it conflict with another requirement or a constraint?
  7. What is its priority? (See MoSCoW in the SRS lesson.)

Check your understanding

Quick check ยท 5 questions

of 5 answered You scored / 5 ยท perfect!

  1. 1. Which is a non-functional requirement?

    It describes how well the system performs, with a measure. The others describe behaviors, which are functional.
  2. 2. Why is 'The system shall be user-friendly' a poor requirement?

    'User-friendly' hides a number or a test, such as task completion time or success rate for new users.
  3. 3. What does 'The system shall log in users and send a welcome email and record the visit' suggest?

    Each requirement should be one verifiable statement. Splitting lets each be tested, tracked and prioritized separately.
  4. 4. Why promise a 95th percentile latency instead of an average?

    A few very slow requests barely move the average but make some users unhappy. A percentile target exposes them.
  5. 5. Which statement is a constraint?

    A constraint restricts the solution and is not negotiable by the team. The other statements are a vague quality, a function and a vague quality.

Summary

  • Functional requirements say what the system does; non-functional requirements say how well, and constraints limit the solution.
  • NFR families include performance, reliability, security, usability, maintainability, portability, scalability and compliance, and they conflict with one another and with cost.
  • A good requirement is unambiguous, singular, measurable, necessary, feasible and consistent; avoid weasel words.
  • Quality scenarios with a response measure turn a vague quality into a pass-or-fail test.
  • Describe what is needed, not how to build it.

Next: User Stories, Use Cases and Acceptance Criteria.