# Sample Test Cases For Calculator

In this article, we will walk through **how to write test cases for calculators**. It is one of the common manual testing interview questions.

Several applications use calculations, and calculator test cases are common interview questions. Usually applications such as eCommerce websites where the application calculates the price, tax, delivery charges and more. Thus creating test cases for calculators in software testing applies to a fresher QA.

Earlier we have discussed some of the related posts and here are those for your reference.

- Test Case Template with Detailed Explanation
- Test Cases for Registration Page
- Test Cases for Login Page
- Test Cases for Gmail
- Test Cases for ATM Machine
- Test Scenario vs Test Case
- Test Strategy vs Test Plan
- 8 Types of Test Cases To Be Automated
- 8 Types of Test Cases Not To Be Automated

**Requirements**

Whenever the interviewer is asking the candidate to write a test case for a random product there is always a twist. The candidate would enthusiastically answer the question with various scenarios but the interviewer might say this is not the intended product. It is the candidatesâ€™ responsibility to understand the requirements properly.

The objective of the alternation is that this is a common mistake made by several testers who work in the industry. They assume the system functions in a certain way rather than clarifying the requirements. So they want to check the candidate whether they are aware of the requirements before heading to test the product.

There are several types of the calculator in the market such as Basic Calculators, Scientific Calculators, Graphing Calculators, Printing Calculators, Financial Calculators, Online Calculators, Phone Calculators, Abacuses, Mechanical Calculators, Electronic Calculators, Solar Powered Calculators, Touch Screen Calculators, Pocket Calculators, Desktop Calculators, Novelty Calculators.Â Â

When performing calculator testing, itâ€™s crucial to clearly understand the requirements. Here are some questions to ask the interviewer to gain better insight into the requirements.

- Is it a physical calculator?
- Is it a digital calculator?
- Is it a normal calculator or a scientific calculator?
- Is it part of an application or is it an application by itself?
- Is it a programmable Calculator?

Once you get the right set of requirements, you can start writing your test case. For simplicityâ€™s sake letâ€™s look into test cases for simple calculators.

**Thought Process**

The basic functionality of the product should be your initial focus whenever you are thinking about testing a particular product or software application. Your thought process should dwell on testing concepts and how to connect the product to them.

**Basic Functionality Test Cases For Calculator**

- Check whether the calculator can add numbers.
- Check whether the calculator can subtract numbers.
- Check whether the calculator can multiply numbers.
- Check whether the calculator can divide numbers.

As we have gone through the basic functionality of the calculator, letâ€™s look into more scenarios in the calculator in depth.

**Functional Test Cases For A Calculator**

- Check whether the calculator can perform addition for two interfering numbers.
- Check whether the calculator can perform addition for two negative numbers.
- Check whether the calculator can perform subtraction for two integer numbers.
- Check whether the calculator can perform subtraction for two negative numbers.
- Check whether the calculator can perform subtraction of one negative and one positive number.
- Check whether the calculator can perform the multiplication of two integer numbers.
- Check whether the calculator can perform the multiplication of two negative numbers.
- Check whether the calculator can perform the multiplication of one negative and one positive number.
- Check whether the calculator can perform the division of two integer numbers.
- Check whether the calculator can perform the division of two negative numbers.
- Check whether the calculator can perform the division of one positive number and one negative number.
- Check whether the calculator can divide numbers by zero
- Check whether the calculator uses the BODMAS technique.
- Check whether on pressing two operators one after the other, the latest one will override the previous operator.
- Check whether the calculator gives the correct result in the case of operations containing decimal numbers.
- Check whether after erasing numbers the calculation is taking into account the latest number and not any previous number with more digits.
- Check whether the square and square root keys are working as expected

**Usability**** Test Cases For A Calculator**

**Test Cases For A Calculator**

- Check whether the text written on the calculator button is visible and readable or not.
- Check whether the display screen of the calculator is as expected.
- Check whether pressing â€˜Câ€™ cancels any digits or operations added.
- Check whether the spacing between the two buttons, the buttons should not be too closely placed.
- Check whether the materials used for the calculator are as per requirement.
- Check whether the calculator contains 9 numeric digits.
- Check whether the on /off button in the calculator works as expected.
- Check whether all arithmetic operations (+, -, /, *, %, etc.) work as expected.
- Check whether all buttons in the calculator exist and whether the characters on them are legible.

**Boundary Conditions**** Test Cases For Calculator**

**Test Cases For Calculator**

