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

perf(go): improve go core library test validators to improve test validation #79

Merged
merged 8 commits into from
Apr 4, 2024

Conversation

haseeb-mhr
Copy link
Collaborator

@haseeb-mhr haseeb-mhr commented Apr 3, 2024

What

  1. Added handling for form/Query Multipart parameters.
  2. Now, the following body matcher will match response bytes instead of data object matching. These functions mainly cause the failure of test cases due to issues such as extra bytes being ignored when bytes are converted into objects, leading to failure during response matching:
    A. RawBodyMatcher
    B. KeysBodyMatcher
    C. KeysAndValuesBodyMatcher

Why

During the implementation of handling Datetime Format cases in the OAF implementation, I identified a loophole in the test validation process of go core library.
This issue affects the accuracy and reliability of the tests generated for the Go SDKs, potentially leading to incorrect validation of Go SDKs tests. It is crucial to address this issue promptly to ensure the correctness of the generated tests and the overall functionality of the Go SDKs.

Type of change

Select multiple if applicable.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause a breaking change)
  • Tests (adds or updates tests)
  • Documentation (adds or updates documentation)
  • Refactor (style improvements, performance improvements, code refactoring)
  • Revert (reverts a commit)
  • CI/Build (adds or updates a script, change in external dependencies)

Dependency Change

Existing dependencies are removed.

Breaking change

No breaking change were introduced.

Testing

Existing tests are updated to test the updated implementation.

Checklist

  • My code follows the coding conventions
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added new unit tests

@haseeb-mhr haseeb-mhr added enhancement New feature or request priority-high refactoring code enhancements labels Apr 3, 2024
@haseeb-mhr haseeb-mhr self-assigned this Apr 3, 2024
@haseeb-mhr haseeb-mhr linked an issue Apr 3, 2024 that may be closed by this pull request
Copy link
Contributor

@mrafnadeem-apimatic mrafnadeem-apimatic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please review the comments.

General Comments:

  • How was this tested?
  • I appreciate the small size of the commits
  • Does byte matching accurately reflect the kind of testing we want to do? It's good for contract testing but are we not going to test unmarshalling and marshalling? What about models?
  • Could we have solved some of these issues by changing api-tester?

https/callBuilder.go Show resolved Hide resolved
https/callBuilder.go Show resolved Hide resolved
https/formData.go Show resolved Hide resolved
testHelper/bodyMatchers.go Outdated Show resolved Hide resolved
testHelper/bodyMatchers.go Show resolved Hide resolved
testHelper/bodyMatchers.go Show resolved Hide resolved
@haseeb-mhr haseeb-mhr requested review from mrafnadeem-apimatic and removed request for asadali214 April 4, 2024 10:07
@usamabintariq usamabintariq added the bug Something isn't working label Apr 4, 2024
Copy link

sonarcloud bot commented Apr 4, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Contributor

@mrafnadeem-apimatic mrafnadeem-apimatic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@haseeb-mhr haseeb-mhr merged commit 23fbdad into main Apr 4, 2024
2 checks passed
@mrafnadeem-apimatic mrafnadeem-apimatic deleted the 50-improve-test-coverage-and-maintainability-grade branch April 4, 2024 12:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request priority-high refactoring code enhancements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants