Hey Welcome to BTER Rajasthan Polytechnic.
1. Join Groups for PDF's & Regular Updates
Join the community of Civil Engineering students at BTER Polytechnic and stay updated:
- Telegram Channel: Join Telegram Channel 📱
- WhatsApp Group: Join WhatsApp Group 💬
- YouTube Channel: Visit YouTube Channel 🎥
2. Help & Donations 💖
If you find our resources helpful and wish to support our initiative, your donation will help us continue improving and providing valuable study material.
- UPI ID: garimakanwarchauhan@oksbi
- QR Code:
💰 Your support matters! Every contribution helps us reach more students and provide better resources! 🙏
3. Notes Website
- Official Notes Website: Visit Notes Website 📝
This website provides all study materials, notes, and important updates for Civil Engineering students.
4. Important Links
Explore the following links for additional resources and exam preparation:
- Syllabus: Download Syllabus 📚
- Previous Year Papers: View Previous Year Papers 🗂️
- Study Materials: Download Study Materials 📑
UNIT 2: Writing Test Cases
This unit covers the fundamentals of writing effective test cases, the different types of testing (functional, non-functional), preparing test data, and understanding the importance of test scenarios and requirements. Let's break each topic down clearly.
2.1 Writing Test Cases
A test case is a set of conditions or variables under which a tester will determine whether the software behaves as expected. Writing effective test cases is one of the most crucial aspects of software testing.
Key Components of a Test Case:
- Test Case ID: A unique identifier for the test case.
- Example: TC001
- Test Case Description: A brief explanation of what the test case is intended to test.
- Example: Verify that the login page accepts valid username and password.
- Preconditions: Conditions that must be true before the test is executed.
- Example: User must be registered.
- Test Steps: Detailed steps to follow during the test.
- Example:
- Open the browser.
- Navigate to the login page.
- Enter a valid username and password.
- Click the "Login" button.
- Example:
- Expected Result: The anticipated outcome after performing the test steps.
- Example: User should be logged into the homepage.
- Actual Result: The result obtained when the test is executed.
- Example: User is logged into the homepage (or not).
- Postconditions: The state of the system after the test is completed.
- Example: The user remains logged in.
- Status: Whether the test case passed or failed based on the expected and actual results.
Example Test Case:
Test Case ID | TC001 |
---|---|
Test Case Name | Login Functionality |
Description | Verify login with valid credentials |
Preconditions | User is registered |
Test Steps | 1. Open browser 2. Go to login page 3. Enter username and password 4. Click Login |
Expected Result | User is successfully logged in |
Actual Result | User logged in successfully |
Status | Pass |
2.2 Functional Testing, Non-Functional Testing, UI Testing
These are different types of testing performed to validate various aspects of a software application.
Functional Testing
Functional testing checks whether the software functions according to the specified requirements. It verifies that the system behaves as expected from the user’s perspective.
- Example: Testing if a "Submit" button submits a form correctly.
- Key Activities:
- Verifying features work as intended.
- Checking business logic.
- Ensuring user inputs are processed correctly.
Non-Functional Testing
Non-functional testing evaluates aspects of the software that are not related to specific behaviors or functions but rather to its overall performance and usability.
- Types:
- Performance Testing: Ensures the software performs well under expected load.
- Example: How fast does a website load when 1000 users access it simultaneously?
- Security Testing: Verifies that the software is secure from external threats.
- Example: Checking if sensitive data is encrypted.
- Usability Testing: Ensures the software is user-friendly.
- Example: Testing the intuitiveness of a website’s navigation.
- Compatibility Testing: Ensures the software works across different devices, browsers, or operating systems.
- Example: Testing a website on Chrome, Firefox, and Safari to ensure it looks and functions the same.
- Performance Testing: Ensures the software performs well under expected load.
UI Testing
User Interface (UI) testing ensures that the software’s user interface works as expected and provides a smooth user experience.
-
Key Areas to Test:
- Layout (buttons, text alignment, etc.)
- Responsiveness (adapts to different screen sizes)
- Functionality (buttons, links, forms)
- Accessibility (keyboard navigation, color contrast)
-
Example: Verifying that the "Login" button is visible and clickable on the login screen.
2.3 Preparing Test Data, Writing Unit Test, Integration Test, and User Acceptance Tests
Preparing Test Data
Test data is the information that is fed into the software during testing to evaluate its behavior. The type of test data will depend on the specific test case being executed.
- Types of Test Data:
- Valid Data: Data that should result in a correct outcome.
- Example: A valid username and password for a login test.
- Invalid Data: Data that is incorrect or fails validation.
- Example: An invalid username or incorrect password for a login test.
- Boundary Data: Data at the edge of valid input ranges.
- Example: The smallest and largest allowed values for a field.
- Valid Data: Data that should result in a correct outcome.
Writing Unit Tests
Unit testing focuses on testing individual components or functions in isolation. It ensures that each function or module of the application works as expected.
- Example: Testing a function that calculates the total price of an order based on quantity and price per unit.
- Test Case: If the quantity is 3 and the price per unit is 100, the expected result should be 300.
Writing Integration Tests
Integration testing checks how different modules or components of the system interact with each other.
- Example: If you’re testing a shopping cart, you might write integration tests to ensure that after adding items to the cart, the correct total price is calculated when you proceed to checkout.
User Acceptance Testing (UAT)
User Acceptance Testing is done to validate whether the software meets the business requirements and if it is ready for deployment. It is typically done by the end user or client.
- Example: A client tests the final product to verify if all the features (such as login, adding items to a cart, etc.) work as expected and if it fulfills the business goals.
2.4 Preparing Test Scenarios from Software Requirements
A test scenario is a high-level concept that describes a situation to be tested. It is derived from the software requirements and focuses on the major aspects of functionality.
Steps to Prepare Test Scenarios:
- Understand the Software Requirements: Go through the functional and non-functional requirements of the system.
- Example: If the requirement is "The system should allow users to log in with valid credentials", a test scenario could be: "Test login functionality with valid credentials."
- Identify Key Features: Pick the most important features or workflows to test.
- Example: "Test adding items to the cart", "Test payment gateway integration".
- Write Scenarios: Write test scenarios based on real-world conditions and possible edge cases.
- Example: A scenario for login could be: "Test login functionality with correct username and password."
Test Scenario Example:
Test Scenario ID | TS001 |
---|---|
Test Scenario Name | Login Functionality |
Description | Verify that a user can log in with valid credentials. |
Associated Requirement | User must be able to log in with valid credentials. |
Test Steps | 1. Open browser 2. Go to login page 3. Enter valid username and password 4. Click login |
Expected Result | User is logged in successfully |
Summary of Topics:
- Writing Test Cases: A well-structured test case includes an ID, description, preconditions, steps, expected and actual results, and postconditions.
- Types of Testing:
- Functional Testing ensures that the software’s functionality works as expected.
- Non-Functional Testing focuses on performance, usability, security, and other factors.
- UI Testing ensures that the interface is user-friendly and responsive.
- Preparing Test Data: Create data sets that include valid, invalid, and boundary conditions for testing.
- Unit, Integration, and User Acceptance Tests: Unit tests focus on individual components, integration tests on interactions between components, and UAT ensures the software meets business requirements.
- Preparing Test Scenarios: Test scenarios are derived from software requirements and describe high-level test conditions or workflows to be validated.
📢 🔔 Download PDF & Join Study Groups:
📥 WhatsApp Group: Join Now
📥 Telegram Channel: Join Now
📺 Watch Lecture on YouTube: BTER Polytechnic Classes
📍 Stay connected for more study materials! 🚀
Thank You for Visiting!
We wish you all the best for your studies. Keep learning, and don't hesitate to reach out for help! 📚✨
0 Comments