Wednesday, April 19, 2023

User Interface Test Cases: What You Need to Know

1. Navigation Test: 
  • Test the navigation bar or menu by clicking on each link or button to ensure that they take you to the correct page or section of the website or application.
2. Input Validation Test: 
  • Test the input fields, such as forms or search boxes, by entering valid and invalid data to ensure that the system handles the inputs correctly.
3. Button Test: 
  • Test all buttons on the UI to ensure they perform the intended actions and provide appropriate feedback, such as success or error messages.
4. Compatibility Test: 
  • Test the UI on different devices and browsers to ensure it is compatible with various screen sizes, resolutions, and operating systems.
5. Responsiveness Test: 
  • Test the UI for responsiveness by resizing the browser window or using device emulators to see how the UI adapts to different screen sizes.
6. Content Test: 
  • Test the UI for consistency and accuracy of content, including text, images, and multimedia.
7. Accessibility Test: 
  • Test the UI for accessibility compliance, ensuring that users with disabilities can access and use the UI without any issues.
8. Performance Test: 
  • Test the UI for performance by checking loading times, response times, and any delays or lags in the system.

How to Send MySQL Data to an Email with Python

import smtplib
import csv
import pymysql
import json
import base64
import datetime
import smtplib
from email.mime.text import MIMEText
from email.mime.multipart import MIMEMultipart
from email.mime.application import MIMEApplication

# Connect to the MySQL database
db = pymysql.connect(host="localhost", user="root", password="pass1234", database="local")

# Execute an SQL query to retrieve data
cursor = db.cursor()
cursor.execute("SELECT * FROM local.questions")
data = cursor.fetchall()

# Write the data to a json file
data = [[str(col) if isinstance(col, datetime.datetime) else col for col in row] for row in data]
with open('data.json', 'w', encoding='utf-8', newline='') as file:
    json.dump(data, file, ensure_ascii=False)

# Open the JSON file
with open('data.json', 'r', encoding='utf-8') as file:
    data = json.load(file)

# Create the email message
from_addr = 'your@gmail.com'
to_addr = 'friend@gmail.com'
subject = 'JSON data'
msg = MIMEMultipart()
msg['From'] = from_addr
msg['To'] = to_addr
msg['Subject'] = subject

# Add the JSON file as an attachment
attachment = MIMEApplication(json.dumps(data, indent=2))
attachment['Content-Disposition'] = f'attachment; filename=data.json'
msg.attach(attachment)

# Connect to the SMTP server and send the message
server = smtplib.SMTP('smtp.gmail.com', 587)
server.starttls()
server.login(from_addr, 'Your_Gmail_APP_PASSWORD')
server.sendmail(from_addr, to_addr, msg.as_string())
server.quit()

Saturday, April 8, 2023

How to Implement Continuous Integration in Test Automation



Continuous integration (CI) is a software development practice that involves frequently integrating code changes from multiple developers( in your team) into a central repository. Example-Git etc.

How CI Helps:
  • This process helps to detect and fix bugs early in the development cycle, leading to faster and more efficient software delivery.
Automated test process:
  • In the context of software testing, continuous integration refers to the automated testing process that is triggered whenever new code changes are integrated into the main codebase.
What is the Goal?
  • The goal of this process is to ensure that the newly added code does not break the existing functionality of the application.
Easy example:
  • Here's an example of how continuous integration works in software testing:
  • You can consider the Amazon website or any other e-commerce website.
  • Suppose a software development team is working on an e-commerce application that allows users to purchase products online.
CI Tools:
  • The team uses a continuous integration tool such as Jenkins to automatically build and test the application every time a developer makes a code change and pushes it to the central code repository.
  • Whenever a developer makes a code change, Jenkins automatically pulls the latest code from the repository, builds the application, and runs a suite of automated tests to check if the application is still functioning correctly.
  • If any of the tests fail, the developer is notified immediately so they can fix the issue before it causes further problems.

Conclusion:
  • Continuous integration ensures that any new code changes are thoroughly tested before they are integrated into the main codebase, reducing the likelihood of introducing bugs or breaking existing functionality.
  • This helps to improve the quality of the software and accelerates the development process.

The Ultimate Guide to Smoke and Sanity Testing



Smoke Testing:
  • Smoke testing is done when we received the new build from the developer the build is stable or not, that build is testable or not.
  • Smoke testing is done by the developer and tester.
  • Smoke testing is done for every new build.
  • It is done on the initial build.

Sanity Testing:
  • Sanity testing is done at the release time of the software, it checks the main functionality of the software without going deeper.
  • Sanity testing is done by the tester only.
  • Sanity testing is done when the build is stable.
  • It is planned when we don't have sufficient time to test the software.