Tuesday, March 21, 2023

Building Java Projects Made Easy with Maven

 Maven:

  •  Maven is a project management tool or software build tool or dependency management tool.
  •  It is used for project build or dependencies.

Maven addresses two aspects:

 1. It describes how software is built.

 2. It describes the software dependencies.

  • In Maven execution starts from the pom.xml file, it reads the POM.xml file and starts execution.

Uses of Maven:

  •  It is used to build the software application, manage your dependencies, run your tests, and create reports.

Maven Structure:

 src/main/java

 src/main/resources

 src/test/java

 src/test/resources

 JRE System library

 Maven Dependencies

 src

 target

 pom.xml


pom.xml: (Project Object Model)

  •  A Project Object Model or POM is the fundamental unit of work in Maven.
  •  It is an XML file that contains information about the project and configuration details used by Maven to build the project.
  •  It contains default values for most projects.


👋 Hi, I'm Suriya — QA Engineer with 4+ years of experience in manual, API & automation testing.

📬 Contact Me | LinkedIn | GitHub

📌 Follow for: Real-Time Test Cases, Bug Reports, Selenium Frameworks.

How to Write Effective Test Scripts for Postman API Testing

pm.test("success status", () => pm.response.to.be.success );


pm.test("Status code is 200 or 201"function () {
  pm.expect(pm.response.code).to.be.oneOf([200201]);
});


pm.test("Response time is less than 300ms", () => {
  pm.expect(pm.response.responseTime).to.be.below(300);
});


pm.test("Response status code contains 'Created' or 'OK'"function () {
  console.log(pm.response.status);
  pm.expect(pm.response.status).to.be.oneOf(['Created''OK']);
});


pm.test("Response body is not empty"function () {
    pm.expect(pm.response.text()).to.not.be.empty;
});

👋 Hi, I'm Suriya — QA Engineer with 4+ years of experience in manual, API & automation testing.

📬 Contact Me | LinkedIn | GitHub

📌 Follow for: Real-Time Test Cases, Bug Reports, Selenium Frameworks.

Monday, March 20, 2023

Dropdown Handling with Selenium WebDriver: Tips and Techniques

 import java.time.Duration;

import java.util.ArrayList;

import java.util.List;

import java.util.stream.Collectors;

import org.openqa.selenium.By;

import org.openqa.selenium.WebDriver;

import org.openqa.selenium.WebElement;

import org.openqa.selenium.chrome.ChromeDriver;

import org.openqa.selenium.support.ui.Select;

import org.testng.annotations.AfterTest;

import org.testng.annotations.BeforeTest;

import org.testng.annotations.Test;

import io.github.bonigarcia.wdm.WebDriverManager;

public class Example {

WebDriver driver;

@BeforeTest

public void setUp() {

WebDriverManager.chromedriver().setup();

driver = new ChromeDriver();

driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(10));

driver.manage().window().maximize();

driver.get("https://www.amazon.com/");

}

@Test

public void dropdownTest() {

WebElement dropdown = driver.findElement(By.id("searchDropdownBox"));

Select select = new Select(dropdown);

// Print the first selected option and assert if it equals “All Departments”.

String firstSelectedOption = select.getFirstSelectedOption().getText();

System.out.println("firstSelectedOption = " + firstSelectedOption);

if (firstSelectedOption.equals("All Departments")) {

System.out.println("PASS");

} else {

System.out.println("FAIL");

}

// Print all of the drop down options-getOptions(); method returns the List<WebElement>. 

Using a loop, print all options.

List<WebElement> allOptions = select.getOptions();

for (WebElement eachOption : allOptions) {

System.out.println(eachOption.getText());

}

// Print the total number of options in the dropdown

int totalNumOfOptions = select.getOptions().size();

System.out.println("numOfOptions = " + totalNumOfOptions);

// if ‘Appliances’ is a drop-down option. Print true if “Appliances” is

// an option. Print false otherwise.

List<String> listOfOptions = new ArrayList<>();

for (WebElement eachOption : allOptions) {

listOfOptions.add(eachOption.getText());

}

System.out.println("listOfOptions = " + listOfOptions);

if (listOfOptions.contains("Appliances")) {

System.out.println("TRUE");

} else {

System.out.println("FALSE");

}

// Assert if the dropdown is in Alphabetical Order

List<String> sortedList = listOfOptions.stream().sorted().collect(Collectors.toList());

System.out.println("sortedList = " + sortedList);

}

