How do I enter debug mode for my widget tests on Flutter in AndroidStudio? - flutter

When it comes to starting debug mode while deploying my app to my device in AndroidStudio the debug button is green and clickable:
If I however want to start debug mode for my tests it is greyed out:
Is there a way for me to enter debug mode to better understand why my tests fail?

It turns out that Debug mode is available when Debugging individual files but not when Debugging folders/All tests.
This means it requires adding a new run configuration (via edit configuration):
Click new configuration:
Select Flutter Test and end up at:
You need the Test scope All in file and can select the testfile that you want to debug and use the debugger with it.

Related

Eclipse Launch Group - How does Launch Mode work?

I am working with STS based on Eclipse
About Run Configurations
I have some Maven configurations for Main executions defined through the Maven Build section. I need execute some of them together, for this goal I am working with the Launch Group section as follows:
From above I added three configurations to run together.
When I added each one, or even if I need update/edit each one - exists the following (observe the bottom part):
From above I did do some experiments about the Post launch action options and I understand clearly how works each one. Until here all is fine.
The situation is about the Launch mode options as follows:
From above I understand run option, it is the common or simplest execution.
But I am not able to figure out - what do or how work the rest of the options:
Inherit
Profile
Database Debug (Not sure if this option/item appears because I have the Dbeaver plugin installed)
Question: therefore how Inherit, Profile and Database Debug work? (Mostly the two first). If some scenarios or situations can be shared about when to use each one, it is appreciate to have a better perspective.
BTW if I choice Profile, appears the following error message (see blue square), as follows, so not sure when would be used (it is confuse)
The launch mode must be supported by the type of the launch configuration to be able to select it without an error.
Maven launch configurations support the launch mode Run only.
For launch configurations that supports the launch mode Run and Debug (like e.g. Java Application launch configurations), also Inherit can be chosen. Inherit means the launch mode of the launch group. Use the drop-down of the Debug button in the main toolbar to launch the launch group in Debug mode or the drop-down of the Run button to launch the launch group in Run mode. Alternatively, a launch group can be executed via the menu Run > Run Configurations... respectively Run > Debug Configurations... in the Run respectively Debug mode.
Launch groups exist since Eclipse Oxygen (4.7). This short video shows them in action. Run and Debug are the basic launch modes. All others with the exception of Inherit are contributed by additional plug-ins. For example, the Profile launch mode comes with Eclipse EclEmma for Java code coverage which is built-in in all Java IDE packages.
The dialog should not offer the option to choose a not supported mode. Maybe this is because plug-ins can add additional launch modes (in your case Database Debug) or maybe because nobody has implemented it yet (Eclipse is open source and contributions like this are welcome).
I have tried to run launch groups in coverage mode but have not been able to make it work. This seems to be a limitation in Eclipse. It would be useful to run a group of unit tests in coverage mode.

How to debug Karma when it fails

How can I debug a failing Karma test?
I am running mocha+chai+sinon tests without a problem. If I try to run the tests with Karma I get a "Uncaught TypeError: Cannot read property 'call' of undefined" error and Karma stops running (I am using Webpack to transpile). The error seems to be with a Webpack loader, but the question is how to I debug this? As soon as I run the tests, karma fails and terminates.
How can I trace the karma execution?
You can configure karma to stay alive in the background. Just add the option singleRun: false to your karma config. If you're using grunt-karma, you can also additionally set the background: true option.
If you then start karma, the window which opens up should stay open. There should be a debug link which will open a second window. This window will stay open and you'll be able to re-run all the tests by just pressing F5 / refresh. Inside that window you can debug the whole stuff using the dev tools (usually opened by pressing F12) of your choice.

How can i know an application running in debug or run mode in eclipse

I do start/stop my application more than 15 to 20 times every day. Every time i start app in debug mode only. But some times the debug(break points) would not work, then i will get confuse that is my app running in debug or run mode.
Do you have any idea to find out.
Even some times, I started my app in debug mode and it runs in debug mode for some time, suddenly works as run mode, it would not consider my break points. so, if i restart my app in debug mode only, i can do debug again.
While the application is running, open the Debug view in Eclipse. If all that you see in the tree is a path to your Java distribution under the project name then you are in run mode. If you are in debug mode then you will see the above information plus all the threads that are currently running in your application.
When you launch your application, the mode into which it runs is indicated in the "server" panel, like this :
or
Sometimes, when the debug mode doesn't work(for example it can't start), I remove all the break points, then I set them again.
Make sure what you run 1st.
Debug mode should display you code with variables in debug tab in eclipse while program is running.
Is your application a standalone application or a server hosted application which you remote debug? In both cases as soon as the debugger is connected to whatever local or remote process the signs left to your debuger icon get enabled. Those are in a row a few arrows (Step back, Step into, Step over) a green Arrow for Resume, a Suspend Icon, one for Stop and one for Disconnect.
If you open the debug View (Window->Show View->Other... type in "Debug") you should as well see if your Debugger is currently connected to any process.

Displaying launch configuration type in Eclipse

Is there a setting or plugin which gives visual feedback about the currently launched configuration's type (i.e. whether it was debug or run)?
The debug view can give you this information:
An application running in debug mode will include the list of running threads. In the above image, the first launched is in debug, the second in run.

error issue on the debugging process

In Eclipse®, on the Run menu, click Debug Configurations or Run Configurations.
Expand the BlackBerry Simulator item.
Perform one of the following tasks:
To work with an existing launch configuration, under BlackBerry Simulator, click a launch configuration.
To work with a new launch configuration, right-click BlackBerry Simulator, and click New.
Click the Simulator tab.
Click the General tab.
Click run
i have followed all the steps above but still i am getting the error failed to connect to the remote VM.Connection time out.org.eclipse.jdi.TimeoutException
can anyboby help me in this issue
Do you see this every time you launch your test?
This thread mentions:
For the 8530 simulator just try it again.
I get that message sometimes when I am running too many apps/low memory (I do a lot)/just started Eclipse/etc.
Often if I run it a second, sometimes third time it works and continues to work after that.