Visual Studio Unit Test Not Getting Executed

Mahesh Amarelia's Avatar

Mahesh Amarelia

06 May, 2020 01:20 PM

Hi,
I have my project and trying to execute Visual Studio Unit Tests written for my C++ project. It's in Visual Studio 2015.
When I see Test tab, I didn't see anything getting executed.
Please see the attached file for Test settings I have done. I want to execute all test library with all tests so I have choose All.
Is there any configuration missing?

Regards,
Mahesh

  1. Support Staff 1 Posted by Feodor Fitsner on 06 May, 2020 11:31 PM

    Feodor Fitsner's Avatar

    Hi Mahesh,

    AppVeyor's automatic tests discovery works only for managed .NET Framework/Core assemblies, but not for C++ binaries.

    You have to provide your own testing command for C++ tests.

  2. 2 Posted by Mahesh Amarelia on 07 May, 2020 04:31 AM

    Mahesh Amarelia's Avatar

    Thanks Feodor for your quick reply.

    Just a point to mention. Mine is C++ DLLs created in VS 2015. Want to integrate the VS Unit Test Dll that I have created to do unit testing for my DLLs.

    As you mentioned, we have to provide our own testing commands. What exactly I have to configure, can you please point me to some example or proper documentation if you can?

    So that I can read and try.

    Regards,
    Mahesh Amarelia

  3. 3 Posted by Mahesh Amarelia on 07 May, 2020 09:06 AM

    Mahesh Amarelia's Avatar

    Hello Sir,
    I figured out that I'll have to run it through command line. So in Test tab I selected Cmd
    and given below two commands, but none is working. It give me the error saying

    "Error: The test source file "Util_UT.dll" provided was not found.
    Command exited with code 1"

    "Error: The test source file "**\Util_UT.dll" provided was not found.
    Command exited with code 1"

  4. Support Staff 4 Posted by Feodor Fitsner on 07 May, 2020 04:34 PM

    Feodor Fitsner's Avatar

    I can't see your sources/log, but looking at error I guess the path to Util_UT.dll is wrong. It must be an absolute or relative path, something like your-project\bin\debug\Util_UT.dll.

  5. 5 Posted by Mahesh Amarelia on 08 May, 2020 09:39 AM

    Mahesh Amarelia's Avatar

    Hi, Thanks lost for same.
    I tried with absolute path and it worked. Now it shows 1 test passed in Test tab.

    Here is the Link for console log : https://ci.appveyor.com/project/Zimbra/zm-windows-comp-0j432/builds/32713304

    Just one question. As of now I have given below path in my Test Script Cmd
    vstest.console /logger:Appveyor C:\projects\zm-windows-comp-0j432\ZimbraMAPI\x64\rtl\Util_UT.dll /Platform:x64 and it worked.

    To make it somewhat relative, I gave below path with Environment variable. I have provided value of Environment-> Environments Variables as below
    ZCOMTSOURCEPATH = C:\projects\zm-windows-comp-0j432

    Now when I provide my assembly path as in below. It's not working.
    vstest.console /logger:Appveyor $(ZCOMTSOURCEPATH)\ZimbraMAPI\x64\rtl\Util_UT.dll /Platform:x64

    Que 1: Any help or idea how can I provide relative path.
    Que 2: I have more than 10 assemblies, so is there a way to do that? Or i'll have to provide all test assemblies here with path.

  6. Support Staff 6 Posted by Feodor Fitsner on 09 May, 2020 12:03 AM

    Feodor Fitsner's Avatar

    You can try this with relative path:

    vstest.console /logger:Appveyor ZimbraMAPI\x64\rtl\Util_UT.dll /Platform:x64
    

    or this if above doesn't work:

    vstest.console /logger:Appveyor %APPVEYOR_BUILD_FOLDER%\ZimbraMAPI\x64\rtl\Util_UT.dll /Platform:x64
    

    APPVEYOR_BUILD_FOLDER is built-in variable, so you don't have to define your own. More about variables here: https://www.appveyor.com/docs/environment-variables/

  7. 7 Posted by Mahesh Amarelia on 13 May, 2020 06:44 AM

    Mahesh Amarelia's Avatar

    Hi Feodor,
    Thanks a lot for your reply. And sorry for late response.
    It worked as you mentioned.
    Will close this thread.
    Once again Thanks.
    Mahesh

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • 1.jpg 77.6 KB
  • 2.jpg 33.9 KB
  • 3.jpg 76.2 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? 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