Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 18, 2025

The CI build step compiled the solution but excluded the test project, causing dotnet test --no-build to fail with "invalid argument" when the DLL didn't exist.

Changes

  • Added CourseRegistration.Tests.csproj to CourseRegistration.sln with full build configuration for all platforms (Debug/Release, Any CPU/x64/x86)

The test project exists with proper dependencies (xUnit, Microsoft.NET.Test.Sdk) but was simply missing from the solution file.

Original prompt

This section details on the original issue you should resolve

<issue_title>Fix test failure due to invalid argument in dotnet test step</issue_title>
<issue_description>Summary:

The build pipeline is failing at the test stage with the following error:

The argument /home/runner/work/CourseApplication/CourseApplication/api/CourseRegistration.Tests/bin/Release/net8.0/CourseRegistration.Tests.dll is invalid. Please use the /help option to check the list of valid arguments.

Details:

  • The failing command is: dotnet test ${{ env.TEST_PROJECT }} --configuration Release --no-build --logger trx
  • There are warnings about converting null literals to non-nullable reference types, but they are not fatal.
  • The core problem is that the test runner is being passed a DLL path directly. This occurs if you use dotnet vstest instead of dotnet test, but the workflow uses dotnet test.
  • This error can also appear if no test framework/adapters are present or if the project is misconfigured.

Suggested Solution:

  1. Verify that api/CourseRegistration.Tests/CourseRegistration.Tests.csproj includes Microsoft.NET.Test.Sdk, a test framework such as xunit or nunit, and a compatible test runner in its dependencies.
  2. Make sure the test project targets net8.0 to match your workflow's .NET version.
  3. Ensure there are actual tests in the project and that they use the correct attributes (e.g., [Fact] for xUnit).
  4. Run dotnet test locally to confirm the issue and get further diagnostic output.
  5. Adjust the workflow or test project as needed so dotnet test can discover and execute tests without errors.

References:

  • Related warnings: CS8625 (nullable reference type)
  • Workflow file: .github/workflows/ci-cd.yml
  • Failing step and logs reference: Build, Test, and Deploy Course Registration API @ ed9c8f5

Labels:

  • bug
  • test
  • ci

</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.

Co-authored-by: Hemavathi15sg <224925058+Hemavathi15sg@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix test failure due to invalid argument in dotnet test step Add CourseRegistration.Tests to solution file Dec 18, 2025
Copilot AI requested a review from Hemavathi15sg December 18, 2025 05:28
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.

Fix test failure due to invalid argument in dotnet test step

1 participant