Comments (25)
Linux script? Mac script? (I know.. I meant the os specific programs) Windows script?
You see, I could give a not so general solution. Instead this everybody can write their own wrapper scripts. More effective to generate those scripts. For example: in case of cmake check add_custom_command
I guess I should write an example. Thumbs up if you would read it.
from vscode-catch2-test-adapter.
Getting the environment variables from the custom program would be problematic though.
It is not impossible, but the whole concept is more "inheritance" like.
Please read my comments on this issue, also : https://en.wikipedia.org/wiki/Environment_variable
My conclusion: running a custom task won't be able to set the environment variables of the test executable --> Generate a wrapper.
from vscode-catch2-test-adapter.
Users are usually creating a .bat/.sh wrapper for their executables.
If you are using a decent build tool, you can do it easily. For example in case of cmake: see. (edited)
My problem is that what kind of command are you thinking about? Linux, mac, windows? all?
You see hard to give a general solution. What I think I could do to call a vscode task but you might get the same result configuring a task with
"runOptions": {
"runOn": "folderOpen"
},
Here is what I am using for similar purpose:
"tasks": [
{
"label": "createTmpWorkingFolder",
"type": "shell",
"command": "mkdir -p out/tmp/workspaceFolder",
"windows": { "command": "mkdir out\\tmp\\workspaceFolder" }
},
{
"type": "npm",
"script": "watch",
"problemMatcher": "$tsc-watch",
"isBackground": true,
"presentation": {
"reveal": "never"
},
"group": {
"kind": "build",
"isDefault": true
},
"runOptions": {
"runOn": "folderOpen"
},
"dependsOn": ["createTmpWorkingFolder"]
}
]
Note:
- second task
dependsOn
first task - first task executes a different command on windows
See vscode task documentation for further details
from vscode-catch2-test-adapter.
Yes we also have a activation-script. For my other tasks I run that script before running e.g. the build command. But I don't have tasks for running/scanning the tests.
My opinion is, that before running Mytest.exe another command should be called. In my case activate.bat from conan. Like a prerun command
from vscode-catch2-test-adapter.
like catch2TestExplorer.dependsOnTask
: <taskname>
where is a task defined in tasks.json.
That would be a nice solution don't you think?
from vscode-catch2-test-adapter.
Yes, that would be great!
from vscode-catch2-test-adapter.
You have to run it always before you run your exec, right?
What does actually do?
When do you have to rerun it?
Example: there is exec1 and exec2.
Test runs in batches, so is it ok to run the task and then run exec1 and then exec2?
from vscode-catch2-test-adapter.
It's only necessary once after opening the batches. So opening a batch, run the command once and afterwards run all tests would be fine.
The script basically modifies the PATH variable and adds the necessary toolchain-folders temporarily
from vscode-catch2-test-adapter.
What is a batch? Not fully understand. Consecutive runs don't need to rerun the task?
FYI, you can modify the PATH environment variables.
with env: "env": { "PATH": "${os_env:PATH};<custom-path>" }
See details.
from vscode-catch2-test-adapter.
Ah, I think I misunderstood "batch", I thought of a command bash.
What we do on windows is:
- Open cmd
- Call activate script
- Run-Unit tests
I've seen the "env" option, but as the paths are changing, I cannot set a static value in the env-option
from vscode-catch2-test-adapter.
Ah, in this case I think the catch2TestExplorer.dependsOnTask
proposal wouldn't solve your problem.
Env modification is only available in the current process and it's children.
what you can do:
- write a startvscode.bat like:
init.bat
code sourcefolder
or
- generate executable wrappers as I mentioned previously.
I could develop this feature, but it wouldn't work for your scenario anyway.
from vscode-catch2-test-adapter.
Upvoting this issue. There is a need to source some dynamic environment variables, which cannot be done with "env": { ... }
. So the ability to run a custom command before the executables run would be great!)
from vscode-catch2-test-adapter.
But wouldn‘t it be possible to run the test in a shell with:
- Open Shell
- Run custom script
- Run test
- Parse output
from vscode-catch2-test-adapter.
Why this issue is closed? I couldn't find a solution to rebuild project before testing
from vscode-catch2-test-adapter.
And you won't @xahon,
This extension support the other way around. You rebuild your project and the extension detects the change and runs your 'changed' executables if autorun is set:
Anyway this issue is about running some custom command before the test.
from vscode-catch2-test-adapter.
Hey @dkuschmierz and @friendnick ,
I created a cmake wrapper generator example.
You can check it here.
from vscode-catch2-test-adapter.
Now I understand what you ment. Works perfectly, thanks a lot!
from vscode-catch2-test-adapter.
Happy to hear that.
Also, don't forget to replace catch2TestExplorer.executables
pattern to a stricter one like "{build,Build,BUILD,out,Out,OUT}/**/*.test-wrapper*"
because we don't want to match the executables just the wrappers.
from vscode-catch2-test-adapter.
Hi @matepek
any idea how to set up the debug configuration with this wrapper?
from vscode-catch2-test-adapter.
Hello @dkuschmierz ,
I'm afraid one cannot use debug feature with a wrapper.
But.. there is another way to get the environment variables and just a slightly advanced. You can check the example here.
from vscode-catch2-test-adapter.
Hello @dkuschmierz ,
Just wondering that this second example was clear enough and solved your problem or not. ?
from vscode-catch2-test-adapter.
Hello there will be a dependsOnTask
under testMate.test.advancedExecutables
in the next version (3.0.4)
With that one can run custom vscode command before the tests are run.
BUT it won't solve the environment variable issue: Additional variables under the execution of the task wont be propagated to the test executable.
from vscode-catch2-test-adapter.
I decided adding a new feature under testMate.advancedExecutables
called envFile
.
I think this is interesting for everyone who is reading this issue.
Check here
"testMate.test.advancedExecutables": [{
"pattern": "<default pattern>",
"envFile": "out/env.json",
"dependsOn": "out/env.json"
}]
from vscode-catch2-test-adapter.
Added advancedExecutables.executionWrapper
mostly for emulators.
from vscode-catch2-test-adapter.
kalie dificuldade waffa
from vscode-catch2-test-adapter.
Related Issues (20)
- Does your test exectuable depend on some dynamic library? What if they do? HOT 2
- advancedExecutables doesnt seem to support symlinked executables HOT 4
- Add `ctest` parsing HOT 2
- gtest binary not find, build with bazel, maybe not support with softlink dir HOT 1
- 'Unexpected error from debug' when debugging googletest test case using 'Native Debug' extension HOT 1
- Allow running tests as a temporary executable HOT 2
- Add access to gdb command to modify arguments HOT 4
- Require build success before allowing a test to run HOT 2
- Status bar name is just "Extension status", and not ex. "TestMate C++". This makes it hard to find it if you want to hide the status. HOT 1
- Documentation does not mention case-sensitivity for file search globs HOT 1
- executionWrapper not working as expected HOT 7
- Filter tests by tags HOT 1
- Simplify finding test executables (remove advancedExecutables) HOT 1
- Improve performance by allowing "Files: exclude" rules when collecting test binaries HOT 11
- Add custom file extension pre-filter HOT 2
- The ambiguous explanation of the test.parallelExecutionLimit and the test.parallelExecutionOfExecutableLimit HOT 5
- Bazel, Runfiles, and C++ TestMate - how to use properly? HOT 11
- runTask always reporting "Task not found" HOT 2
- Parallel execution requires per-instance unique identifiers HOT 5
- fail to loading testing binary HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-catch2-test-adapter.