Challenge

Project 2 - V&V SW Analysis II

Dear TSE,

I am writing to apprise you of my current system configuration, which involves the utilization of a MacOS platform featuring an M1 chip CPU. Regrettably, there is currently an absence of compatible VPN client software tailored for this system. Consequently, I have meticulously outlined a comprehensive set of procedural instructions to address the intricacies of the assigned problem statement

1. Perform Static Code Review Analysis for “C:\**\LDRA_workarea\Examples\C_Testbed_examples\Testrain\Testrain.c” Generate Code review report and upload them

Ans:

SAMPLE CODE (Testrain.c):

#include

int main() {
int x = 10;
int y = 0;
int z;

// Division by zero
z = x / y;

printf("Result: %d\n", z);

return 0;
}

Step 1: Setup  

Ensuring that we have the necessary tools installed, including a C compiler and a static code analysis tool like "CodeChecker".

Step 2: Code Review Setup  

  1. Create a file named "Testrain.c".
  2. Write the "Testrain.c" code using a text editor or an integrated development environment (IDE).

Step 3: Run Static Analysis  

  1. Open a terminal or command prompt.
  2. Navigate to the directory containing "Testrain.c" using the `cd` command. For example: 

   "cd C:\ \LDRA_workarea\Examples\C_Testbed_examples\Testrain\ "

  1. Run the static code analysis tool "CodeChecker" on the code file "Testrain.c". Assuming "CodeChecker" has a command-line interface for analysis, we will use a command like:

   "codechecker analyze Testrain.c "

   This command will initiate the analysis process. 

Step 4: Review Analysis Results  

  1. Once the analysis is complete, the tool will generate a report. We can access the report through the tool's interface or by navigating to the directory where the report is saved.
  2. Open the report using a web browser or a viewer provided by the tool.
  3. In the report, we have to locate the issue related to division by zero. The tool will provide details about the issue, including the line number and a description of the problem.

 For instance, we might see an issue like: 

"  Issue: Division by zero 

   Description: This line contains a division by zero which can result in undefined behavior. 

   File: Testrain.c 

   Line: 11 "  

Step 5: Fixing and Re-analysis  

  1. Open "Testrain.c" in a text editor or IDE.
  2. Find the line of code causing the division by zero issues:

 " z = x / y; "

  1. Address the issue by modifying the code to handle the division by zero case. Change the code to:

"  if (y != 0)

     { 

       z = x / y; 

       printf("Result: %d\n", z); 

     }

    else   

       { 

       printf("Error: Division by zero\n"); 

       } 

  1. Save the changes to "Testrain.c".
  2. Open a terminal or command prompt and navigate to the directory containing "Testrain.c".
  3. Run the static analysis tool "CodeChecker" again on the modified code:

" codechecker analyze Testrain.c "

Step 6: Documentation:

  Create a documentation report summarizing the analysis process, the identified issue, the code changes you made, and the reason for those changes. Include any relevant information about the static analysis tool you used.

2. Perform Integration testing by including all the .C files available in the folder location C:\**\LDRA_workarea\Examples\Toolsuite\Cashregister_6.0\ **           

A)Create the test cases manually as well as automatically using TBExtreme and upload the reports.                                  B)store the test cases as .tcf file.  

Upload the location image where the .tcf file is stored.

Ans:

Step 1: Gather the Necessary Tools and Files 

Locate .C Files: Navigating to the folder location `C:\\LDRA_workarea\Examples\Toolsuite\Cashregister_6.0\` and identifying all the `.C` files that you want to include in the integration testing.

Step 2: Manual Test Case Creation 

Identify Scenarios: Reviewing the `.C` files and identify integration scenarios where multiple components interact.

Create Test Cases: Creating manual test cases that cover the identified scenarios. Each test case should specify the inputs, expected outcomes, and interactions between components.

Step 3: Automatic Test Case Generation Using TBExtreme 

Create a Test Project:

- Opening LDRA TBExtreme. 

- Creating a new test project. 

- Setting the project properties, including the target system and compiler settings. 

Import .C Files:

- Importing all the `.C` files from the specified folder into the test project. 

- We should ensure that the files are correctly associated with the project. 

Define Test Scenarios:

- Using TBExtreme's interface to define test scenarios or test conditions that involve interactions between components. 

Generate Test Cases:

- Using TBExtreme's test generation features to automatically generate test cases based on the defined scenarios. 

- Configuring the test generation settings as needed. 

Step 4: Store Test Cases as .tcf Files 

Save Test Cases:

- As we create test cases manually or automatically using TBExtreme, saving each test case within the test project. 

- Following the naming conventions as per the project. 

Export as .tcf Files:

- After creating test cases, we can export them as `.tcf` files. 

- `.tcf` files are used to store test cases in LDRA TBExtreme. 

Step 5: Perform Integration Testing 

Execute Tests:

- In LDRA TBExtreme, execute the generated test cases. This involves running tests against the code to observe interactions and outcomes. 

Capture Results:

- As the tests run, LDRA TBExtreme captures test execution results, including pass/fail status and coverage metrics. 

Step 6: Generate and Upload Reports 

Generate Reports:

- After executing the tests, generate test reports within LDRA TBExtreme. These reports provide detailed information about test coverage and outcomes. 

Export Reports:

- Exporting the generated reports to appropriate formats (e.g., PDF, HTML) using LDRA TBExtreme's reporting capabilities. 

Upload Reports:

- The generated reports are shared with the team or stakeholders by uploading them to a designated location, such as a shared drive or a version control system. 

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.