Tasbiya ST FileHHHHH
Tasbiya ST FileHHHHH
Submitted By:
Tasbiya
03301032021
IT-1(G-group)
Submitted To:
Dr. Pratibha
INDEX
C++ Code:
#include <iostream>
using namespace std;
int daysInMonth[] = {31, (isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31,
30, 31};
return true;
}
int main() {
int day, month, year;
cout << "Enter day, month, and year (DD MM YYYY): ";
cin >> day >> month >> year;
return 0;
}
Output:
EXPERIMENT 2
Aim:
Write a program to solve quadratic equations and find their roots.
C++ Code:
#include <iostream>
#include <cmath>
using namespace std;
if (discriminant > 0) {
double root1 = (-b + sqrt(discriminant)) / (2 *
a); double root2 = (-b - sqrt(discriminant)) / (2 *
a);
cout << "Two distinct real roots: " << root1 << " and " << root2 << endl;
} else if (discriminant == 0)
{ double root = -b / (2 * a);
cout << "One real root: " << root << endl;
} else {
double realPart = -b / (2 * a);
double imaginaryPart = sqrt(-discriminant) / (2 * a);
cout << "Complex roots: " << realPart << " + " << imaginaryPart << "i and "
<< realPart << " - " << imaginaryPart << "i" << endl;
}
}
int main() {
int a, b,
c;
cout << "Enter coefficients a, b, and c: ";
cin >> a >> b >> c;
solveQuadratic(a, b, c);
return 0;
}
Output:
EXPERIMENT 3
Aim: Document various software testing tools used in the industry (e.g., Selenium,
Postman, JMeter). Describe their use cases and functionalities.
1. Selenium
- How It Works:
- Ideal For: Repeated (regression) tests and checking the functionality of websites.
2. Postman
- How It Works:
- Postman allows users to send different types of requests (GET, POST, PUT,
DELETE) to test if an API is working as expected.
- It offers an interface for manually testing APIs and for creating automated
test collections.
- Postman is great for checking if an API returns the right data and performs well.
- Ideal For: Ensuring APIs return the correct data and function as expected.
3. JMeter
- Purpose: Used for testing the load and performance of web applications and APIs.
- How It Works:
- JMeter is an open-source tool that checks how well an application can handle
multiple users at once.
- It can be used to simulate real user interactions and measure performance metrics
like response time.
- JMeter is useful for understanding how an application behaves under heavy use.
4. QTest
- How It Works:
- QTest is a cloud tool that helps teams organize test cases, track bugs, and manage
test plans.
- It integrates well with development tools like JIRA and Jenkins, which are often used
in agile (fast-paced) environments.
- QTest lets teams store test results, track testing progress, and generate reports
for stakeholders.
5. Katalon Studio
- How It Works:
- Katalon Studio is an all-in-one testing tool with built-in templates to make test
creation easy.
- It supports automation for websites, mobile apps, desktop apps, and APIs.
- Katalon Studio integrates with DevOps tools like JIRA and Jenkins, making it
suitable for agile workflows.
6. Appium
- How It Works:
- Appium supports testing mobile apps on both Android and iOS platforms using a
single test code.
7. TestNG
- Purpose: Provides a framework for organizing and running tests in an automated way.
- How It Works:
- Inspired by JUnit, TestNG allows testers to create a wide range of tests (unit,
functional, and integration).
- It integrates with Selenium, and can handle multiple tests running at once.
- TestNG uses annotations to organize tests and supports grouping and parallel execution.
- Ideal For: Structuring and organizing test cases, especially in Selenium projects.
8. LoadRunner
- Purpose: Used for performance and load testing to simulate high usage.
- How It Works:
- LoadRunner creates virtual users to test how an application handles a large number
of users or heavy data.
- It provides insights into system performance, like response times and resource
use, helping identify weak points.
9. JIRA
- How It Works:
- JIRA is widely used for tracking bugs and assigning tasks to team members.
- It integrates with tools like Selenium and TestNG, supporting project management
in agile workflows.
- Ideal For: Managing projects and tracking software issues in development teams.
Result
Each of these tools has a specific role, from automating web tests (Selenium) and testing
APIs (Postman) to managing projects (JIRA) and measuring performance (LoadRunner).
Together, they help ensure software quality by covering different aspects of testing and
bug tracking.
EXPERIMENT -4
Aim:
Write a program to add and subtract two matrices of size 2x2.
Code:
#include <iostream>
numberOfTests) {
}
}
cout << "Test Case " << test << ": " <<
";
int main() {
int numberOfTests;
cout << "Enter the number of test cases you want to generate: ";
generateMatrixTestCases(numberOfTests);
return 0;
Output:
Matrix after Subtraction:
7 -15
-8 8
A:
6 -2
-9 4
B:
1 3
7 -6
-2 -2
CODE:
#include <iostream>
int a = rand() % 100 - 50; // Generate random number between -50 and 50
int b = rand() % 100 - 50; // Generate random number between -50 and
50
cout << "Test Case " << i << ": " << endl;
cout << "Inputs: a = " << a << ", b = " << b << endl;
switch (operation) {
case 1:
cout << "Operation: Addition" << endl;
break;
case 2:
break;
case 3:
endl; break;
case 4:
if (b != 0)
else
break;
int main() {
int numberOfTests;
cout << "Enter the number of test cases you want to generate: ";
generateTestCases(numberOfTests);
return 0;
Output:
EXPERIMENT- 6
Aim: To understand black box testing and generate test cases using boundary value
analysis.
Code:
#include <iostream>
class BankAccount {
private:
int balance;
public:
balance = newBalance;
return balance;
runBoundaryValueTests() {
int minBalance = 0;
cout << "\nTest Case 1 - Minimum Boundary Value (" << minBalance << "):\n";
BankAccount account1(minBalance);
account1.displayBalance();
cout << "\nTest Case 2 - Just Above Minimum Boundary (" << minBalance + 1 <<
"):\n";
account2.displayBalance();
cout << "\nTest Case 3 - Nominal Value (Middle of Range, " << nominalBalance
<< "):\n";
BankAccount account3(nominalBalance);
account3.displayBalance();
cout << "\nTest Case 4 - Just Below Maximum Boundary (" << maxBalance - 1 <<
"):\n";
cout << "\nTest Case 5 - Maximum Boundary Value (" << maxBalance << "):\n";
BankAccount account5(maxBalance);
account5.displayBalance();
};
int main() {
BankAccount::runBoundaryValueTests();
return 0;
Output:
Current Balance: 9999
:
EXPERIMENT – 7
Aim: To understand robustness testing techniques and generate test cases for addition/
subtraction of 2d matrix.
Code:
#include <iostream>
class Matrix
{ private:
public:
data[0][0] = a;
data[0][1] = b;
data[1][0] = c;
data[1][1] = d;
}
}
{ return Matrix(
);
{ return Matrix(
);
cout << "\nTest Case " << testCase + 1 << " - mat1[0][0] = " << mat1.data[0][0] << ":\n";
mat1.display();
mat2.display();
// Perform addition
// Perform subtraction
};
int main() {
Matrix::runRobustnessTests();
return 0;
Output:
Test 2 - mat1[0][0] = 2147483647:
Case
Matrix 1: 0
2147483647
0 0
Matrix 2:
0 0
0 0
Sum:
2147483647
0
0 0
Difference:
2147483647
0
0 0
Matrix 2:
0 0
0 0
Sum:
2147483648 0
0 0
Difference :
2147483648 0
0 0
EXPERIMENT – 8
Aim: To understand worst case testing and robust worst case technique and generate test cases
for addition/subtraction of 2d matrix.
Code:
#include <iostream>
class Matrix
{ private:
public:
data[0][0] = a;
data[0][1] = b;
data[1][0] = c;
data[1][1] = d;
}
}
{ return Matrix(
);
{ return Matrix(
);
// Function to run Worst Case and Robust Worst Case test cases
cout << "\nWorst Case Test Case " << testCase + 1 << " - mat1[0][0] = " << mat1.data[0]
[0] << ":\n";
cout << "Matrix 1:\n";
mat1.display();
mat2.display();
// Perform addition
// Perform subtraction
// Function to run Robust Worst Case tests (overflow and underflow with addition/subtraction)
// Robust Worst Case Testing: This focuses on boundary conditions that could trigger
overflow/underflow
cout << "\nRobust Worst Case Test Case " << testCase + 1 << " - mat1[0][0] = " <<
mat1.data[0][0] << ":\n";
mat1.display();
cout << "Matrix 2 (Extreme Values):\n";
mat2.display();
// Perform addition
// Perform subtraction
};
int main() {
cout << "Running Worst Case Test Cases for Matrix Operations...\n";
Matrix::runWorstCaseTests();
cout << "\nRunning Robust Worst Case Test Cases for Matrix Operations...\n";
Matrix::runRobustWorstCaseTests();
return 0;
Output:
a rix
2147483648 2147483648
2147483648 2147483648
2147483647 -2147483648
-2147483648 2147483647
Sum:
4294967295 -2147483648
-2147483648 4294967295
Difference:
2147483647 -2147483648
-2147483648 2147483647
-2147483649 -2147483649
-2147483649 -2147483649
2147483647 -2147483648
-2147483648 2147483647
Sum:
2147483648 -2147483648
-2147483648 2147483648
Difference:
-2147483650 -2147483649
-2147483649 -2147483650
EXPERIMENT – 9
Aim: To understand equivalence class testing and identify input and output based equivalence
classes for 2d matrix and generate test cases using it.
Code:
#include <iostream>
#include <vector>
#include <stdexcept>
class Matrix {
private:
vector<vector<int>> data;
public:
};
try {
result.print();
class try {
auto result =
matrix1.add(matrix2);
result.print();
inputs try {
cout << "Strong Robust Test Case (invalid sizes):" << endl;
exception result.print();
}
// 4. Weak Robust: At least one invalid input
try {
cout << "Weak Robust Test Case (empty matrix):" << endl;
exception result.print();
return 0;
Output:
EXPERIMENT-10
Aim- To understand decision table based testing and generate test cases using limited
entry decision tables and extended entry decision tables.
CODE:
#include <iostream>
#include <vector>
#include <string>
struct Rule {
};
if (conditions[i] != rule.conditions[i])
{ return false;
return true;
}
vector<Rule> createLimitedEntryDecisionTable() {
return {
};
vector<Rule> createExtendedEntryDecisionTable() {
return {
};
if (matchRule(conditions, rule)) {
for (bool cond : conditions) cout << cond << " ";
foundMatch = true;
break;
if (!foundMatch) {
for (bool cond : conditions) cout << cond << " ";
int main() {
testCases(extendedTable, extendedTestCases);
return 0;
Output:
EXPERIMENT-11
Aim: To understand mutation testing and generate test cases for addition/subtraction for
2d matrix.
Code:
#include <iostream>
#include <vector>
#include <stdexcept>
+j) {
return result;
}
+j) {
return result;
+j) {
return result;
+j) {
return result;
";
}
cout << endl;
void testMatrixOperations() {
// Expected results
if (resultAdd == expectedAddition) {
} else {
displayMatrix(resultAdd);
if (resultSub == expectedSubtraction) {
} else {
displayMatrix(resultSub);
} else {
displayMatrix(mutantAdd);
if (mutantSub != expectedSubtraction) {
} else {
displayMatrix(mutantSub);
int main() {
testMatrixOperations();
return 0;
Output:
EXPERIMENT-12
Aim: To understand slicing testing and generate test cases for addition/subtraction for 2d
matrix.
Code:
#include <iostream>
#include <vector>
#include <stdexcept>
}
return result;
return result;
";
void testMatrixSlices() {
if (resultAdd == expectedAddition) {
} else {
displayMatrix(resultAdd);
n";
} else {
displayMatrix(resultSub);
int main() {
testMatrixSlices();
return 0;
Output: