Skip to content

Adds/updates the Enhanced Test Report tool that generates an HTML report from test results (TRX) and optional code coverage (Cobertura). The report provides a single view of test outcomes and coverage for the Contentstack Management .NET SDK.#137

Draft
OMpawar-21 wants to merge 10 commits intodevelopmentfrom
enhc/DX-3908
Draft

Adds/updates the Enhanced Test Report tool that generates an HTML report from test results (TRX) and optional code coverage (Cobertura). The report provides a single view of test outcomes and coverage for the Contentstack Management .NET SDK.#137
OMpawar-21 wants to merge 10 commits intodevelopmentfrom
enhc/DX-3908

Conversation

@OMpawar-21
Copy link

Summary

Adds/updates the Enhanced Test Report tool that generates an HTML report from test results (TRX) and optional code coverage (Cobertura). The report provides a single view of test outcomes and coverage for the Contentstack Management .NET SDK.

What the report includes

Test results

  • Summary: Total, Passed, Failed, Skipped, and total duration.
  • Test groups: Tests grouped by test class (or assembly), with expandable sections.
  • Per-test details (when expanded):
    • Assertions (pass/fail, expected vs actual).
    • HTTP requests (SDK method, method, URL, query params, headers, body, cURL copy).
    • HTTP responses (status, response time, headers, body, payload size).
    • Error details (message, exception type, stack trace) for failed tests.
    • Test context (environment, SDK version, build number, commit SHA, test data source, custom keys).

Code coverage (optional)

When Cobertura XML is provided:

  • All files summary: Overall percentages for Statements, Branches, Functions, and Lines.
  • Per-file coverage: Table with file name, statement/branch/function/line percentages, and uncovered line numbers.

Usage

Option Description
--trx <path> Path to a TRX file (can be repeated).
--trx-dir <dir> Directory to search for *.trx files (recursive).
--cobertura <path> Path to a Cobertura XML file (can be repeated).
--cobertura-dir <dir> Directory to search for coverage.cobertura.xml (recursive).
--output <path> Output HTML path (default: EnhancedTestReport.html).
--help, -h Show usage.

Examples

Test results only

EnhancedTestReport --trx-dir ./TestResults --output report.html

Test results + code coverage

EnhancedTestReport --trx-dir ./TestResults --cobertura-dir ./TestResults --output report.html

…BulkUnpublishService.cs.

Description
In BulkUnpublishService.cs, two comment-only lines were added to document an alternative way of sending the bulk unpublish options:
skip_workflow_stage_check – A commented call AddQueryResource("skip_workflow_stage_check", "true") was added next to the existing Headers["skip_workflow_stage_check"] = "true" assignment.
approvals – A commented call AddQueryResource("approvals", "true") was added next to the existing Headers["approvals"] = "true" assignment.
…add integration tests

- Bulk publish/unpublish: send skip_workflow_stage_check and approvals as query
  params via AddQueryResource instead of headers (BulkPublishService; BulkUnpublishService
  already used query params).
- Unit tests: in BulkPublishServiceTest, BulkUnpublishServiceTest, and
  BulkOperationServicesTest, assert on QueryResources instead of Headers for
  these two flags.
- Integration tests: add EnsureBulkTestContentTypeAndEntriesAsync() so
  bulk_test_content_type and at least one entry exist; add Test003a (bulk
  publish with skipWorkflowStage and approvals) and Test004a (bulk unpublish
  with same flags).
…ndling

Integration tests (Contentstack015_BulkOperationTest):

- API version 3.2:
  - Test003b: bulk publish with skipWorkflowStage, approvals, and apiVersion "3.2" (api_version header).
  - Test004b: bulk unpublish with skipWorkflowStage, approvals, and apiVersion "3.2" (api_version header).

- Error handling and assertions:

  - Add FailWithError(operation, ex) to report HTTP status, ErrorCode, and API message on ContentstackErrorException.

  - In Test003a, Test004a, Test003b, Test004b: assert response.StatusCode == HttpStatusCode.OK and use FailWithError in catch.

  - Add Test004c: negative test for bulk unpublish with invalid data (empty entries, non-existent env); expect ContentstackErrorException and assert non-success status and presence of error message.

- Usings: System.Net (HttpStatusCode), Contentstack.Management.Core.Exceptions (ContentstackErrorException).
…3a/004a/003b/004b), and 422/141 handling with console output.

Ensure environment (find/create bulk_test_env) and workflow “oggy” (find/create with branches/stages) in ClassInitialize; add Test000c for environment; update Test000a/000b with find-or-create and Branches; Test002 creates five entries and assigns workflow stages; Test003a/004a/003b/004b use bulkTestEnvironmentUid, PublishWithReference, and skipWorkflowStage/approvals (003b/004b with api_version 3.2); treat 422 ErrorCode 141 as expected and log full message to console; fix UnPublish → Unpublish.
…ulk_UnPublish_With_SkipWorkflowStage_And_Approvals

Added Proper Assertion and Status Code Mapping
…play

- Group tests by source file/class: parse TRX TestDefinitions for className,
  add ByClass grouping, and render sections as e.g. Contentstack001_LoginTest.cs
  with tests listed under each. Fall back to ByAssembly when no class info.

- Show "All files" code coverage at top: move the overall coverage block
  (Statements, Branches, Functions, Lines) to appear right after the test
  summary so it’s visible without scrolling. Code coverage section below
  contains only the per-file table.

- Improve code coverage UI: dedicated All files card with clear labels,
  per-file table with caption and improved spacing, and color cues for
  low/mid coverage (red/yellow). Table shows File, Statements, Branches,
  Functions, Lines, and Uncovered line #s in a clear layout.

- Render request/response headers in a single block: display headers as
  "name: value" lines in a <pre> block when tests supply header data,
  for a consistent, readable format.
…t Report

- Remove SDK comparison section (.NET vs JS CMA) and all support for it:
  --js-api option, LoadJsApi(), AppendSdkComparisonSection(), JsApiEntry.

- Remove method-wise test coverage section and all support for it:
  --api-surface option, LoadApiSurface(), BuildMethodToTestsMap(),
  SdkMethodToNormalizedKey(), AppendMethodCoverageSection(), ApiSurfaceEntry.

- Report now includes only:
  - Test results summary (Total, Passed, Failed, Skipped, Duration)
  - Test groups by class/assembly with expandable cases (assertions,
    HTTP requests/responses, errors, context)
  - Code coverage when Cobertura XML is provided (--cobertura /
    --cobertura-dir): "All files" summary and per-file coverage table.

- Help text updated to drop api-surface and js-api; cobertura options
  retained for code coverage.
@OMpawar-21 OMpawar-21 requested a review from a team as a code owner March 6, 2026 07:34
@OMpawar-21 OMpawar-21 marked this pull request as draft March 6, 2026 11:17
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.

1 participant