Generated: April 23, 2026
Test Framework: Playwright
Target App: Server-Side Calculator Using API
App API: Simple Calculator API - Swagger UI
| Metric | Count |
|---|---|
| Total Tests Run | 154 |
| Tests Passed | 128 (83%) |
| Tests Failed | 26 (17%) |
| Unique Bugs Found | 4 |
| Severity Levels | Medium (3), Low (1) |
Testcase ID: NF-01
Severity: Medium
Description: The calculator fails to properly handle division by zero operations. The app returns inconsistent error messages and HTTP status codes.
Expected Behavior:
β (infinity symbol){ "type": "VALUE", "value": "β" }Actual Behavior:
Testcase ID: NF-02, NF-03, NF-04 Severity: Medium
Description: The calculator allows form submission with empty first, second or both operand without proper validation or error handling.
Expected Behavior:
{ "type": "INPUT_ERROR", "value": "Empty input" }Actual Behavior:
Testcase ID: NF-06
Severity: Medium
Description:
The calculator does not properly sanitize or reject special character inputs (!@#, $%%, etc.).
Expected Behavior:
{ "type": "INPUT_ERROR", "value": "Unknown token: !@#$%%" }Actual Behavior:
Testcase ID: BV-02
Severity: LOW
Description: High-precision decimal operations produce inaccurate results due to floating-point rounding errors.
Expected Behavior:
0.00000000001 + 0.00000000002 = 0.00000000003
Actual Behavior:
Result = 0
Root Cause: IEEE 754 floating-point arithmetic limitations
Workaround: Implement decimal arithmetic library or BigDecimal for high-precision operations
The following test cases pass successfully across all test types and browsers:
| Test ID | Description | Status |
|---|---|---|
| PF-01 | Addition of positive integers | β PASS |
| PF-02 | Addition of negative integers | β PASS |
| PF-03 | Subtraction resulting in positive | β PASS |
| PF-04 | Subtraction resulting in negative | β PASS |
| PF-05 | Multiplication of positive numbers | β PASS |
| PF-06 | Multiplication with negative numbers | β PASS |
| PF-07 | Multiplication by Zero | β PASS |
| PF-08 | Division with exact integer result | β PASS |
| PF-09 | Division resulting in decimal | β PASS |
| PF-10 | Floating-point (Decimal) arithmetic | β PASS |
| BV-01 | Very Large Numbers | β PASS |
| BV-03 | Max length input validation | β PASS |
| SEC-01 | Cross-Site Scripting (XSS) Injection | β PASS |
| SEC-02 | SQL Injection Attempt | β PASS |
| NF-05 | Alphabetical characters input | β PASS |
| NF-07 | Whitespace-only input | β PASS |
Implement client-side and server-side validation:
// Validate operands are not empty
if (!operand1 || operand1.trim() === '') {
return { type: "INPUT_ERROR", value: "Empty input" };
}
if (!operand2 || operand2.trim() === '') {
return { type: "INPUT_ERROR", value: "Empty input" };
}
// Validate operands contain only valid characters
const validNumberRegex = /^-?\d+(\.\d+)?$/;
if (!validNumberRegex.test(operand1)) {
return { type: "INPUT_ERROR", value: `Unknown token: ${operand1}` };
}
if (!validNumberRegex.test(operand2)) {
return { type: "INPUT_ERROR", value: `Unknown token: ${operand2}` };
}
Handle division by zero gracefully:
if (operator === 'divide' && right === 0) {
return { type: "VALUE", value: "β" };
}
Consider using a decimal arithmetic library:
const Decimal = require('decimal.js');
const num1 = new Decimal(operand1);
const num2 = new Decimal(operand2);