Project 2 - V&V SW Analysis II
1):-
Static Code Review Checklist
Coding Standards
- Check adherence to coding guidelines (e.g., naming conventions, indentation).
- Ensure consistent use of comments and documentation.
Code Structure
- Verify that functions are appropriately sized and do not exceed reasonable complexity.
- Ensure proper organization of files and functions.
Error Handling
- Look for proper error checking and handling mechanisms.
- Check for usage of
returnvalues and whether errors are logged appropriately.
Memory Management
- Ensure that all allocated memory is freed appropriately.
- Look for potential memory leaks.
Control Flow
- Analyze loops and conditional statements for correctness and clarity.
- Identify any unreachable code.
Security Concerns
- Look for potential vulnerabilities, such as buffer overflows or improper input validation.
- Verify the use of secure functions.
Performance Considerations
- Identify any inefficient algorithms or data structures.
- Look for opportunities to optimize code.
Testing and Documentation
- Ensure that there are adequate unit tests for critical functions.
- Check that the code is well-documented and that the documentation is up to date.
Generating a Report
You can create a report in a document format (e.g., Word, PDF) that includes:
- File Overview: Brief description of the file’s purpose.
- Findings: Detailed findings based on the checklist above.
- Recommendations: Suggestions for improvement based on the findings.
Tools for Static Code Analysis
Consider using tools such as:
- Cppcheck: For C/C++ static analysis.
- Clang Static Analyzer: Part of the Clang project, useful for finding bugs.
- SonarQube: For broader static analysis, including various languages.
2):-
A) Creating Test Cases Manually and Automatically
Manual Test Case Creation
- Identify Requirements: Review the requirements for the Cash Register functionality.
- Define Test Scenarios: Write down different scenarios to test various functionalities (e.g., adding items, calculating totals, handling discounts).
- Write Test Cases: For each scenario, define the following:
- Test Case ID
- Description
- Preconditions
- Steps to execute
- Expected Result
- Actual Result
Automatic Test Case Creation with TBExtreme
- Open TBExtreme: Launch the TBExtreme tool.
- Import Source Files: Navigate to the folder containing your
.cfiles and import them into TBExtreme. - Generate Test Cases: Use the tool's features to automatically generate test cases based on the code structure and functions.
- Review and Edit: Review the generated test cases to ensure they cover all necessary scenarios. Edit as necessary.
B) Storing Test Cases as .tcf File
Save Test Cases in TBExtreme
- Once you have created your test cases, look for an option to export or save the test cases.
- Save them in the
.tcfformat.
Locate the .tcf File
- After saving, note the directory where the file is stored. It’s usually in the default project folder or the location you specified during the save process.
Upload Location Image
- Take a screenshot of the folder containing the
.tcffile. - Ensure the screenshot clearly shows the filename and path.
- Take a screenshot of the folder containing the
Example Test Case Format
Here’s a basic template for a test case:
| Test Case ID | Description | Preconditions | Steps | Expected Result | Actual Result |
|---|---|---|---|---|---|
| TC01 | Add item to cart | None | 1. Open the cash register app 2. Add an item | Item is added to cart | Item added successfully |
Final Steps
- After creating and saving your test cases, compile a report summarizing the test execution results.
- If you have any specific questions about using TBExtreme or any part of the process, feel free to ask!