I am trying to prevent browser to close after my test scenario, I have tried several things found from online resources but nothing worked so far.
The goal is to prevent the browser to get closed and keep manually from a certain point, like a 'checkpoint', is there any way to do this?
I have tried :
#After("#leave_window_open")
but seems it is working only if the Scenario is failing.
is there any simple way to block this behavior, and avoiding debugging?
The browser won't close unless you call .close() or .quit(). You must have those calls somewhere... just remove them. If you are looking for a intermittent fix, just add a breakpoint where you want the script to stop. Once the run breaks, stop the execution and continue manually. I do this all the time for debugging purposes.
Related
I use Drag method on a Java Slider with some number as argument. It fails to work during execution. But always works with breakpoint. Any setting to make QTP simulate execution behavior of breakpoint.
Please note that application is thick client Java.
I've come across this problem in the past and I found it was because QTP/UFT was getting ahead of its self. This might seem primitive but I had a sync (to ensure that your application has displayed the expected page), put a couple of second wait, check that 'Slider' exists and then attempt an action on it.
Many times I came into situation while debugging in Eclipse that I Don't Know where to put break point! For example, I just need to know when a client make a request to server which method it hits for this request. As I don't know where it will hit , I can't put a break point.
Can anybody suggest this if this conditional break point functionality available in Eclipse or any plugin? Or any other solution?
At the moment I've been using logging to keep a track of my continuously changing values within an update loop. Problem is is that this can be time consuming.
I can use the debugger but it stops code executing and due to what I'm doing causes weird results and false values.
Does anyone know if it's possible to "watch" the variables while keeping the code running. Like having one watch within a scope.
Android Studio/IntelliJ have some really nice features in breakpoints that let the IDE take an action when it hits a breakpoint instead of just dropping your app into the debugger (which it can of course also do). On any given breakpoint, there's a checkbox in the options that controls whether it will actually suspend your app and drop it into the debugger; you can turn that on or off independently. You can have it log a message to the debugger console, or have it evaluate any expression and log the results to the console.
I find these options super-handy; it's the equivalent of adding debug logging to your code, but you can add and change it on the fly without modifying your code and doing a rebuild-restart cycle.
There's also some really powerful filtering that will selectively control whether or not the breakpoint is triggered based on certain criteria; you can even set up cascades of breakpoints where one doesn't fire until a previous one is hit.
Experiment with some of the options.
This question already has answers here:
Run external program from Java, read output, allow interruption
(5 answers)
Closed 9 years ago.
I have been trying to work on this issue I had by searching thoroughly so as to find out what to do. However, none of the results I've found (at least until now) had suited my requests.
The fact is, I've got an executable JAR I've done. This jar starts an .EXE.
Now, the thing is, the EXE will keep on running the whole time, and I want to get whatever has been written in the console so as to write it on a JTextBox as soon as that is read.
Would you mind giving me an example of that? I would like to do it on my own, but my head doesn't seem to find out how.
Thank you very much.
EDIT: what I'm trying to do is a GUI for a gaming server
EDIT 2: for those saying its duplicate... wish it was... tried what the others explained but didn't work, so that's the reason I asked here..
EDIT 3: as I have been looking forward to find what the problem was, I will tell you that what I've done does not have any errors. However, I guess, it may be caused to the fact that the server (written in C++/C) may not output in a 'normal' way. May that be the reason? I hope so. Otherwise, I might be doing something really wrong.
Please notice I use InputStream in order to be able to read.. but well.
Basically, you need to start by running the process in some kind of background thread so there is no risk that it will block the Event Dispatching Thread.
Then you need to read the processes InputStream. As the input is read, you need to push these updates to the UI in such away so as not to violate the single thread rules of Swing. That is, you should ensure that all updates are made within the context of the Event Dispatching Thread.
Check out Concurrency in Swing for more details.
In this, I would recommend using something like SwingWorker. It allows you to monitor the process from a background thread, but has easy to use functionality to sync the updates back to the EDT.
Take a look at Printing a Java InputStream from a Process for an example
I am working on a java ee web application in NetBeans. I am trying to debug the behavior of the application but the behavior I'm seeing is confusing.
I am running the application through NetBeans in Tomcat. Within NetBeans, I select "Debug" from the root of the Project Tree and I can send one request to the application I've written. Breakpoints are hit and I get unique results from the application.
However, every subsequent time I try to send a request to my application, I get the exact same incorrect result (even if I clear the cache on Chrome) and the Netbeans IDE doesn't stop at any of the defined breakpoints. Is this to be expected? Does a Servlet get mangled in memory once it runs through the debugger once? Do I need to stop and restart/reattach the NetBeans debugger every time I want to debug the application? Is there something I'm doing wrong when using the debugger? Does this indicate a problem with the code I've written in my Servlet?
Thanks,
Jason Mazzotta
rjsang's point on the cache might be valid, and is worth investigating.
However, it might also be that something is breaking earlier than you expect, causing you to never even reach the break pointed lines.
I would suggest:
Look into liberally sprinkling your code with debug logging statements (using a good logging framework such as Log4J with SLF4j)
Throw more breakpoints at the problem - start with the very first line you expect to be hit from your request. And the go even higher/earlier, if possible.
Tail that Tomcat log (catalina.out) - you might spot something catastrophic happening there.
Good luck.