[CALC1] A simple calculator

The specifications are quite trivial …

The product we need

Demonstrator: Simple Calculator CALC1 ../../../_images/arrow-right-circle.svg
tags: demo1
For this demo, a simple calculator is used. It should work with integers; and has only a few requirements. See below.

We use this extremely simplistic example as you will agree on its requirements.

Some general requirements, for all calculators

Requirement: Generic Add CALC_ADD ../../../_images/arrow-right-circle.svg
tags: general
links outgoing: CALC1, CALC2
All calculators should be able to sum two numbers and show the result.
Requirement: Generic Sub CALC_SUB ../../../_images/arrow-right-circle.svg
tags: general
links outgoing: CALC1, CALC2
links incoming: CALC_TEST_SUB_1, CALC2_1000ND
All calculators should be able to subtract a number form another number.
Requirement: Generic Multiply CALC_MULT ../../../_images/arrow-right-circle.svg
tags: general
links outgoing: CALC1, CALC2
All calculators should be able to multiply two numbers.
Requirement: Generic Divide CALC_DIV ../../../_images/arrow-right-circle.svg
tags: general
links outgoing: CALC1, CALC2
All calculators should be able to divide two numbers.

Add this is how we test it

As we have defined only general requirements, we only need some generic tests.

Test_Case: Basic addition test CALC_TEST_ADD_1 ../../../_images/arrow-right-circle.svg
tags: general
links outgoing: CALC_ADD, CALC2_1000ND

Sum two numbers and verify the result is correct.

By example: Add 2 and 5 and check the result is 7

Test_Case: Big addition test CALC_TEST_ADD_2 ../../../_images/arrow-right-circle.svg
tags: general
links outgoing: CALC_ADD, CALC2_1000ND
Add the numbers 2222 and 5555 and check the result is 7777
Test_Case: Subtract test CALC_TEST_SUB_1 ../../../_images/arrow-right-circle.svg
tags: general
links outgoing: CALC_SUB, CALC2_1000ND

Feed two numbers to the calculators, in the right order and verify the result.
E.g:

  • Subtract 5 from 7 and check the result is 2
  • Subtract 5555 from 7777 and check the result is 2222

Note

Here we specify two test in one test-requirement; just to show another style

Test_Case: Multiplication test CALC_TEST_MULT_1 ../../../_images/arrow-right-circle.svg
tags: general
links outgoing: CALC_MULT, CALC2_1000ND
You get the idea …

Experience practice

  1. There are several kinds of ‘needs’.
    Here we use the toplevel Demonstrator (as it is not a real product), Requirement and Test_Case; later we will introduce Specification too. More kinds & levels can be configured.
  2. Every ‘need’ should have an unique and stable ID; this label is used to link other ‘needs’.
  3. Some ‘needs’ are linked to an “earlier/higher” ‘need’.
    You can see such an outgoing-link in e.g the requirements (You might need to “open” the details-row)
  4. Each outgoing-link will automatically result in an incoming-link on the references need. (Again, open the details-row, to be able to “follow” it in the ‘forward’ direction).

Hint

This article uses ‘sphinx-doc’ with the ‘needs’ plugin to define requirement. This is a text-based (and so version-controllable) tool; therefore it is painless to show the details of how it works; that is done in Particulars for CALC1

Comments

comments powered by Disqus