Skip to content

Fix test failure due to invalid argument in dotnet test step #28

@Hemavathi15sg

Description

@Hemavathi15sg

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions