Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(Tests) Add unit tests #140

Merged
merged 39 commits into from
Jan 9, 2024
Merged

(Tests) Add unit tests #140

merged 39 commits into from
Jan 9, 2024

Conversation

haga-rak
Copy link
Owner

@haga-rak haga-rak commented Jan 9, 2024

No description provided.

haga-rak and others added 30 commits January 8, 2024 19:40
A new set of unit tests has been added to validate the functionality of the ResponseBodySummaryProducer class. This additional test coverage checks if the result produced by the class correctly matches the expected content type or returns null depending on different URL cases.
A new unit test has been introduced in the Producers.cs file. This test checks the ResponseTextContentProducer's functionality by asserting whether a returned result is either null or not null based on different URLs.
A new unit test for the SetCookieProducer class has been added, testing its functionality against different URL input values. In addition, the auto-redirect option in the HttpClientHandler within the QuickArchiveBuilder has been disabled to ensure tests get more accurate results.
The unit test for RequestJsonBodyProducer has been enhanced with two inputs scenarios. Now it can handle cases where the HttpRequestMessage content could be null or not. The Assertions will now apply based on the boolean 'pass' parameter.
New unit tests for `ProducersActions` have been included. Additionally, decompression handling has been refined for `QuickArchiveBuilder` and the HTTP request raw header format has been updated in `Producers` tests.
Added an assertion in the Producers.cs structure of the Fluxzy.Tests to ensure that the ContentLength attribute of the result is greater than 0. This is to prevent a situation where a result is obtained but there is no content within it.
A new unit test has been added for the ResponseBodyJsonProducer class. This test checks whether the producer can correctly build and format responses based on different URLs. It uses Assert methods to verify the results.
An additional test case has been added to the unit test for the method ResponseBodyJsonProducer. This ensures that the method correctly handles different inputs.
The SubdomainUtility class in Fluxzy.Core has been updated to correctly handle the case when the host comprises of two parts. Additionally, a test class for SubdomainUtility has been created under Fluxzy.Tests, which includes several test cases for the TryGetSubDomain function.
New unit tests were added for the StringHelper utility class in the Fluxzy project, specifically covering the ToCamelCase, AddTrailingDotAndUpperCaseFirstChar, and EscapeDoubleQuote methods. This ensures the expected behavior and functionality of these methods under different scenarios.
Added several calls to methods in the FluxzySetting unit tests to provide a more comprehensive test coverage. These methods include the adjustment of bound addresses, save filters, and server protocols among others. The goal is to ensure proper functioning and coverage for all FluxzySetting capabilities.
A new method called GetRegisteredRandomDirectory is added to the ProduceDeletableItem class in the test fixtures. This lets us create and register random directories, enhancing the testing capabilities for deleting items.
The changes ensure null-forgiving post-fix (! operator) is properly applied on the Request.Body in ProxyOrchestrator. This will prevent a potential null reference exception by guaranteeing that the Body attribute of the Request object cannot be null when methods are invoked on it.
The 'src/Fluxzy' directory was mistakenly added to the codecov ignore list. This commit corrects this by removing it from the list, ensuring that this directory is now considered in the code coverage reports.
This commit includes the Fluxzy main component in the codecov file, defining its paths for tracking. It helps to accurately measure the test coverage for the overall Fluxzy project.
New tests have been added for SearchTextFilter in the Fluxzy application. These tests assess a variety of scenarios, including searching in the request body, request header, response body, and response header.
This update includes the addition of 'with-request-payload.fxzy' to the Fluxzy.Tests project. The file has been marked to preserve the newest copy when it is output.
The LegacyPcapWriter class was removed from the Fluxzy.Core.Pcap project. This was a deprecated class handling specific pcap writing activities, which are now handled by more efficient or updated components within the system. This aims to improve the overall efficiency and maintainability of the code.
The ResponseSuggestedExtension method in HeaderUtility.cs file was refactored to avoid redundant code and promote reusability. The response type check was replaced with a call to a new method that performs the same task, reducing code length and improving readability.
This commit introduces unit tests for the HeaderUtility class in the Fluxzy.Tests project. These tests utilize example content types and validate returns for the following methods: GetRequestSuggestedExtension, GetResponseSuggestedExtension, and GetSimplifiedContentType.
This commit introduces specific equality tests for `Authority`, `FluxzyEndPoint`, `ProxyBindPoint`, `SystemProxySetting` and `Tag` classes. These tests utilize a base testing class `EqualityTesterBase` which provides a standard test structure and enforces equality and non-equality checks for each class.
In the updated configuration for Codecov, debugging related files under "src/Fluxzy.Core/Clients" and "src/Fluxzy.Core/Misc/Streams" directories are added to be ignored. This means these files are no longer considered in code coverage statistics.
This commit introduces unit tests for ArchiveReader in the Fluxzy.Tests project. Each test thoroughly inspects different aspects of the ArchiveReader's functionality and assures that all components are properly working. Separate tests have been also created for FluxzyArchiveReader and DirectoryArchiveReader.
These changes refine the unit tests by adding more assertions for equality and inequality in the EqualityTesterBase class. This includes checks for object equivalence and verifies that a string labeled "notEqual" is also recognized as not equal.
A new ImportEngineProvider unit test file has been added to improve the code coverage. Changes also include minor adjustments in the Fluxzy.Tests.csproj and ImportEngineProvider.cs files, such as copy-to-output directory options and coding style.
This commit introduces two new unit tests. These tests are for the equality operators of the Agent and AuthorityInfo classes. They ensure that instances of these classes are properly evaluated for their equivalence or lack thereof.
@haga-rak haga-rak changed the title (Tests) Add tests (Tests) Add unit tests Jan 9, 2024
The timeout in AddHocConfigurableProxy has been increased from 20 to 40 to allow for more flexibility. Timeout for OS detection under OSX platform has also been extended from 40 to 60, allowing more time for slower systems and preventing premature termination.
@haga-rak haga-rak merged commit d69d6c8 into main Jan 9, 2024
1 of 3 checks passed
@haga-rak haga-rak deleted the chore/more-test branch January 10, 2024 09:13
@haga-rak haga-rak added the ci Related to testing and CI label Jan 12, 2024
haga-rak added a commit that referenced this pull request Feb 12, 2024
* Remove Fluxzy directory from codecov ignore list

The 'src/Fluxzy' directory was mistakenly added to the codecov ignore list. This commit corrects this by removing it from the list, ensuring that this directory is now considered in the code coverage reports.

* Add Fluxzy component to codecov.yml

This commit includes the Fluxzy main component in the codecov file, defining its paths for tracking. It helps to accurately measure the test coverage for the overall Fluxzy project.

* Add new test data

* Add unit tests for SearchTextFilter

New tests have been added for SearchTextFilter in the Fluxzy application. These tests assess a variety of scenarios, including searching in the request body, request header, response body, and response header.

* Add 'with-request-payload.fxzy' to Fluxzy.Tests

This update includes the addition of 'with-request-payload.fxzy' to the Fluxzy.Tests project. The file has been marked to preserve the newest copy when it is output.

* Remove LegacyPcapWriter class

The LegacyPcapWriter class was removed from the Fluxzy.Core.Pcap project. This was a deprecated class handling specific pcap writing activities, which are now handled by more efficient or updated components within the system. This aims to improve the overall efficiency and maintainability of the code.

* Add NSubstitute package to Fluxzy.Tests.csproj
.

* Refactor ResponseSuggestedExtension method in HeaderUtility class

The ResponseSuggestedExtension method in HeaderUtility.cs file was refactored to avoid redundant code and promote reusability. The response type check was replaced with a call to a new method that performs the same task, reducing code length and improving readability.

* Fix bad GetHashCode that prevents equality
.

* Add HeaderUtility unit tests

This commit introduces unit tests for the HeaderUtility class in the Fluxzy.Tests project. These tests utilize example content types and validate returns for the following methods: GetRequestSuggestedExtension, GetResponseSuggestedExtension, and GetSimplifiedContentType.

* Add equality tests for various classes

This commit introduces specific equality tests for `Authority`, `FluxzyEndPoint`, `ProxyBindPoint`, `SystemProxySetting` and `Tag` classes. These tests utilize a base testing class `EqualityTesterBase` which provides a standard test structure and enforces equality and non-equality checks for each class.

* Update codecov.yml to ignore debugging code

In the updated configuration for Codecov, debugging related files under "src/Fluxzy.Core/Clients" and "src/Fluxzy.Core/Misc/Streams" directories are added to be ignored. This means these files are no longer considered in code coverage statistics.

* Add ArchiveReader unit tests

This commit introduces unit tests for ArchiveReader in the Fluxzy.Tests project. Each test thoroughly inspects different aspects of the ArchiveReader's functionality and assures that all components are properly working. Separate tests have been also created for FluxzyArchiveReader and DirectoryArchiveReader.

* Add additional assertions in EqualityTesterBase unit tests

These changes refine the unit tests by adding more assertions for equality and inequality in the EqualityTesterBase class. This includes checks for object equivalence and verifies that a string labeled "notEqual" is also recognized as not equal.

* Add ClientErrorEquality unit test
.

* Remove BOM

* Add ImportEngineProvider unit tests

A new ImportEngineProvider unit test file has been added to improve the code coverage. Changes also include minor adjustments in the Fluxzy.Tests.csproj and ImportEngineProvider.cs files, such as copy-to-output directory options and coding style.

* Add unit tests for Agent and AuthorityInfo equality

This commit introduces two new unit tests. These tests are for the equality operators of the Agent and AuthorityInfo classes. They ensure that instances of these classes are properly evaluated for their equivalence or lack thereof.

* Increase timeouts in proxy and OS detection

The timeout in AddHocConfigurableProxy has been increased from 20 to 40 to allow for more flexibility. Timeout for OS detection under OSX platform has also been extended from 40 to 60, allowing more time for slower systems and preventing premature termination.

---------

Co-authored-by: fluxzy-ci <admin@fluxzy.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ci Related to testing and CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant