Testbytes IN website

What Is Positive Testing and Negative Testing? [Examples Included]

January 19th, 2024
What Is Positive Testing and Negative Testing? [Examples Included]

Effective software testing goes beyond confirming that an application functions as expected with valid inputs; it includes both positive and negative testing.

While positive testing ensures the system works correctly with valid inputs, negative testing explores how well the application handles invalid inputs and unexpected scenarios.

Remarkably, a substantial portion of test cases—approximately 85%—usually correspond to just 70% of the overall requirements. This emphasizes the significance of validating positive scenarios. However, the often overlooked 30% dedicated to failed negative value testing is equally crucial. This aspect ensures that the application exhibits robust behavior under unfavorable conditions and unexpected inputs.

This comprehensive approach, covering both positive and negative scenarios, contributes significantly to delivering a dependable and high-quality software product.

 What Is Positive Testing?

Positive testing involves validating an application’s functionality with valid inputs to ensure that it performs as expected. Testers do this by creating test cases based on predetermined outputs with the intention of confirming that the system accepts inputs for typical user use.

This type of testing is crucial and helpful for identifying vulnerabilities and ensuring the system’s resilience against inappropriate data.

For instance, consider a login functionality where a user is required to enter a username and password. In this scenario, positive testing would involve verifying that the system allows access with the correct combination of a valid username and password.

Positive testing not only ensures the system’s expected behavior but also aids in knowledge sharing regarding the system architecture throughout the Software Development Life Cycle (SDLC).

 What Is Negative Testing?

Negative testing explores the system’s behavior when it is subjected to invalid inputs or unexpected conditions.

The objective of negative testing is to ensure that the system responds appropriately by displaying errors when necessary and not exhibiting errors in situations where it should not.

Negative testing is essential for uncovering vulnerabilities and testing scenarios that may not have been explicitly designed.

For instance, consider a scenario where a user is required to enter a password. Negative testing in this context would involve entering invalid inputs, such as passwords with special characters or exceeding the allowed character limit.

The purpose is simple – to test the system’s ability to handle unexpected inputs and scenarios that may arise during real-world usage.

Difference Between Positive and Negative Testing

Difference Between Positive and Negative Testing

While each type of testing has its own unique characteristics and features, as mentioned below
are some of the key differences between positive and negative testing

Feature Positive Testing Negative Testing
Scope of Inputs Focuses on testing a specific number of user inputs with a valid set of values. Involves testing with excessive (load) inputs and an invalid set of values.
Perspective Done with a positive point of view, ensuring that the system accepts valid inputs. Approached with a negative point of view, testing for scenarios and inputs that are not designed.
Test Conditions Identifies a known set of test conditions based on client requirements. Conducted with an unknown set of test conditions, testing anything not mentioned in client requirements.
Password Test Example Validates that the password test scenario accepts 6-20 characters, including alphanumeric values. Ensures the password test scenario does not exceed 20 characters and does not accept special characters.

Example of Positive Testing

The method is the same as that of negative testing. But here, instead of false data, valid data will be entered, and the expected result is the system accepting the code with no problem.

Example of the Positive Test Scenarios

  • The password box should not accept less than 7 characters
  • The password box should be up to 22 characters
  • Password box should accept special characters up to 6-20 characters in length

Examples of Negative Testing

Filling up Required Fields – Imagine that there are fields in the website that requires a user to fill it up.  Negative testing can be done by feeding the box with negative inputs such as alphabets either the webpage should show an error message or it should not accept the input.
Factors that need to be considered while performing a negative test

  • Input data
  • Action
  • Output

Example of the Negative Test Scenarios

  • Password box should not accept more than 7 characters
  • Password box should not exceed 22 characters
  • Password box should not accept special characters


Positive and negative testing are integral components of software testing, collectively working towards achieving a 100% reliable and quality application.

Positive testing ensures that the system performs as expected under normal circumstances, while negative testing explores how the system behaves when subjected to invalid inputs and unanticipated scenarios.

