Run unit test form a diferrent project under the same solution (C#)

Devian Apps's Avatar

Devian Apps

25 Apr, 2019 04:46 PM

Hi all,

I have a project that as two differents project, one project for my business logic and application and another one for unit tests (Nunit).

I'm struggling to handle put the unit test running, I tried almost everything but I'm not able to run the tests after the build.

This is my last .yml file with my current configurations.

Can someone please help me?

version: 1.0.{build}
image: Visual Studio 2019 Preview
- cmd: nuget restore
    - '**\*.tests.dll'
- cmd: nunit3-console **\*.tests.dll --result=myresults.xml;format=AppVeyor

  1. 1 Posted by Devian Apps on 25 Apr, 2019 04:56 PM

    Devian Apps's Avatar

    For mor info, after the build it's always saying this:

    Test Files
    System.ArgumentException: Illegal characters in path.
       at System.Security.Permissions.FileIOPermission.EmulateFileIOPermissionChecks(String fullPath)
       at System.Security.Permissions.FileIOPermission.QuickDemand(FileIOPermissionAccess access, String fullPath, Boolean checkForDuplicates, Boolean needFullPath)
       at NUnit.Engine.TestPackage..ctor(String filePath)
       at NUnit.Engine.TestPackage..ctor(IList`1 testFiles)
       at NUnit.ConsoleRunner.ConsoleRunner.MakeTestPackage(ConsoleOptions options)
       at NUnit.ConsoleRunner.ConsoleRunner.Execute()
       at NUnit.ConsoleRunner.Program.Main(String[] args)
    Command exited with code -100

  2. 2 Posted by Owen McDonnell on 25 Apr, 2019 08:38 PM

    Owen McDonnell's Avatar

    Nunit cli does not support wild cards (

    Why not use auto test discovery as you already have in test.assemblies: field?

  3. 3 Posted by Devian Apps on 25 Apr, 2019 11:26 PM

    Devian Apps's Avatar

    Sorry for my lack of knowledge on this subject, but how can I do it?
    I was searching but I didn't find anything to do auto find test :(

    Doing this doesn't run my unit tests

        - '**\*.tests.dll'

    I need to put another more flag?

  4. 4 Posted by Owen McDonnell on 26 Apr, 2019 02:24 PM

    Owen McDonnell's Avatar

    Ok what happens if you keep the original nunit3-console command but list each file you want to test?

  5. 5 Posted by Devian Apps on 26 Apr, 2019 02:30 PM

    Devian Apps's Avatar

    Do you have an example hot to define a given folder for a specific dll? I tried this too but I think that I was specified wrongly the path and nunit console doesn't search any test.
    Then I just specified the csproj but doing this some exception was raised.

  6. 6 Posted by Owen McDonnell on 26 Apr, 2019 04:57 PM

    Owen McDonnell's Avatar
  7. 7 Posted by Devian Apps on 27 Apr, 2019 11:40 AM

    Devian Apps's Avatar

    Thanks for the example, now my UT is running fine ;)
    You can close this ticket.

  8. Ilya Finkelshteyn closed this discussion on 28 Apr, 2019 03:07 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac