Why TestController.createRunProfile does not make the command 'Debug Test' in the context menu in Test Explorer in VS Code - vscode-extensions

I am currently working on a project using the Test Explorer in Visual Studio Code and I am having trouble with the context menu.
By default, the context menu displays
If I create a Run profile:
this._runProfile = this._testController.createRunProfile('Run', vscode.TestRunProfileKind.Run, this.runHandler, true);
and click on the command Run Test, then this.runHandler is executed.
However, when I create a Debug profile:
this._debugProfile = this._testController.createRunProfile('Debug', vscode.TestRunProfileKind.Debug, this.debugHandler, true);
the command Debug Test is not showing up in the context menu.
I was expecting to see Debug Test in the context menu and have it execute this.debugHandler every time it is clicked.
Any help would be greatly appreciated. Thank you.
I tried to manually add a command to the package.json and register it with a different handler, but I am unsure if this is the right approach.

I found that it was an issue was in my development environment.
Everything was building, linking, but it only worked once and after that the command Debug Test didn't show up again. I thought it was a bug in the api, but it is not.
After doing everything again, it worked well.

Related

Can't navigate to Karma test file from Tests Run tab in IntelliJ Ultimate

I have an Angular project with Karma/Jasmine tests files. I configured my IntelliJ IDEA (2022.2.4 (Ultimate Edition)) to run Karma tests, which works mostly fine.
One thing that doesn't work is opening the Tests Run tab and navigating to the source for a test by clicking on the test name.
For example on the screenshot below, I expect that clicking on the test marked in red would open the corresponding project-menu-component.spec.ts file to the corresponding it(), but nothing actually happens when I click:
I have the following settings:
Jump to source doesn't work for specs with dynamically generated names. Related ticket: WEB-26625, please vote for it to get notified on updates

Unable to add External Tool to run Before Configuration Launch IntelliJ

Introduction
I've looked around and haven't seen anyone else having my issue.
Basically, I am wanting to run a start.bat file to start up my server before I start up my debugging session. I currently have my debugging inside of an IntelliJ Configuration and it works well. The problem is that in the options for my configuration I can't seem to add an "External Tools" task to the Before Launch section. I was able to add a maven task here previously. However, when I follow the following steps, the "start.bat" is not added.
First I go into Settings->Tools->External Tools to add my Spigot-Server tool which basically calls the start.bat file inside of a test-server directory.
Snippet of External Tools
Second, I go into my "Debug Spigot" configuration and at the bottom, I see a "Before Launch" Section.
Snippet of Spigot Debug options
I click on the + inside of that section to add a new task, and I click on "External Tools"
Snippet of adding External Tools Task
And then I make sure my Spigot-Server task is selected.
Snippet of select external tool
And then once I hit okay, the window closes but I don't see a new task added to the before launch section. It looks the same it did before I clicked on anything. I also don't see any status message at the bottom of IntelliJ
I basically expect the task "Spigot-Server" to show under the Before Launch section. This would basically start up the server and once the server was completely started, it would then launch the debugging configuration.
I think it may be an issue with IntelliJ's UI. I searched IntelliJ's issue tracker But couldn't find any that matched.
I'm wanting to know if there are any work arounds to get this setup in IntelliJ>
I was able to achieve my goal by doing some workarounds that I discovered with the help of CrazyCoder. I found this stackoverflow question that told me about the batch plugin.
I was able to create a Batch run configuration for a wrapper batch file that gets around the limitation CrazyCoder mentioned. He said that even if I did get my setup where my server runs before my debugging is launched, my debugging would never launch. This is because the terminal process needs to exit before the next task starts.
To get around this this is the wrapper batch file I created.
#echo OFF
START "Spigot-Server" /D C:\Users\rocke\Documents\Programming\Minecraft\Spigot\capture-the-carrot\test-server "start.bat"
ping -n 3 127.0.0.1 >nul
It basically uses the "START" command to run the task asynchronously and then waits 2 seconds. This is because all I need to do is wait for the start.bat command to run the very first part so that it establishes remote debugging. And then the wrapper ends after 2 seconds (the 3 represents the number of seconds I want to wait +1). And this allows the Debugging process to start while also ensuring that the server has setup remote debugging!
I'll just share screenshots of my configuration if anyone wants to do the same.
Maven Build Configuration
Spigot Server Start Configuration
Remote Debugging Configuration
The way this is setup is once I run the Remote Debugging Configuration, it has a "Before Launch" Task of Spigot Server. Spigot Server also has a "Before Launch" Task of Maven Build Project.
So my Maven Build Project runs, then my Spigot Server wrapper runs and after 2 seconds terminates, and then my Debugging Configuration runs!
If you have any questions regarding remote debugging with spigot, use this resource: https://www.spigotmc.org/wiki/intellij-debug-your-plugin/

Run as Groovy Script

After years of working fine, for the last few months I've not had the ability to Run As Groovy Script.
I can select it from the menu, but nothing happens.
Today I installed the latest Eclipse and plugin in an attempt to fix, but no luck.
What went wrong? Is there a log file to check?
https://dist.springsource.org/release/GRECLIPSE/3.8.0/e4.16
The output of the launch is written to the Console view. If there was a problem launching you can check the Error Log view for an entry. The launch configuration under Run > Run Configurations... > Groovy Script may also reveal classpath or other issues.

Debugging in OpenERP 7.0

How to do debug in OpenERP v7?
In previous versions of OpenERP, it was easy to debug. But in the latest version it's tough to debug.
To debug your OpenERP+python code in eclipse, start eclipse (helios/indigo only) in debug perspective and follow the given steps:
1: Stop your openERP running server by pressing "ctr+c".
2: In eclipse go to Menu "Run/Debug Configurations". In configuration window under "Python Run", create new debug configuration(Double click on 'Python Run').
3: After creating new debug configuration follow the given steps:
3.1: In "Main" tab under "Project", select the "server" project or folder (in which Openerp Server resides) from your workspace.
3.2: Write location of 'openerp-server' under "Main Module".
Ex: ${workspace_loc:server/openerp-server}.
3.3: In "Arguments" tab under "Program Arguments", click on button "Variables" and new window will appear.
3.4: Then create new "Variable" by clicking on "Edit Variables" button and new window will appear.
3.5: Press on "New" button and give your addons path as value.
Ex: --addons ../addons,../your_module_path
3.6: Press Ok in all the opened windows and then "Apply".
4: Now into "PyDev Package Explorer" view go to 6.1/server and right click on "openerp-server" file, Select 'Debug As --> Python Run'.
5: Now in "Console" you can see your server has been started.
6: Now open your .py file which you want to debug and set a break-point.
7: Now start your module's form from 'gtk' or 'web-client' and execution will stop when execution will reach to break-point.
8: Now enjoy by debugging your code by pressing "F5, F6, F7" and you can see value of your variables.
You can refer following link: Debug OpenERP Code from Eclipse
Go to Administrator(in right top corner) in that click on About OpenERP in that you will find a link Activate the Developer Mode.
or
you can add a parameterdebug in of URL like
http://localhost:8069/?debug
both the way will let you open the developer mode.
You can also use the Odoo Debug pro chrome extension to toggle the developer mode using the keyboard shortcuts.
To debug openERP 7 from eclipse just Stop openERP server and rename the main file named openerp-server.py.From "Run/Debug Configurations" make a new configuration selecting Project and main module such as ${workspace_loc:openerp7/src/openerp-server.py} then press Apply.After that /openerp7/src/openerp-server.py 'Debug As --> Python Run' using new configuration.Server is running where pydev debugger is also started.Now run 'gtk' or 'web-client'.Then select the python file of that module where want to debug and give breakpoints.That's all.
Debugging is quite simple in interface.
For Programmers
By Default when you login to openerp, your url will look something like this
http://localhost:7373/?db=Test_July_25#menu_id=107&action=97
Edit the url and add debug=&
localhost:7373/?debug=&db=Test_July_25#menu_id=107&action=97
For Functional Users
Navigate mouse to top right corner and select About OpenERP
Now Activate Debug Mode
You Should be done now with interface debugging.
For Code Debugging (along with arya's method these images may help you)
You can use browse button to select the project and the openerp server file
Finally place breakpoints in your code where ever necessary
Navigate through
administrator(top Right)>>about OpenERP
Dialog Open Click on Activate Developer mode
Their is more complexity and less control by adding more fancy tools try and go low level and use python pdb and if you are debug geek then use winpdb with pdb which gives extreme contorl over your code navigation.
And for simple value abd flow use print or pprint module from python.
Bests.
Start debug mode on browser ??
In URL you can type ?debug after web
OR
go to About OpenERP select Activate Developer Mode
If You want to debug from eclipse then
go to PyDev Package Explorer --> openerp(odoo) --> Right click on openerp-server file
Select Debug as --> Python Run
It will ask for change current perspective from PyDev to Debug click "Yes" and its Done
Activate the Debug mode and use some print statements to debug the variable values

SWTBOT switch workspace

I am using SWTBOT with tycho-surfire to test an eclipse application. The tests runs individually fine, but when I combine them I need to switch the workspace after each test, or specify somehow a specific workspace for each test. When I try to switch the workspace from inside the test with this code:
<code>
bot.menu("File").menu("Switch Workspace").menu("Other...").click();
bot.shell("Workspace Launcher").activate();
String workspace = bot.comboBoxWithLabel("Workspace:").getText() + "/ResetButtonTest";
bot.comboBoxWithLabel("Workspace:").setText(workspace);
bot.button("OK").click();
</code>
the simulator reaches the OK button and press it, the workbench closes but never starts again. There was an error asking to set the property eclipse.vm, and I did. The error is gone but still can not switch the workspace.
Is there any configuration file or something that I can add to tyco-surfire to configure SWTBot to have a specific workspace for each test it runs? Or even to run each test in a new workbench, and not to continue in the same workbench? Or is there any solution that fixes the problem of switching the workspace from inside the test?
So for each test you want to set a certain workspace? The test is not about switching workspace?
If you can configure the command that starts up the SWTbot test, you can add -data <my workspace> as a parameter. It will then start up with that workspace.