@AfterTest

public void tearDown() {

driver.quit();

}

}

👋 Hi, I'm Suriya — QA Engineer with 4+ years of experience in manual, API & automation testing.

📬 Contact Me | LinkedIn | GitHub

📌 Follow for: Real-Time Test Cases, Bug Reports, Selenium Frameworks.

Thursday, March 16, 2023

OTP Code Verification: How to Test for Every Scenario

  1. Verify for verification whether valid and correct OTP is generated or not.
  2. Verify OTP code should be valid only for one time or not.
  3. Verify the count for the OTP code generated should not be more than required.
  4. Test the count for the OTP code generated should not be less than required.
  5. Verify OTP code is sent to the user successfully or not within time or not.
  6. Verify and confirm the time duration in which the user received the OTP-generated code sent by email.
  7. Check the time duration for the OTP-generated code received by the user on mobile.
  8. Verify the OTP code fetched by the application from the message by default or user add manually. It depends on the requirements.
  9. Verify by adding the valid OTP application that must accept the code successfully.
  10. Confirm whether the correct info message is shown or not in case if the User adds a valid OTP code.
  11. Verify a proper error message should be shown in case if the user adds an invalid OTP code.
  12. Verify OTP code should expire after the time allowed by the application or software.
  13. Verify application should not accept the OTP code once expired.
  14. Verify the user can request a new OTP code by clicking on the link or button to resend the code.
  15. Verify on again request on clicking on the Resend link OTP code should be sent to the user successfully or not.
  16. Verify whether the user should be temporarily blocked or not in case it requests for new OTP code again and again.
  17. Verify whether the limit is set for the OTP code to resend multiple times or not. (For example, a maximum of five attempts is allowed per user)
  18. Verify OTP code is case-sensitive or Not.
  19. Verify OTP code is only numeric or alphanumeric.

👋 Hi, I'm Suriya — QA Engineer with 4+ years of experience in manual, API & automation testing.

📬 Contact Me | LinkedIn | GitHub

📌 Follow for: Real-Time Test Cases, Bug Reports, Selenium Frameworks.

Email Field Testing: Tips and Best Practices for Effective Results

 Design-related Test Cases:
  1.  Verify email field is present on the page.
  2.  Verify whether the label text is shown with the email field or not.
  3.  Verify label text email align with the email field.
  4.  Verify that the placeholder text in the email field is added or not.

Functional Test Cases:
  1.  Verify email address field is accessible by clicking on the email field.
  2.  Check users can type email in the email field.
  3.  Verify user can paste the email address in the field by keyboard keys Ctrl + v.
  4.  Verify that the user can paste the email address with the mouse by right-clicking in the email field and pasting the email address.
  5.  Verify validation for the email field is implemented or not.
  6.  Verify whether an error message should be shown in case if the user adds an invalid email address or not.

Positive Test Cases:
  1.  Validate the email field by entering a valid email address. (abc@gmail.com)
  2.  Verify the email must contain @ in the email address.
  3.  Verify that an email field accepts an email containing a plus + sign in the Email address.
  4.  Verify whether an email field validates an email address containing a domain or not. (abc@gmail.com)
  5.  Make sure there should dot present in the email address or not.
  6.  Verify an email address should be considered correct if an email contains a subdomain.
  7.  Check that an email address has a maximum of 2 dots in the case of the subdomain.
  8.  Verify an email address containing a special character consider valid.
  9.  Verify an email address having numbers is valid.
  10.  An email address with quotes ” ” should consider valid.
  11.  An email address may contain a dash – or underscore _.


👋 Hi, I'm Suriya — QA Engineer with 4+ years of experience in manual, API & automation testing.

📬 Contact Me | LinkedIn | GitHub

📌 Follow for: Real-Time Test Cases, Bug Reports, Selenium Frameworks.