Testing QA CheatSheet 1723460950
Testing QA CheatSheet 1723460950
Testing - software testing is an activity to check whether the actual results Testing Levels Testing Types Test Design Techniques - Specification Based
match the expected results and to ensure that the software system is defect
free. Component (Unit) Testing: Focuses on individual Black Box Testing: Testing based on external Equivalence Partitioning: Dividing input data into valid and
Why testing is necessary? components or units of the software to ensure they expectations; internal system structure is not invalid partitions to reduce the number of test cases.
• Human -> Error (mistake) -> Defect (fault, bug) which when executed function correctly in isolation. considered. Example: Testing input ranges for an age field (e.g., 0-18,
may cause -> Failure. Example: Testing a single function in a codebase to Example: Checking if a user can successfully log in 19-65, 66-100).
• Measures the quality of the software. verify it returns the expected output. with valid credentials without knowing the internal Boundary Value Analysis: Testing the boundaries between
• Gives confidence in the quality.
Component Integration Testing: Tests the interactions code structure. partitions for more effective defect identification.
• Reduces the overall level of risk.
between integrated components to detect interface Functional Testing: Testing that verifies each Example: Checking the values at the edges of input ranges
• How much testing? Depends on risk, safety & project constraints.
Seven Testing Principles defects. function of the software operates according to like 18, 19, and 20 for age verification.
• Testing shows presence of defects Example: Testing the data flow between a database and requirements.
Test Design Techniques - Experience Based
• Exhaustive testing is impossible an API to ensure they communicate correctly. Example: Ensuring that the user registration form
• Early Testing System Testing: Validates the complete and integrated correctly saves user details into the database. Exploratory Testing: Simultaneously learning, test design,
• Defect clustering system to ensure it meets specified requirements. Non-Functional Testing: Testing aspects not related and test execution to uncover defects using the tester's
• Pesticide Paradox Example: Testing an entire e-commerce application to to specific functions, like performance, usability, experience and intuition.
• Testing is context dependent ensure all features, like search, payment, and checkout, and security. Example: Navigating through an application without
• Absence of error fallacy work together as expected. Example: Measuring the time, it takes for a web predefined test cases to identify unexpected issues.
page to load under different network conditions. Error Guessing: Using the tester's experience to anticipate
Fundamental Test Process and test areas where defects are likely to occur.
White Box Testing: Testing based on the internal
Planning & Control -> Analysis & Design -> Implementation & Execution -> Evaluating Exit Criteria & Reporting -> Test Closure Example: Checking for input errors in fields known to
workings of an application; involves checking the
commonly cause problems, such as special characters in
code, internal structures, and logic.
username fields.
Software Development Models (SDLC) Acceptance Testing: Conducted to determine whether Example: Unit testing functions in the code to
Software Development Life Cycle defines the steps/stages/phases in the the system meets user needs and business ensure each function behaves as expected.
Integration Testing Techniques
building of software. requirements, often the final testing phase before
Structural Testing: Testing that looks at the internal
deployment. Top-Down Integration: Starts with the high-level modules
structure of the software; a subset of white-box
Requirements Gathering -> Analysis -> Design -> Coding -> Testing -> Maintenance Example: Running a final round of tests based on user and gradually incorporates lower-level modules, testing
scenarios to ensure the software fulfils all business testing.
the system from the top to the bottom.
Waterfall Model: A linear sequential approach where each phase must requirements before launch. Example: Code coverage analysis to ensure all code
Bottom-Up Integration: Starts with the lower-level
be completed before the next begins, ideal for well-defined projects paths are tested.
modules and gradually incorporates higher-level modules,
with clear requirements. Smoke Testing: A preliminary test to check the basic Re-Testing: Testing specific defects after they have
testing the system from the bottom to the top.
V-Model: An extension of the Waterfall Model where testing activities functionality of the application to ensure it is stable been fixed to ensure the fixes work as intended.
Sandwich/Hybrid Integration: Combines top-down and
are planned in parallel with corresponding development stages, enough for further testing. Example: Retesting the checkout process in an e-
bottom-up approaches, testing both high-level and low-
emphasizing verification and validation. Example: Verifying that the application launches commerce application after a bug fix was applied to
level modules simultaneously.
RAD Model: Rapid Application Development focuses on quick successfully and that main features like login work the payment module.
prototyping and iterative delivery with user feedback, suitable for after a new build. Regression Testing: Comprehensive testing to Stubs: Temporary replacement modules that simulate the
projects needing rapid development and frequent revisions. Sanity Testing: A focused check on specific ensure that recent code changes have not adversely behavior of the actual modules that are not yet
Iterative Model: Development is done in repeated cycles (iterations), functionalities or bug fixes to ensure they work as affected existing functionalities. implemented or available. Stubs are used in a top-down
allowing for gradual improvement and refinement of the system with intended after minor changes. Example: Running a full suite of tests on the entire integration approach.
each iteration based on feedback. Example: Testing the login functionality specifically application after a new feature is added to verify no Drivers: Temporary replacement modules that simulate the
Agile Model: Emphasizes iterative development, collaboration, and after a fix was applied to the login feature to ensure existing features are broken. behavior of the actual modules that are not yet
flexibility, delivering small, incremental releases frequently to the fix works. implemented or available. Drivers are used in a bottom-up
accommodate changing requirements. integration approach.
Scrum Model: A specific Agile framework using time-boxed iterations Static Techniques:
Test Management
called sprints, involving daily stand-ups, sprint planning, and
Informal Review: An unstructured review process without formal documentation or procedures aimed at • Test Organisation
retrospectives to ensure continuous delivery and improvement.
finding defects early. • Test Planning & Estimation
Walkthrough: A step-by-step presentation by the author to gather feedback from participants. • Test Progress Monitoring & Control
Activities of a Formal Review:
Technical Review: Focusing on the technical content and quality of the product, often conducted by experts. • Risks and Testing
Planning -> Kick-off -> Individual Preparation -> Review Meeting ->
Inspection: A formal, rigorous process with defined roles and steps, aimed at detecting defects and improving • Configuration Management
Rework -> Follow-up
quality. • Incident Management
Test Plan: A comprehensive document outlining the scope, approach, resources, and Tool Support for Testing: TEST AUTOMATION - SELENIUM
schedule of intended testing activities.
Test Management Tools: HP ALM, TestRail.
Test Case: Detailed step-by-step instructions to validate specific system functionality,
Requirements Management Tools: IBM DOORS, Jama. To upload a file in Selenium WebDriver:
including preconditions, inputs, actions, expected results, and post-conditions.
Incident Management Tools: JIRA, Bugzilla. Locate the browse button
Test Scenario: High-level description of an end-to-end functionality or user story to be
Configuration Management Tools: Git, Subversion. WebElement browse =driver.findElement(By.id("uploadfile"));
tested, which can encompass multiple test cases.
Static Analysis Tools: SonarQube, Coverity. Pass the path of the file to be uploaded using sendKeys method
Test Strategy: A high-level document outlining the test approach, resources, schedule,
Test Execution Tools: Selenium, QTP. browse.sendKeys("D:\\SeleniumInterview\\UploadFile.txt");
and scope for the testing activities.
Performance Testing Tools: JMeter, LoadRunner.
Defect Age: The time period between the introduction of a defect and its detection.
Dynamic Analysis Tools: Valgrind, AQtime. String handle=driver.getWindowHandle();
Bug Leakage: Defects that escape to production despite being tested during
Test Data Preparation Tools: Datagen, IBM Optim. Set<String>handles = getWindowHandles();
development.
Service Virtualization Tools: CA Service Virtualization, Parasoft driver.switchTo().window(handle);
Bug Release: Defects identified but intentionally deferred for fixing in future releases.
Virtualize. How to switch to newly created window String curWindow=driver.getWindowHandle();
Severity: The impact level of a defect on the system's functionality or performance.
Priority: The urgency and importance of fixing a defect based on business needs. Get all window handles Set<String>handles = getWindowHandles();
Effective Use of Tools:
Defect Triage: The process of prioritizing and assigning defects based on their severity, for(string handle: handles)
priority, and impact on the project. • Potential Benefits & Risks. {
Blocker Bug: A critical defect that prevents further testing or usage of the software, • Special consideration for Test Execution, Static Analysis & if handle.equals(curWindow))
necessitating immediate resolution. Test Management tools. {
driver.switchTo().window(handle);
}
}
Test Automation: Selenium Locators: Scroll down a page using Javascript: Handling Alerts:
Test automation or automation testing is the process of using
Locator by ID Syntax: executeScript("window.scrollBy(x-pixels,y-pixels)"); driver.switchTo().alert().dismiss();
specialized software to control the execution of tests and compare the
driver.findElement(By.id("signup-username")).sendKeys(""); First, create a JavaScript object driver.switchTo().alert().accept();
results with expected outcomes. Automation testing can help reduce
Locator by linkText JavascriptExecutor js = (JavascriptExecutor) driver; driver.switchTo().alert().getText();
the time, cost, and effort required to test software applications by
driver.findElement(By.linkText(“Today’s deals”)).click(); Launch the desired application driver.switchTo().alert().sendKeys
automating repetitive tasks and allowing testers to focus on more
Locator by partialLinkText driver.get(“https://www.flipkart.com”); (“Text”);
critical test cases.
driver.findElement(By.partialLinkText(“NextP”)).click(); Scroll down to the desired location
Locator by Name TestNG Annotations:
Selenium: js.executeScript("window.scrollBy(0,1000)");
Selenium is an open-source tool used as a free automation testing suite driver.findElement(By.name(“books”).click()); @BeforeSuite
of tools. Licensing is not required, and it has more benefits than other Locator by TagName To mouse hover over a web element: @AfterSuite
testing tools. The tests can be done in any operating system like Mac, driver.findElement(By.tagName(“button”).click()); @BeforeTest
Actions class utility is used to hover over a web element in
Linux and Windows. Selenium can be combined with some tools, such Locator by className @AfterTest
Selenium WebDriver
as TESTNG in Selenium and JUNIT, for managing test cases and driver.findElement(By.className("Submit")).click(); Instantiate Actions class. @BeforeGroups
generating reports. Locator by Xpath Actions action = new Actions(driver); @AfterGroups
driver.findElement(By.xpath("//input[@name='email']")).sendKeys(""); In this scenario, we hover over search box of a website @BeforeClass
Advantages of using Selenium: Locator by cssSelector @AfterClass
actions.moveToElement(driver.findElement(By.id("id of the
Selenium is an automation tool and has some unique benefits that give driver.findElement(By.cssSelector("button[type='submit']")).click(); @BeforeMethod
searchbox"))).perform();
it a competitive edge over others such as open source, multi-language @AfterMethod
support, platform support, multi-browser support, framework Selenium Locators:
To select a value from a dropdown: Junit Annotations:
availability and flexibility, reusability, and integrated and parallel test Navigate to Url -> driver.navigate().to("https://www.amazon.in/");
execution. Navigate to Refresh page -> driver.navigate().refresh(); WebElement testDrop = @Test
Navigate Forward -> driver.navigate().forward(); driver.findElement(By.id("testingDropdown")); @Before
Driver Initialization: Navigate Backward -> driver.navigate().back(); Select dropdown = new Select(testDrop); @BeforeClass
WebDriver offers three ways to select from a dropdown: @After
Firefox WebDriver driver = new FirefoxDriver(); Waits in Selenium:
Chrome WebDriver driver = new ChromeDriver(); selectByIndex: Selection based on index starting from 0 @AfterClass
Explicit Wait is used to tell the Web Driver to wait for certain
Microsoft Edge WebDriver driver = new EdgeDriver(); dropdown.selectByIndex(5); @Ignores
conditions before throwing “ElementNotVisibleException” exception.
Safari WebDriver driver = new SafariDriver(); Syntax: WebDriverWait wait = new WebDriverWait(driver,30); selectByValue: Selection based on value
dropdown.selectByValue(“Enter Value”); Created and summarized by,
Implicit Wait directs the Selenium WebDriver to wait for Fluent Wait is used to define maximum time for the web driver to wait for a selectByVisibleText: Selection of option that displays text Baskar P
a certain measure of time before throwing an exception. condition, as well as the frequency with which we want to check the condition before Entry Level IT Professional
matching the given argument Mob: +91 98434 77292
Syntax: driver.manage().timeouts().implicitlyWait(10, throwing an “ElementNotVisibleException” exception. dropdown.selectByVisibleText(“Enter the visible text”); +91 70100 99352
TimeUnit.SECONDS);