How to stop all running process before a new run in intellij - intellij-idea

Is there any way to configure a run configuration in IntelliJ which will stop all running process before running a new run?
I always forget to stop the previous run. So I hit to the point where it says the port is busy by the previous run. So I have to stop the previous run and restart the new run. That takes a long time. I am wondering there should be some way to simplify this process. Please let me know any idea?
p.s: I tried the macro to record multiple steps. That is not working correctly.

As JB Nizet said in the comments, you can check the Single instance only checkbox in the Run/Debug Configurationspanel.
According to the documentation:
Single instance only. In this case, a confirmation dialog box will show up every time you try to launch run/debug configuration, when one instance of the same type is still running.
If you click OK in the confirmation dialog box, the first instance of the runner will be stopped, and the next one will take its place.
If this checkbox is not selected, you can launch as many instances of the runner as required. As the result, each runner will start in its own tab of the Run tool window.

Related

Selenium IDE Test Runs in GUI - But Fails when run in CL (linkText not Visible)

When my saved project and test runs in the Selenium IDE GUI it's fine, but when I perform the same test called via the command line side runner it fails. The issue appears to be the linkText not being visible, but I don't understand why it would fail when it runs fine form the GUI.
You can see the last step (8) as passed, with reference to the linkText
I then save the project in my local folder
And run it again using the side runner command
ElementClickInterceptedError: element click intercepted: Element Corporate Project/Program/Event (CORP) is not clickable at point (798, 199). Other element would receive the click: ...
It appears that the linkText maybe covered? The weird thing it's visible to me when the selenium test is running, just before it hangs. I did try to add some wait commands, i.e. "wait for element visible". But didn't seem to help.
Maybe I didn't insert the command properly?
I feel like I must be missing something obvious. Any suggestions?
I've found similar threads on GitHub that indicate differences in the way the IDE core and web driver work. One user indicates it actually IDE that's clicking through an overlay. I've managed to overcome my issues using simple pause commands, unsure why the wait commands didn't work for me.

"Report" button in RIDE.py becomes inactive after the first run

After running a script when we make some changes and run it again the "Report" button at the top becomes inactive and the console remains blank.
Anyone facing this issue?
It only works if we clear cache memory after every run. I don't think it is an idle solution. Please share if anyone was a better solution.
I have seen this when i.e. the IEDriver.exe process is still running after the test stops.
Closing this process is then sufficient to enable the buttons (after next run).
A teardown closing all browsers should prevent this from happening.

How to show run tool only when there is an error in IntelliJ Idea?

I use TDD quite a lot, and I was wondering if there is a way to show the Run Tool window only when there are failed tests?
Or to be more generic, for any run configuration, I would like the Run Tool window to be shown only when something goes wrong. Otherwise I would prefer the little non-obtrusive green pop-up to appear. Like when you run a lot of tests and you minimize the Run Tool by clicking on the "down arrow" in its top-right corner. When the tests are done, a little green pop-up appears over the minimized window.
I would also compromise for an answer that tells me how to keep the Run Tool always minimized, and only see little pop-ups, regardless if they are green or red.
This is probably not exactly the answer you wanted but if you look in the RunConfiguration (Run->Edit Configurations -> JUnit) for your test run you should see a checkbox called 'Activate tool window'. If that box is ticked then the Run Tool window will pop open even if its minimised. When it's not ticked then the Run Tool window will stay minimised.
So, for any individual existing test run you can change the check box value to prevent the tool window appearing. If you're doing TDD that could mean you have many configurations for specific test cases / suites etc, which you would need to change individually.
In the longer term, you probably want to avoid future run configurations popping up the test. You can do that through the Defaults -> JUnit section in the RunConfigurations window.
Also, in the tab "Logs" you can check the option "Show console when a message is printed to standard error stream"
When this option is checked the window is opened automatically if some test fails.

Restrict core usages PyCharm

I have this program that I've written in PyCharm. This program should be running for a week or so, and it is very processor-needy. So when I run it I pretty much have no use of my notebook, as it becomes very laggy.
Is there a way to somehow tell PyCharm to use first three of my cores and leave one for other programms so they can operate normally?
Go into task manager
Find the running task (it probably won't be the main pycharm window)
Right click and select "go to details"
Right click on the details and click "set affinity"
Select whatever cores you wish the program to use
Alternatively you can use the "set priority" sub-menu and set it to "below normal". All other processes are normal priority by default, so it shouldn't interfere with anything, but still use any other available processing power. You can do the same thing with long installations or automatic windows updates so they don't slow you down.
I should also note that both of these selections will be reset upon restarting the program. Additionally, if you are using windows 7, you don't need to "go to details". Everything will appear in the context menu for the process.
Unfortunately, I don't know how to do this in pycharm.

Automation of DOH Robot tests interrumped by Pop-up message

In order to automate DOH tests during our build process, I use Selenium RC to launch different browsers (IE and Firefox) on a server placed on a different domain than the build machine. Each browser is directed to our runTests.html in order to start DOH.
Sometimes, when a test that uses doh.robot starts, the following message is shown:
"DOH has detected that the current web page is attempting to access DOH, but belongs to a different domain than the one you agreed to let DOH automate. If you did not intend to start a new DOH test by visiting this Web page, press Cancel now and leave the Web page"
but since these tests are unattended it just sits there waiting for someone to click OK, and Selenium times out (in IE 8 it seems like the pop-up disappears automatically but the robot does nothing afterward).
As I said, it doesn't always happen. After you click OK on the Pop-up, the message will stop showing, and the message can go away for several sessions, but then it will show again in which seems to be an arbitrary way.
Does anyone knows a way to prevent this pop-up from showing?
This is probably not the correct way to do it, but in util/doh/robot/DOHRobot.java, you may be able to modify the code to not check that or always simulate pressing "OK". I haven't tried it myself, but I may also need to do that for some of our automated testing.
When the DOH robot is initialized, it first tries to click in the upper left corner of the page you are trying to test. If you obscure this div (you can see it with firebug), then the message will pop up. I think the problem is that your page isn't always loading up quick enough.
It is somewhat of a challenge to fix this. I haven't used DOH in awhile, but I don't think there is any way you can use a setTimeout to fix this. (You can try using setTimeout on the doh.run command, but it might be the case that the DOH robot clicks that div before parsing any doh commands.)
Another thing you might be able to do is add a sort of "wait" command to Selenium, or whatever shell command you are using to fire up the system.