Stqa Practical
Stqa Practical
PRACTICAL 1
AIM :
DESCRIPTION:
Boundary Value Analysis (BVA) is a black-box testing technique used to identify defects in
software by focusing on the edges (boundaries) of input values. The assumption is that
errors are more likely to occur at the extremes or near the borders of valid and invalid input
ranges.
THEORY:
CODE:
1
ENROLLMENT NO: 210305124014
COMPUTER SCIENCE AND ENGINEERING
FACULTY OF ENGINEERING AND TECHNOLOGY
STQA (203105396) B.Tech. 7th SEM
OUTPUT:
Type the no. of test cases: 5
Type the minimun range: 5
Type the maximum range: 10
10 Yes Pass
15 No Fail
5 Yes Pass
56 No Fail
2 No Fail
2
ENROLLMENT NO: 210305124014
COMPUTER SCIENCE AND ENGINEERING
FACULTY OF ENGINEERING AND TECHNOLOGY
STQA (203105396) B.Tech. 7th SEM
PRACTICAL 2
AIM:
DESCRIPTION:
Equivalence Classes: Divide the input domain into classes based on expected behavior:
Valid Length: Class containing OTPs with the exact expected length (e.g., 6 digits).
Invalid Length: Two classes - one for OTPs shorter and another for OTPs longer
than the expected length.
Valid Content: Class containing OTPs composed of allowed characters (e.g., digits
0-9).
Invalid Content: Multiple classes depending on restrictions:
Test Case Design: For each equivalence class, design at least one test case with a
representative input value. The test case should verify that the function behaves as
expected for that class (valid or invalid OTP).
THEORY:
3
ENROLLMENT NO: 210305124014
COMPUTER SCIENCE AND ENGINEERING
FACULTY OF ENGINEERING AND TECHNOLOGY
STQA (203105396) B.Tech. 7th SEM
elements within a class are expected to behave similarly. This allows us to design a
smaller set of test cases that effectively cover a wider range of scenarios.
CODE:
valid_lengths = {4, 6}
res = []
for _ in range(test):
otp = input("Enter your OTP: ")
res.append(otp)
4
ENROLLMENT NO: 210305124014
COMPUTER SCIENCE AND ENGINEERING
FACULTY OF ENGINEERING AND TECHNOLOGY
STQA (203105396) B.Tech. 7th SEM
OUTPUT:
TABLE:
5
ENROLLMENT NO: 210305124014
COMPUTER SCIENCE AND ENGINEERING
FACULTY OF ENGINEERING AND TECHNOLOGY
STQA (203105396) B.Tech. 7th SEM
PRACTICAL -3
AIM: Design independent paths by calculating cyclometric complexity using date problem.
Theory: Cyclomatic Complexity may be defined as:
• It is a software metric that measures the logical complexity of the program code.
• It counts the number of decisions in the given program code.
• It measures the number of linearly independent paths through the program code.
Cyclomatic complexity indicates several information about the program code Cyclomatic
Complexity Meaning 1 – 10 • Structured and Well Written Code
• High Testability
• Less Cost and Effort 10 – 20
• Complex Code
• Medium Testability
• Medium Cost and Effort 20 – 40
• Very Complex Code
• Low Testability
• High Cost and Effort > 40
• Highly Complex Code
• Not at all Testable
• Very High Cost and Effort Importance of Cyclomatic Complexity-
6
ENROLLMENT NO: 210305124014
COMPUTER SCIENCE AND ENGINEERING
FACULTY OF ENGINEERING AND TECHNOLOGY
STQA (203105396) B.Tech. 7th SEM
Solution We draw the following control flow graph for the given code
7
ENROLLMENT NO: 210305124014
COMPUTER SCIENCE AND ENGINEERING
FACULTY OF ENGINEERING AND TECHNOLOGY
STQA (203105396) B.Tech. 7th SEM
Solution :
We draw the following control flow graph for the given code
8
ENROLLMENT NO: 210305124014
COMPUTER SCIENCE AND ENGINEERING
FACULTY OF ENGINEERING AND TECHNOLOGY
STQA (203105396) B.Tech. 7th SEM
9
ENROLLMENT NO: 210305124014
COMPUTER SCIENCE AND ENGINEERING
FACULTY OF ENGINEERING AND TECHNOLOGY
STQA (203105396) B.Tech. 7th SEM
PRACTICAL -4
AIM:
Design test cases using Decision table Design independent paths by taking DD
path using date problem.
Theory:
A Decision Table is a tabular representation of inputs versus rules/cases/test
conditions. It is a very effective tool used for both complex software testing and
requirements management. Decision table helps to check all possible combinations
of conditions for testing and testers can also identify missed conditions easily. The
conditions are indicated as True(T) and False(F) values.
Decision table testing is a software testing technique used to test system behavior for
different input combinations. This is a systematic approach where the different input
combinations and their corresponding system behavior (Output) are captured in a tabular
form. That is why it is also called as a Cause-Effect table where Cause and effects are
captured for better test coverage.
Let's learn with an example.
Example 1: Credit card example:
Let’s take another example. If you are a new customer and you want to open a credit card
account then there are three conditions first you will get a 15% discount on all your
purchases today, second if you are an existing customer and you hold a loyalty card, you
get a 10% discount and third if you have a coupon, you can get 20% off today (but it can’t
be used with the ‘new customer’ discount).
Discount amounts are added, if applicable. This is shown in Table
10
ENROLLMENT NO: 210305124014
COMPUTER SCIENCE AND ENGINEERING
FACULTY OF ENGINEERING AND TECHNOLOGY
STQA (203105396) B.Tech. 7th SEM
the conditions and actions are listed in the left hand column. All the other columns in the decision
table each represent a separate rule, one for each combination of conditions.
We may choose to test each rule/combination and if there are only a few this will usually be
the case. However, if the number of rules/combinations is large we are more likely to
sample them by selecting a rich subset for testing.
Now let’s see the decision table for credit card shown above:
• Note that we have put X for the discount for two of the columns (Rules 1 and 2) –
this means that this combination should not occur. You cannot be both a new
customer and also holding a loyalty card as per the conditions mentioned above.
Hence there should be an error message stating this.
• We have made an assumption in Rule 3. Since the coupon has a greater discount
than the new customer discount, we assume that the customer will choose 20%
rather than 15%. We cannot add them, since the coupon cannot be used with the
‘new customer’ discount as stated in the condition above. The 20% action is an
assumption on our part, and we should check that this assumption (and any other
assumptions that we make) is correct, by asking the person who wrote the
specification or the users.
• For Rule 5, however, we can add the discounts; since both the coupon and the
loyalty card discount should apply (that’s our assumption).
• Rules 4, 6 and 7 have only one type of discount and Rule 8 has no discount, so 0%.
If we are applying this technique thoroughly, we would have one test for each column or
rule of our decision table. The advantage of doing this is that we may test a combination of
things that otherwise we might not have tested and that could find a defect.
However, if we have a lot of combinations, it may not be possible or sensible to test every
combination. If we are time-constrained, we may not have time to test all combinations.
Don’t just assume that all combinations need to be tested.
It is always better to prioritize and test the most important combinations. Having the full
table helps us to decide which combinations we should test and which not to test this time.
In the example above all the conditions are binary, i.e. they have only two possible values:
11
ENROLLMENT NO: 210305124014
COMPUTER SCIENCE AND ENGINEERING
FACULTY OF ENGINEERING AND TECHNOLOGY
STQA (203105396) B.Tech. 7th SEM
Code:
decision_table = [
{"credit_score": "good ", "income_level": "high", "collataral": "yes", "request_status":
"Approve Loan"},
{"credit_score": "good", "income_level": "high", "collataral": "no", "request_status":
"Approve Loan"},
{"credit_score": "good", "income_level": "low", "collataral": "yes", "request_status":
"Reject Loan"},
{"credit_score": "good", "income_level": "low", "collataral": "no" ,"request_status":
"Approve Loan"},
{"credit_score": "bad", "income_level": "high", "collataral": "yes", "request_status":
"Approve Loan"},
{"credit_score": "bad", "income_level": "high", "collataral": "no", "request_status":
"Reject Loan"},
{"credit_score": "bad", "income_level": "low", "collataral": "yes","request_status": "Reject
Loan"},
{"credit_score": "bad", "income_level": "low", "collataral": "no", "request_status": "Reject
Loan"}
]
def loan_approval(credit_score,income_level,collataral):
if credit_score == "good" and (income_level == "high" or collataral =="yes"):
return "Approve loan"
elif credit_score == "bad" and (income_level == "high" or collataral =="yes"):
return "Approve loan"
else:
12
ENROLLMENT NO: 210305124014
COMPUTER SCIENCE AND ENGINEERING
FACULTY OF ENGINEERING AND TECHNOLOGY
STQA (203105396) B.Tech. 7th SEM
def run_test_case(decision_table):
for i , test_case in enumerate(decision_table):
credit_score=test_case["credit_score"]
income_level=test_case["income_level"]
collataral=test_case["collataral"]
request_status=test_case["request_status"]
actual_result=loan_approval(credit_score,income_level,collataral)
expected_result=request_status
if actual_result == expected_result:
print("Test case {} passed".format(i+1))
else:
print("Test case {} failed".format(i+1))
OUTPUT:
13
ENROLLMENT NO: 210305124014
COMPUTER SCIENCE AND ENGINEERING
FACULTY OF ENGINEERING AND TECHNOLOGY
STQA (203105396) B.Tech. 7th SEM
PRACTICAL – 6
AIM :
Understand The Automation Testing Approach.
DESCRIPTION:
Automation testing replaces manual test execution with software tools and scripts.
These scripts simulate user interactions and verify functionalities. This approach
offers significant advantages: faster testing due to automation, improved accuracy
through reduced human error, quicker bug detection through frequent test runs, and
the ability to cover complex scenarios. By incorporating different levels of automation
testing, like UI or API testing, you can achieve a more robust and efficient software
development process, ultimately leading to higher quality software.
The automation testing process can be broken down into six key stages:
1. Planning and Prioritization: This involves defining your goals, resources, and test
scope. Not all tests are ideal for automation. Here, you identify critical functionalities
and repetitive manual tests that would benefit most from being automated.
2. Tool Selection: Choosing the right automation tool depends on factors like the
application type (web, mobile, desktop) and programming languages used. Popular
options include Selenium, Cypress, Appium, etc.
3. Framework Design: Establishing a structured way to organize your tests is crucial.
This framework promotes maintainability, scalability, and reusability of your test
scripts. Consider using frameworks like Robot Framework, pytest, or even custom
solutions.
4. Test Script Development: This is where you write clear, concise, and well-
documented test scripts. Focus on testing core functionalities and user flows.
Remember, well-structured tests are easier to debug and update in the future.
5. Test Execution and Reporting: Set up a system to run your automated tests
regularly. This could be integrated into your CI/CD pipeline for frequent regression
testing. Generate comprehensive reports to analyze results and identify failures.
14
ENROLLMENT NO: 210305124014
COMPUTER SCIENCE AND ENGINEERING
FACULTY OF ENGINEERING AND TECHNOLOGY
STQA (203105396) B.Tech. 7th SEM
By following these steps, you can establish a robust automation testing process that improves
your software development lifecycle.
ADVANTAGES:
Increased Efficiency and Speed: Automation significantly reduces the time spent on
repetitive manual testing tasks.
Improved Accuracy and Repeatability: Scripts eliminate human error and ensure
consistent test execution every time they're run.
Faster Feedback Loop: Automated tests can be run frequently, even overnight or on
weekends.
Enhanced Test Coverage: Automation allows you to test scenarios that might be
difficult or impractical to perform manually.
Improved Software Quality: By catching bugs early and often through frequent
testing, automation helps to deliver higher quality software with fewer defects.
Reduced Testing Costs: While there's an initial investment in setting up automation
tools and frameworks, the long-term benefits outweigh the costs. Reduced manual
testing efforts and faster development cycles lead to overall cost savings.
In summary, automation testing offers a faster, more reliable, and more comprehensive way
to test software, ultimately leading to higher quality applications and improved development
efficiency.
DISADVANTAGES:
15
ENROLLMENT NO: 210305124014
COMPUTER SCIENCE AND ENGINEERING
FACULTY OF ENGINEERING AND TECHNOLOGY
STQA (203105396) B.Tech. 7th SEM
False Positives and Debugging Challenges: Sometimes automated tests can fail due
to reasons unrelated to actual bugs. Debugging these failures can be complex,
especially for intricate test scripts.
Limited Bug Detection: While automation excels at catching regressions and
functional bugs, it might miss more subtle issues like usability problems or visual
inconsistencies.
.In conclusion, while automation testing offers significant advantages, it's important to be
aware of its limitations. By carefully considering these drawbacks, you can make
informed decisions about where automation can best be applied in your software
development process.
APPLICATION:
Automation testing has a wide range of applications across various software development
areas. Here are some key examples:
Web Applications: Automating user interactions with web interfaces for login,
search functionality, shopping cart processes, and more. This ensures consistent user
experience and catches regressions after code updates.
Mobile Apps: Similar to web applications, automation can test user journeys, logins,
in-app purchases, and various functionalities on mobile devices.
API Testing: Verifying how the application interacts with other systems through its
APIs. This ensures data exchange happens seamlessly and as expected.
Desktop Applications: Automating workflows, data entry, and other functionalities
within desktop software programs.
Performance Testing: Simulating heavy user loads to assess how the application
handles stress and maintains performance under pressure.
Practical : 7
16
ENROLLMENT NO: 210305124014
COMPUTER SCIENCE AND ENGINEERING
FACULTY OF ENGINEERING AND TECHNOLOGY
STQA (203105396) B.Tech. 7th SEM
Aim :
Using Selenium IDE, write a test suite containing minimum 4 test cases.
Theory:
Selenium IDE TEST suite
https://procapitalacademy.com/
https://www.amazon.in/
17
ENROLLMENT NO: 210305124014
COMPUTER SCIENCE AND ENGINEERING
FACULTY OF ENGINEERING AND TECHNOLOGY
STQA (203105396) B.Tech. 7th SEM
https://www.flipkart.com/
https://paruluniversity.ac.in/
18
ENROLLMENT NO: 210305124014
COMPUTER SCIENCE AND ENGINEERING
FACULTY OF ENGINEERING AND TECHNOLOGY
STQA (203105396) B.Tech. 7th SEM
19
ENROLLMENT NO: 210305124014