Therefore, it is important for organizations and testers to recognize the significance of both testing methodologies and incorporate them into their testing strategies to deliver bug-free software and enhance overall software quality.

By understanding and implementing positive and negative testing effectively, testers can contribute significantly to the development of robust and resilient software applications.


How to write positive and negative test cases in selenium?

Writing positive and negative test cases in Selenium involves crafting scenarios that cover expected behaviors (positive) and potential failure scenarios (negative). Here are examples for both:

Positive Test Case:

Scenario: User Login with Valid Credentials

Test Steps:

  1. Open the application login page.
  2. Enter valid username.
  3. Enter valid password.
  4. Click on the “Login” button.

Expected Result:

  • User should be successfully logged in.
  • Verify that the user is redirected to the dashboard.

Selenium Code (Java):

public void testValidLogin() {
// Test steps to open login page, enter valid credentials, and click login
// Assert statements to verify successful login and redirection

Negative Test Case:

Scenario: User Login with Invalid Credentials

Test Steps:

  1. Open the application login page.
  2. Enter invalid username.
  3. Enter invalid password.
  4. Click on the “Login” button.

Expected Result:

  • User should not be logged in.
  • An error message should be displayed.

Selenium Code (Java):

public void testInvalidLogin() {
// Test steps to open login page, enter invalid credentials, and click login
// Assert statements to verify login failure and error message presence

In both cases, use assertions (e.g., Assert.assertEquals(), Assert.assertTrue()) to validate the expected outcomes. Make sure to handle synchronization issues using appropriate waits to ensure the elements are present or visible before interacting with them.

Remember, negative testing should cover various failure scenarios such as incorrect inputs, missing data, or unexpected behaviors.

What is monkey testing with example?

Monkey testing, also known as random testing or exploratory testing, is a software testing technique that involves randomly generating inputs and actions to uncover unpredictable errors and crashes. It’s like unleashing a curious monkey on your application to see what it might break.

Key Characteristics:

  • Unstructured: No predefined test cases or scripts.
  • Random Inputs: Inputs and actions are generated randomly, often using automated tools.
  • Exploratory: Encourages testers to explore the application intuitively and creatively.
  • Unexpected Behavior: Aims to discover hidden bugs and vulnerabilities that might not be caught by traditional testing methods.

Examples of Monkey Testing:

  1. Mobile App:

    • Rapidly tapping random areas of the screen.
    • Swiping in all directions without specific goals.
    • Entering random text or numbers into input fields.
    • Launching multiple apps and switching between them quickly.
    • Force-closing the app during active tasks.
  2. Web Application:

    • Clicking buttons and links in random order.
    • Entering unexpected characters or long strings into forms.
    • Refreshing or navigating pages rapidly.
    • Opening multiple browser tabs and interacting with them simultaneously.
    • Trying unusual keyboard shortcuts or mouse gestures.


  • Uncovers Unexpected Issues: Identifies bugs that might be missed by structured testing.
  • Fast and Easy to Implement: Can be performed quickly, even without detailed knowledge of the application.
  • Complements Traditional Testing: Helps expand test coverage and uncover edge cases.


  • Unreliable: May miss critical bugs due to the randomness of inputs.
  • Difficult to Reproduce: Issues found can be challenging to replicate due to the lack of specific test steps.
  • Time-Consuming: Extensive monkey testing can be time-intensive, especially for large applications.

Best Practices:

  • Combine with Structured Testing: Use monkey testing alongside traditional testing techniques for comprehensive coverage.
  • Target Specific Areas: Focus monkey testing on critical or complex parts of the application.
  • Use Tools Wisely: Utilize automated tools to generate random inputs, but don’t rely solely on them.
  • Document Findings: Record any issues found during monkey testing for future reference and resolution.
Testbytes IN website
Recent Posts
Please enter valid email address

Contact Us
Please type your Name
Please enter valid email address
Please enter phone no.
Please enter message
Testbytes IN website

Search Results for:


Contact Us