0% found this document useful (0 votes)
48 views13 pages

STQA Answers

The algorithm checks if a number is prime by testing for divisibility from 2 up to its square root. It has low complexity and the key aspects for testing are input values like boundaries, primes and non-primes to validate the output and data flow.

Uploaded by

omkarsahane2001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views13 pages

STQA Answers

The algorithm checks if a number is prime by testing for divisibility from 2 up to its square root. It has low complexity and the key aspects for testing are input values like boundaries, primes and non-primes to validate the output and data flow.

Uploaded by

omkarsahane2001
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Perform automation testing for launching and closing the website [[Link]

com/]

after hold of few seconds using Selenium and Intellij.

package sampleapp;

import [Link];
import [Link];

public class Main {

public static void main(String[] args) {


// Set the path to your ChromeDriver executable
[Link]("[Link]", "path/to/chromedriver");

// Initialize the WebDriver


WebDriver driver = new ChromeDriver();

// Navigate to the demo website


[Link]("[Link]

// Wait for a few seconds (e.g., 5 seconds)


try {
[Link](5000);
} catch (InterruptedException e) {
[Link]();
}

// Close the browser


[Link]();
}
}

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Perform automation testing for launching website and searching for a module & opening it, included in the website
using Selenium and Intellij.

import [Link];
import [Link];
import [Link];
import [Link];

public class MySQLWebsiteAutomation {

public static void main(String[] args) {


WebDriver driver = new ChromeDriver(); // Use the ChromeDriver

[Link]("[Link] // Open the MySQL website

// Search for a module


WebElement searchInput = [Link]([Link]("search-input"));
[Link]("MySQL Module");

WebElement searchButton = [Link]([Link]("[Link]-


button"));
[Link]();

// Wait for search results (you can use explicit or implicit waits here)

// Click on the first search result


WebElement moduleLink = [Link]([Link]("[Link]-result-title
a"));
[Link]();

// Perform further actions on the opened module page

// Close the browser


[Link]();
}
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Perform automation testing for launching website[Linkedin] and getting logged into the web application with valid
credentials using Selenium and Intellij.

package sampleapp;

import [Link];
import [Link];
import [Link];

public class Main {


WebDriver driver;

public void navigate(){


[Link]("[Link]
try{
[Link](3000);
}
catch (InterruptedException e) {
[Link]();
}
[Link]([Link]("session_key")).sendKeys("khushalnikumbh1234@[Link]"
);
[Link]([Link]("session_password")).sendKeys("Qwerty!12345");
[Link]([Link]("Sign in")).click();
}
public static void main(String[] args) {
Main obj= new Main();
}
}
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Creating a bug tracking report involves documenting the details of each identified bug or issue in the system. Here's
a template for a bug tracking report in a spreadsheet format. This example assumes you're using a tool like Microsoft

Bug Date Reported Steps to Expected Actual


ID Reported By Module/Feature Description Reproduce Result Result Severity Status Assigned To

1. Navigate
to the login
page 2.
Shubham Enter valid
Navghire Server credentials Internal Khushal
2023-01- [Server Error on 3. Click Successful server Nikumbh
001 15 Admin] Login Login 'Login' login error High Open [Developer]

Excel or Google Sheets:

Explanation:

• Bug ID: 001 (unique identifier).

• Date Reported: 2023-01-15.

• Reported By: Shubham Navghire [Server Admin].

• Module/Feature: Login.

• Description: Server Error on Login.

• Steps to Reproduce:

1. Navigate to the login page.

2. Enter valid credentials.

3. Click 'Login'.

• Expected Result: Successful login.

• Actual Result: Internal server error.

• Severity: High.

• Status: Open.

• Assigned To: Khushal Nikumbh [Developer].


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Prepare a bug tracking report in spreadsheet for Online learning Portal.


Online Learning Portal with the details provided:

Bu Date Steps to
g Reporte Reporte Module/Featur Descriptio Reproduc Expected Actual Severit Statu Assigned
ID d d By e n e Result Result y s To

1.
Navigate
to course
enrollmen
t page 2.
Omkar Select a Error Khushal
Sahane Unable to course 3. Enrollmen message Nikumbh
2023-01- [Student Course enroll in a Click t displaye [Developer
001 20 ] Enrollment course 'Enroll' successful d High Open ]

Explanation:

• Bug ID: 001 (unique identifier).

• Date Reported: 2023-01-20.

• Reported By: Omkar Sahane [Student].

• Module/Feature: Course Enrollment.

• Description: Unable to enroll in a course.

• Steps to Reproduce:

1. Navigate to the course enrollment page.

2. Select a course.

3. Click 'Enroll'.

• Expected Result: Enrollment successful.

• Actual Result: Error message displayed.

• Severity: High.

• Status: Open.

• Assigned To: Khushal Nikumbh [Developer].


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Prepare a bug tracking report in spreadsheet for any Social Media Application

Social Media Application with the details provided:

Bug Date Reported Steps to Expected Actual Assigned


ID Reported By Module/Feature Description Reproduce Result Result Severity Status To

1. Open
the app

2. Enter
valid
Login
credentials
Bhagyesh failure with Error: Khushal
2023-02- Chaudhari User valid 3. Click Successful Invalid Nikumbh
001 01 [User] Authentication credentials 'Login' login credentials High Open [Admin]

Explanation:

• Bug ID: 001 (unique identifier).

• Date Reported: 2023-02-01.

• Reported By: Bhagyesh Chaudhari [User].

• Module/Feature: User Authentication.

• Description: Login failure with valid credentials.

• Steps to Reproduce:

1. Open the app.

2. Enter valid credentials.

3. Click 'Login'.

• Expected Result: Successful login.

• Actual Result: Error: Invalid credentials.

• Severity: High.

• Status: Open.

• Assigned To: Khushal Nikumbh [Admin].


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Algorithm for Deciding Prime Number:

Algorithm IsPrime(n):
Input: n (an integer)
Output: Prime (True) if n is prime, Not Prime (False) otherwise

1. If n is less than 2, return False (Not Prime).


2. If n is 2, return True (Prime).
3. If n is even, return False (Not Prime).
4. Initialize i = 3.
5. While i*i <= n:
a. If n is divisible by i, return False (Not Prime).
b. Increment i by 2.
6. Return True (Prime).

Now, let's analyze the testing aspects:

1. Cyclomatic Complexity:

• The Cyclomatic Complexity (V(G)) can be calculated using the formula: V(G) = E - N + 2P, where E is
the number of edges, N is the number of nodes, and P is the number of connected components.

• In our algorithm:

• Number of edges (E): 7

• Number of nodes (N): 7

• Number of connected components (P): 1

• Calculating, V(G) = 7 - 7 + 2*1 = 2. The cyclomatic complexity is 2.

2. Data Flow Testing:

• Identify variables and data flow:

• Input: n

• Output: Prime (Boolean)

• Test cases should cover various input values, especially focusing on boundary values (e.g., 0, 1, 2,
even numbers, odd numbers, large prime, large non-prime).

3. Control Flow Testing:

• Create test cases to ensure that all paths through the algorithm are executed at least once.

• Test cases should cover the conditions in the algorithm (e.g., n < 2, n = 2, n is even, n is odd, loop
conditions).
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Algorithm for Fibonacci Series:

Algorithm Fibonacci(n):
Input: n (an integer)
Output: List containing the first n Fibonacci numbers

1. Initialize an empty list `fibolist`.


2. If n is less than or equal to 0, return an empty list.
3. If n is 1, append 0 to `fibolist` and return `fibolist`.
4. If n is 2, append 0 and 1 to `fibolist` and return `fibolist`.
5. Initialize variables `a` and `b` to 0 and 1, respectively.
6. Loop i from 3 to n (both inclusive):
a. Calculate the next Fibonacci number `nextFib` as the sum of `a` and `b`.
b. Append `nextFib` to `fibolist`.
c. Update `a` and `b` to the last two Fibonacci numbers in `fibolist`.
7. Return `fibolist`.

Now, let's analyze the testing aspects:

1. Cyclomatic Complexity:

• Count the number of decision points (if statements, loops, etc.): 4

• Count the number of edges (E), nodes (N), and connected components (P).

• Calculate Cyclomatic Complexity (V(G) = E - N + 2P): E = 11, N = 9, P = 1.

• V(G) = 11 - 9 + 2*1 = 5. The cyclomatic complexity is 5.

2. Data Flow Testing:

• Identify variables and data flow:

• Input: n

• Output: fibolist

• Test cases should cover various input values, especially focusing on boundary values (e.g., 0, 1, 2,
large n).

3. Control Flow Testing:

• Create test cases to ensure that all paths through the algorithm are executed at least once.

• Test cases should cover the conditions in the algorithm (e.g., n <= 0, n = 1, n = 2, loop conditions).
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Perform Black box testing using manual testing method – Boundary Value Analysis & Equivalence partitioning

Black-box testing involves testing a software system without having knowledge of its internal code structure.
Boundary Value Analysis (BVA) and Equivalence Partitioning (EP) are two common techniques used in black-box
testing. Let's apply these methods to a hypothetical scenario of testing a login system:

### Scenario: Login System

#### Boundary Value Analysis (BVA):

1. Username Field:

- Lower Bound: Enter a username with the minimum length (e.g., 1 character).

- Upper Bound: Enter a username with the maximum length (e.g., 50 characters).

- Boundary: Enter a username with the length exactly equal to the allowed minimum or maximum.

2. Password Field:

- Lower Bound: Enter a password with the minimum length (e.g., 6 characters).

- Upper Bound: Enter a password with the maximum length (e.g., 20 characters).

- Boundary: Enter a password with the length exactly equal to the allowed minimum or maximum.

3. Invalid Login Attempts:

- Lower Bound: Attempt to log in with the minimum allowed invalid attempts (e.g., 3 attempts).

- Upper Bound: Attempt to log in with the maximum allowed invalid attempts (e.g., 5 attempts).

- Boundary: Attempt to log in with the invalid attempts exactly equal to the allowed minimum or maximum.

4. Lockout Period:

- Lower Bound: Observe the behavior after the minimum lockout period (e.g., 5 minutes).

- Upper Bound: Observe the behavior after the maximum lockout period (e.g., 30 minutes).

- Boundary: Observe the behavior exactly at the allowed minimum or maximum lockout period.

#### Equivalence Partitioning (EP):

1. Valid User Credentials:

- Test with a set of valid credentials (username and password).


- Test with another set of valid credentials.

2. Invalid User Credentials:

- Test with an invalid username and a valid password.

- Test with a valid username and an invalid password.

- Test with both an invalid username and an invalid password.

3. Special Characters:

- Include special characters in the username and password.

4. Empty Fields:

- Test with an empty username and a valid password.

- Test with a valid username and an empty password.

- Test with both empty username and password fields.

5. Boundary Values (Extreme Values):

- Test with the minimum and maximum values for username and password length.

6. Concurrency:

- Simultaneously attempt to log in from multiple devices.

### Notes:

- Ensure that the system behaves gracefully and provides meaningful error messages for invalid inputs.

- Verify the system's response during periods of high load and concurrent login attempts.

These scenarios cover both boundary values and equivalence partitions, providing comprehensive black-box test
coverage for the login system.
Website Login System Testing

Boundary Value Analysis (BVA):

Test
Case Username Password Expected Result

1 "a" "password" Successful Login

2 "12345678901234567890123456789012345678901234567890" "password" Successful Login

3 "123456789012345678901234567890123456789012345678901" "password" Successful Login

4 "" "password" Invalid Username

5 "username" "" Invalid Password

Invalid Username and


6 "" "" Password

7 "valid_username" "valid_password" Successful Login

8 "invalid_username" "valid_password" Invalid Username

9 "valid_username" "invalid_password" Invalid Password

Invalid Username and


10 "invalid_username" "invalid_password" Password

Equivalence Partitioning (EP):

Test Case Username Password Expected Result

1 "valid_username" "valid_password" Successful Login

2 "invalid_username" "valid_password" Invalid Username

3 "valid_username" "invalid_password" Invalid Password

4 "invalid_username" "invalid_password" Invalid Username and Password

5 "a@[Link]" "p@ssw0rd" Successful Login

6 "user!name" "password@123" Successful Login

7 "" "" Invalid Username and Password

8 "valid_username" "" Invalid Password

9 "" "valid_password" Invalid Username

10 "12345" "12345" Invalid Username and Password


+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Implement & explain Positive testing and negative testing.

Positive testing and negative testing are two fundamental aspects of software testing. Positive testing involves
validating that a system behaves as expected with valid inputs, while negative testing checks how well the system
handles invalid inputs and unexpected scenarios.

Simple Calculator
Let's consider a simple calculator application with two inputs (Operand1 and Operand2) and four basic operations
(Addition, Subtraction, Multiplication, and Division).

Positive Testing:

Test Case Operand1 Operand2 Operation Expected Result

1 5 3 Addition 8

2 10 5 Subtraction 5

3 4 6 Multiplication 24

4 8 2 Division 4

Explanation:

• Positive testing validates the core functionality of the calculator with valid inputs and expects the correct
result for each operation.

Negative Testing:

Test Case Operand1 Operand2 Operation Expected Result

1 "abc" 3 Addition Error: Invalid Input

2 10 "xyz" Subtraction Error: Invalid Input

3 4 0 Division Error: Division by Zero

4 -5 2 Square Root Error: Invalid Operation

Explanation:

• Negative testing checks how well the calculator handles invalid inputs and unexpected scenarios, such as
non-numeric inputs, division by zero, and unsupported operations.

Summary:

• Positive testing ensures that the calculator works correctly under normal, expected conditions.

• Negative testing helps identify and handle errors gracefully when the calculator receives invalid inputs or
encounters unexpected situations.
User Authentication System
Positive Testing:

Test Case Username Password Expected Result

1 valid_user1 valid_password1 Successful Login

2 valid_user2 valid_password2 Successful Login

3 valid_user3 valid_password3 Successful Login

4 admin_user admin_password Successful Login (Admin)

5 guest_user guest_password Successful Login (Guest)

Explanation:

• Positive testing ensures that valid users can successfully log in with their correct credentials.

Negative Testing:

Test Case Username Password Expected Result

1 invalid_user valid_password Error: Invalid Username

2 valid_user invalid_password Error: Invalid Password

3 empty_username valid_password Error: Empty Username

4 valid_user empty_password Error: Empty Password

5 locked_user valid_password Error: Account Locked

Explanation:

• Negative testing explores scenarios where users provide invalid or empty inputs, encounter account
lockouts, or use incorrect credentials.

Summary:

• Positive testing ensures the correct functioning of the user authentication system under normal conditions.

• Negative testing helps identify and handle errors gracefully when the system encounters invalid inputs,
empty fields, or unexpected situations.

You might also like