Skip to content

Improve test coverage from 23% to 82%#10

Open
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1778007414-improve-test-coverage
Open

Improve test coverage from 23% to 82%#10
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1778007414-improve-test-coverage

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented May 5, 2026

Copy link
Copy Markdown

Summary

Improved test coverage for the RestSharp library from 23.07% baseline to 82.23% line coverage, exceeding the 80% threshold.

Changes

  • RestSharp.Net7/: New SDK-style project (.NET 7) that references original RestSharp sources, with InternalsVisibleTo to expose internal OAuth classes for testing
  • RestSharp.Tests.Coverage/: New xUnit test project with 677 passing tests across 25 test files

Coverage Results

Metric Before After
Line 23.07% 82.23%
Branch 28.38% 74.89%
Method 18.93% 92.77%

Test Files

  • Core: RestRequestTests, RestClientTests, RestClientAdditionalTests, RestClientExecuteTests, RestResponseTests
  • HTTP: HttpTests, HttpSyncTests, HttpResponseTests, HttpCookieTests
  • Auth: AuthenticatorTests (Basic, Simple, OAuth2, NTLM), OAuth1AuthenticatorTests, OAuthTests, OAuthInternalTests
  • Serialization: JsonSerializerTests, DotNetXmlTests, XmlAttributeDeserializerTests, XmlSerializerEdgeTests
  • Extensions: StringExtensionsTests, MiscExtensionsTests, ReflectionExtensionsTests
  • Other: ValidationTests, ParameterTests, FileParameterTests, FactoryAndEnumTests, AttributeAndContribTests, HttpUtilityTests, WebPairCollectionTests, CoverageBoostTests

Review & Testing Checklist for Human

  • Run dotnet test in RestSharp.Tests.Coverage to verify all 677 tests pass
  • Run coverage report to verify ≥80% line coverage: dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=cobertura /p:Include="[RestSharp]*"
  • Spot-check a few test files to confirm tests are meaningful and not just exercising trivial paths

Notes

  • The RestSharp.Net7 project references original source files via <Compile Include> wildcards rather than copying/modifying them
  • Only modification to library code was adding InternalsVisibleTo attribute to enable testing of internal OAuth infrastructure classes
  • Tests for HTTP execution methods use localhost:1 to trigger connection errors, exercising the error-handling code paths without needing a live server

Link to Devin session: https://app.devin.ai/sessions/7ebfa491af43427696d9415e079e06c6
Requested by: @bnob-git


Devin Review

Status Commit
⚪ Not started

Run Devin Review

💡 Connect your GitHub account to enable automatic code reviews.

Open in Devin Review (Staging)

- Created RestSharp.Net7 SDK-style project referencing original sources
- Created RestSharp.Tests.Coverage test project with 677 passing tests
- Added InternalsVisibleTo to expose internal OAuth classes for testing
- Coverage: 82.23% line, 74.89% branch, 92.77% method

Test files added:
- RestRequestTests, RestClientTests, RestResponseTests
- AuthenticatorTests (Basic, Simple, OAuth2, NTLM, OAuth1)
- OAuthInternalTests (OAuthTools, WebPair*, OAuthWorkflow, etc.)
- HttpSyncTests, HttpTests, HttpResponseTests, HttpCookieTests
- XmlAttributeDeserializerTests, XmlSerializerEdgeTests
- DotNetXmlTests, JsonSerializerTests
- StringExtensionsTests, MiscExtensionsTests, ReflectionExtensionsTests
- ValidationTests, ParameterTests, FileParameterTests
- FactoryAndEnumTests, AttributeAndContribTests
- HttpUtilityTests, WebPairCollectionTests
- RestClientAdditionalTests, RestClientExecuteTests
- CoverageBoostTests

Co-Authored-By: Bobby Nobakht <bobby.nobakht@cognition.ai>
@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants