Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to setup on VSCode #26

Open
MohammedUbaid-eaton opened this issue Dec 23, 2021 · 14 comments
Open

How to setup on VSCode #26

MohammedUbaid-eaton opened this issue Dec 23, 2021 · 14 comments

Comments

@MohammedUbaid-eaton
Copy link

Hi,

I installed CppUTest on vscode & also installed dependency Test UI Explorer

image

I do not understand how to get started.

I have a .cpp file on which i need to run unit tests,

Kindly guide.

@bneumann
Copy link
Owner

Hi,
you first need to set up the paths in the settings as described here: https://github.com/bneumann/CppUTest-Test-Adapter#setup

After you set the test executable path the plugin will automatically detect the tests inside it and show the in the test explorer

@steverb1
Copy link

steverb1 commented Apr 11, 2024

I'm not clear what is meant by "test executable". What kind of file would that be? (.exe or something else?). Is this a file CppUTest provides? I'm on a Mac, just trying to run the tests from James Grenning's book. I can run them from the command line, but see no tests in VS Code.

@bneumann
Copy link
Owner

Well if you compile your test code you should get an executable (i guess the one you are running?). That is your test executable. If you set it in the paths of this extension it should be used to identify your tests.

@steverb1
Copy link

OK, thanks, I found the executable, and have settings.json correctly configured now. Still no tests showing up in the Test Explorer. Any ideas about what else might be wrong?

@bneumann bneumann reopened this Apr 14, 2024
@bneumann
Copy link
Owner

You are completely right, I just tried it again (after years to be honest) and it didn't work. I will look into it

@bneumann
Copy link
Owner

Okay I found the culprit and will release a new version today evening. Funny enough I think not a lot people are using this extension because you could actually add multiple files likes so
"cpputestTestAdapter.testExecutable": "test1.exe;test2.exe"
but not like this
"cpputestTestAdapter.testExecutable": "test1.exe"
I never wrote tests (shame on me) for the settings parser, so one of the last PRs got through breaking the default behaviour.
Thanks for adressing this issue

@steverb1
Copy link

Thank you very much for finding the problem! Looking forward to the fix in the new version.

@bneumann
Copy link
Owner

No problem, i am a bit short on time recently (like in the past 2 years I guess). So it always takes some time to get things done. I just uploaded the latest version 1.3.1. Let me know if it works now

@steverb1
Copy link

OK, that is definitely an improvement. I'm seeing things in the test explorer for the first time. However, I'm now getting an ERROR_LOADING_TESTS

Here is what I have in settings.json:
"cpputestTestAdapter.testExecutable": "${workspaceFolder}/t0/t0_tests",
"cpputestTestAdapter.testExecutablePath": "${workspaceFolder}/t0"

@steverb1
Copy link

Screenshot 2024-04-17 at 09 50 19

@steverb1
Copy link

That double quote character at the end looks suspicious. Would that still be something going on with the parser?

@bneumann
Copy link
Owner

That is odd, this text is loaded from the executable name itself. it worked with my local test executable file. Is the log showing anything helpful? I will check the commits if i fat fingered something in the code :)

@steverb1
Copy link

Any update on this? And sorry, I just noticed you aksed if the log is showing anything. Where would I find that?

@msoleck
Copy link

msoleck commented Jul 2, 2024

I have similar problems with this issue.

Here is the software I am running:

  • OS: Windows 11
  • VS Code: 1.90.2
  • CppUTest Test Adapter: 1.3.4

I previously had the ERROR LOADING TESTS error, but I resolved that by pointing to the correct executable.

I now get this other weird message:
image

I get a similar "error" message when i run it from the terminal
image

Here is the result in the output window
image

When I run the executable without the parameters, here is the output:
image

My belief is that the tool tries to run the executable with some parameters.

My question is: does the this tool add some parameters which I am not aware?

Thank you for any help you can provide

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

No branches or pull requests

4 participants