Challenge

Project 2 - V&V SW Analysis II

1):-

Static Code Review Checklist

  1. Coding Standards

    • Check adherence to coding guidelines (e.g., naming conventions, indentation).
    • Ensure consistent use of comments and documentation.
  2. Code Structure

    • Verify that functions are appropriately sized and do not exceed reasonable complexity.
    • Ensure proper organization of files and functions.
  3. Error Handling

    • Look for proper error checking and handling mechanisms.
    • Check for usage of return values and whether errors are logged appropriately.
  4. Memory Management

    • Ensure that all allocated memory is freed appropriately.
    • Look for potential memory leaks.
  5. Control Flow

    • Analyze loops and conditional statements for correctness and clarity.
    • Identify any unreachable code.
  6. Security Concerns

    • Look for potential vulnerabilities, such as buffer overflows or improper input validation.
    • Verify the use of secure functions.
  7. Performance Considerations

    • Identify any inefficient algorithms or data structures.
    • Look for opportunities to optimize code.
  8. 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

  1. 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
  2. Automatic Test Case Creation with TBExtreme

    • Open TBExtreme: Launch the TBExtreme tool.
    • Import Source Files: Navigate to the folder containing your .c files 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

  1. 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 .tcf format.
  2. 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.
  3. Upload Location Image

    • Take a screenshot of the folder containing the .tcf file.
    • Ensure the screenshot clearly shows the filename and path.

Example Test Case Format

Here’s a basic template for a test case:

Test Case IDDescriptionPreconditionsStepsExpected ResultActual Result
TC01Add item to cartNone1. Open the cash register app
2. Add an item
Item is added to cartItem 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!
Your portfolio, next

Ship work like this
in your own course.

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.