How to Write Test Cases for Calculator Application in Software Testing

Test Cases for Calculator Application

In this how-to, we will walk through how to write test cases for calculator in software testing. Many applications use calculations and calculator test cases can be a pretty common interview question. Some examples of applications include purchasing on eCommerce websites, calculating how much money is owed to a worker, and putting satellites into space. As a result, creating test cases for calculator in software testing applies to a fresher tester. Follow along with this how-to and finish your application’s first test case by creating your account in our test case management tool. Before starting our test case, we need to define the Acceptance Criteria.

What are the Acceptance Criteria for Scientific Calculator?

As discussed in our requirements post, we must have functional requirements. So let’s go ahead and define them as such:

Description: “Taking Ubuntu Linux’s calculator must be able to perform basic mathematical calculations.”

Abbreviated Acceptance Criteria:

  • Validate the calculator can add numbers.
  • Validate the calculator can subtract numbers.
  • Validate the calculator can multiply numbers.
  • Validate the calculator can divide numbers.
  • Validate any remaining arithmetic keys work.

What are the functional test cases for calculator application?

We will want to document several test cases related to a basic calculator. Typically test cases can be broken down into:

Digital or Physical Calculator Scenarios:

  1. Validate all arithmetic operations (+, -, /, *, %, etc.) work properly.
  2. Verify the sum or equals key works properly.
  3. Verify all numbers work properly (0-9).
  4. Validate the bracket keys work.
  5. Verify the square and square root keys work.
  6. Ensure BODMAS / BIDMAS is applied when running complex queries and correct results are returned.
  7. Validate using decimal characters yields the correct result.
  8. Ensure spacing of all like buttons is equal.
  9. Validate the number of digits allowed in the calculator for an operation.
  10. Check the response value limit of the calculator.
  11. Ensure the memory functions work as expected.
  12. Validate previous calculations can be viewed.
  13. Verify the “C” or clear button cancels all digits and operations entered.
  14. Verify the back or delete button works when pressing the backspace key.
  15. Validate the latest operation overrides the prior one when two operations are pressed one after the other.
  16. Verify the addition of two integer numbers.
  17. Verify the addition of two negative numbers.
  18. Verify the addition of one positive and one negative number.
  19. Verify the subtraction of two integer numbers.
  20. Verify the subtraction of two negative numbers.
  21. Verify the subtraction of one negative and one positive number.
  22. Verify the multiplication of two integer numbers.
  23. Verify the multiplication of two negative numbers.
  24. Verify the multiplication of one negative and one positive number.
  25. Verify the division of two integer numbers.
  26. Verify the division of two negative numbers.
  27. Verify the division of one positive number and one integer number.
  28. Verify the division of a number by zero results in an error.
  29. Verify the division of a number by a negative number.
  30. Functionality test cases: check the division of zero by any number results in zero.

Physical Simple Calculator only scenarios:

Pysical Calculator
  1. Verify the calculator is a normal calculator and not a scientific calculator.
  2. Validate all buttons exist and the characters on them are legible.
  3. When using a solar-powered calculator, be sure batteries are not needed in full sunlight.
  4. When sunlight is unavailable for a solar-powered calculator, ensure battery operation works.
  5. Verify all of the buttons need a reasonable amount of pressure to operate.
  6. Validate the On and Off buttons work on the calculator.
  7. Verify the calculator’s outer shell is undamaged.
  8. Verify calculator time-out works as expected to turn the calculator off.
  9. Check the calculator’s state when pressing two buttons simultaneously.

Software Based Calculator only scenarios:

Digital Calculator App Selection
  1. Validate help documentation can be accessed by going to Help -> Documentation.
  2. Verify the calculator accepts copy and paste functionality.

Keep in mind there are diminishing returns to testing, and developers should be using a thoroughly tested library. Here are some tests some folks might be tempted to run, but are not needed because they are using inbuilt operating system functionality not specific to the application.

  1. Verify calculator starts when the menu item is selected.
  2. Ensure the calculator can start by searching for the calculator.
  3. Validate the calculator window maximizes when pressing the appropriate button.
  4. Validate the calculator window minimizes when pressing the appropriate button.
  5. Validate the calculator closes when the close button is pressed or File->Exit option is selected.

The best thing you can do as a tester is discuss, with the developer, what the library code is doing and what it is not doing. Another quick sanity check is to review your developer’s code check-in for the story you are working on. Doing so can help target your testing efforts.

Scientific Calculator and Programmable Calculator Test Cases:

Many folks, especially in school, have to use scientific calculators.

Scientific Calculator

Here are some additional test scenarios for them:

  1. Validate the operation and results of the sin, cos, tan, and cos keys.
  2. Validate the operation and results of the x-1, x!,|x|,x^y, and f(x) keys.
  3. Validate the operation and results of the log key.
  4. Validate the operation and results of the logarithm key.
  5. Validate the operation and results of the factorial key.
  6. Validate the operation and results of the real and imaginary component keys.
  7. Validate the operation and results of the complex conjugate.
  8. If your advanced features calculator has converter options, each of the conversion function tests (angle, length, weight, area, volume, duration, currency, temperature) will need to be validated.
  9. If your advanced calculator has financial operations, each of the financial calculator tests (present value, future value, interest, time, etc.) will need to be validated.

Writing Test Cases for Calculator Application

In this future section, we will go into detail on how to write the advanced tests calculator test cases on your best laptop for QA tester.

Conclusion for Test Cases for Calculator in Software Testing

AccelaTest is a free test case management tool packed with features that most other testing tools charge a lot of money for. Get your account now and create your test cases.

ACCELATEST UNIVERSITY
Hello there
Do you want to learn the Software Testing techniques, tips, and tricks that have led to a stable, high-paying job and prevented embarrassing multimillion-dollar bugs?