- Check whether the limit of the response value is.
- Check the number of digits allowed to enter in the calculator for any operation.
- Check whether the calculator time-out works as expected to turn the calculator off.
- Check whether the battery life of the calculator stays as expected.
- Check whether the calculator doesnâ€™t allow characters.
- Check whether pressing the arithmetic operations button (+,*,/) when no number is present does not have any effect on the upcoming calculations.
- Check how much pressure is required to operate the button in the calculator.Â
- Check that maximum numbers are displayed properly on the LCD screen or not.
- Check the number of digits allowed to enter in the calculator for any operation.
- Check whether keeping the calculator unused for a certain period turns it off automatically.
- Check whether the user can delete digits one by one using the backspace key.
- Check whether the calculator works in a pitch-dark room if it is a solar-powered calculator.
- Check out at which level of low brightness the calculator stops working.

**Negative**** Test Cases For Calculator**

**Test Cases For Calculator**- Check whether the calculator breaks when dropped.
- Check how the calculator handles errors when a number is divided by zero.
- Check how the calculator handles when pressing two buttons simultaneously.
- Check how the calculator handles the input when a certain button is pressed for a long time.
- Check how the calculator handles 0/-0, 0/0, -0/-0.
- Check whether the calculator is waterproof or not.
- Check whether pressing two operators one after the other, the latest one will override the previous operator.
- Check that after erasing numbers the calculation is taking into account the latest number and not any previous number with more digits.
- Check that pressing the operations when no number is present does not have any effect on the upcoming calculations.
- Check whether the calculator can operate on a low battery.
- Check whether the calculator displays unexpected behaviour when using it on a low battery.

**User Interface**** Test Cases For Calculator**

**Test Cases For Calculator**- Verify the brand name of the calculator.
- Verify whether the brand logo is displayed on the calculator or not.
- Verify the colour of the calculator.
- Verify the shape of the calculator.
- Verify the height of the calculator.
- Verify the length of the calculator.
- Verify the material of the calculator.
- Verify the screen size of the calculator.
- Verify that buttons are properly displayed or not.
- Verify that numbers are properly displayed on buttons or not.
- Verify that arithmetic signs are properly displayed or not.
- Verify that the ON and OFF buttons are properly displayed or not.
- Verify the size of each of the buttons in the calculators.
- Verify the colour of each button of the calculator.
- Verify whether the calculator has a flip cover or not.
- Verify whether the calculator is operated by battery or solar.

**Test Cases For Advanced Scientific Calculator**

- Check whether the sin, cos, tan and cos is operational using the keys and works as expected
- Check whether the x-1, x!,|x|,x^y and f(x) are operational as per requirement.
- Check whether the log key works as expected.
- Check whether the natural logarithm key is operational and works as expected.
- Check whether the factorial key is working as expected.
- Check whether the real and imaginary component keys are working as expected.
- Check whether the complex conjugate keys are working as expected.
- Check whether the memory functions save the current calculations.
- Check whether the calculator allows navigating through previous calculations.
- Check the advanced features calculator has converter options, each of the conversion function tests such as angle, length, weight, area, volume, duration, currency, and temperature works as expected
- Check whether the advanced calculator has financial operations, each of the financial calculator tests including present value, future value, interest, time, etc works as expected.

**Software-Based Calculator Test Cases**

- Check whether the calculator opens when the menu item is selected.
- Check whether the calculator can start by searching for the calculator.
- Check whether the calculator window maximises when pressing the appropriate button.
- Check whether the calculator window minimises when pressing the appropriate button.
- Check whether clicking on backspace deletes the current value.
- Check whether the calculator closes when the close button is pressed or the File->Exit option is selected.
- Check whether help documentation can be accessed by going to Help -> Documentation.
- Check whether the calculator accepts copy-and-paste functionality.
- Check whether the dark theme and light theme works as expected.
- Check how the calculator application handles when launching multiple instances using automation scripts and performing some random calculations.
- Check whether the calculator application doesnâ€™t crash when running it for a very long time and suddenly performs some operations.

**Conclusion**

We can build hundreds of test cases based on the operation of a single and combination of the keys. You can get a head start with the test cases with the scenarios mentioned above. This can help you in your interview and also can be a mental exercise to flex your testing muscles. You can write more scenarios on your own to gain more experience.

**Related posts:**

- How To Write a Good Defect Report
- Why Did You Choose Software Testing As A Career
- Test Plan Template Detailed Explanation
- Web Cookie Testing â€“ Test Cases of Cookie Testing