I have a project I'm working on and I need to do some profiling now that the bulk of the coding is finished. However one of the stipulations for completion is that I need to find out Total Time taken for the methods to execute and also how many times a particular method is executed. However it's driving me nuts trying to find Invocation Count on Netbeans. One of the help pages online said click the Drop Down Arrow in the window but all I can see as a selection column called "Hits"; I googled that and no explanations crop up. Anyone here have experience with NetBeans profiling? Thanks in advance.
I think the solution may be as simple as changing the list selection labeled Profile in the OP screen shot from All classes to Selected methods. However, if that is not the case, here is a walk through of the setup to get the invocation count for selected methods in a results snapshot when profiling in NetBeans:
Select Profile -> Profile Project for your project.
If no profiling has been set up the screen should look similar to this:
Click the Configure Session button (or link) shown in the screen shot above.
From the drop down list check User Defined Profiling Points, and select Methods.
This will cause a Settings cog wheel icon on the far right to be displayed. Click that to display another drop list labeled Profile with a default selection of All classes.
Click that Profile drop list, and select Selected methods which will allow Invocations to be shown in the profiling results. (The screen shot in the OP shows All Classes is selected instead.)
Having chosen the profile Selected methods, click the Add button shown in the screen shot below, and select the methods to profile in the Select Method dialog:
Finally run your app with the selected profiling options by clicking the Profile button with the green triangle to its left.
The Invocations column (n.b. not Invocation Count) should be displayed in the results. If not then click the black inverted triangle on the far right of the column headers row, which allows toggling the display of each column in the results snapshot.
These instruction specifically apply to the most recent stable release of NetBeans (8.2) but the general principles should be valid for earlier releases as well, though possibly with some differences in the details.
Related
This question is conceptual, and I am asking on this help forum in order to look for a lead to go off and research, and will not contain any code examples other than one to demo what I am using to grab the element value described below, here is some background:
The test I am writing involves signing in to the same application using two driver sessions each of which open a webdriver chrome window. Each one logs in to our app as a different user, and then from one, you can see the "online/offline" status of the other.
We use one class of methods for the first session, and another class of methods for the second session, and if a feature file title appears in a third class containing a LinkedList of strings, then the system knows to open the second session, and we then call methods in the relevant class to run jobs in the appropriate window.
In the current test case I am creating, the objective is to assert in a window we shall call "A", that the element being checked has a specific CSS property, namely its color property. It is grey when the other window that we shall call "B" does not have focus, and it is green, meaning online, when it does have focus, and is logged in.
The logged in side I can take care of, and manually I can see that it is working, but after this log in, when I use from the class that runs commands for window "A" the following line, directly after the last line that directs window "B" to have focus and do something, then it writes the value for "offline" in to the variable shown, as the window "B" has had to lose focus in order to check the element in window "A".
String color = seleniumClient.getWebDriver().findElement(By.xpath("//div[#id='user-content-button']/span/span")).getCssValue("background-color");
I am not able to influence the development of our app, as I am a QA, but I am asking if anyone knows how to maybe freeze the state of the chrome session for window A showing window B to be online before I run the above line, or any other way that I can get my test to see the correct state when the focus is not on the window "B"
Thanks.
Hello Fellow Stack Overflow members and coders,
I am trying to make an automation script using Selenium WebDriver on Instagram where I want to follow every member a particular account is following.
I am stuck at a point where after navigating to user's profile (who's follower I want to follow) when I click on "following" link a new window opens and it contains all the members this user follows (as shown in following screenshot):
Window opened after clicking "following" link
Now as you can see in above window only first few followers are initially loaded and then as you keep on scrolling down the users keeps on getting loaded.
I am completely lost here on how can I move the focus to this new jquery kind of window and keep on scrolling down until the full list is loaded and then find once full list is loaded, click on follow button for each user.
Your help would be really appreciated in this regard.
I have tried various options like moving the mouse over to the window and clicking at blank location and then using Keys.Arrow_Down multiple times, finding first Follow button and then keep on pressing down button etc but it doesn't seem to be right approach and it doesn't work. Kindly help me solve this issue.
what if you...
Using a while, get all the visible elements in a list, move using JavascriptExecutor to the last of the element in the list, and keep getting the elements(doing the same, moving to the last pos in the list) until you reach the number(this is the while condition) of following(or following-1 if he/she follows you)
(JavascriptExecutor)driver).executeScript("arguments[0].scrollIntoView();", webElementInList);
I am making an image processing application in Java. I have written all the code for the processing part, I just need to make a user interface for the same. The user interface looks like this :
It has a browse button to select an image, Once an image is selected, it is to be displayed. The user can now select multiple rectangular regions on this image using mouse (the user clicks at a point in the image and drags mouse to select the region of interest). All selected regions appear shaded. The selected regions also appear in a list, so the regions can be un-selected by deleting the corresponding entry from the list. Finally the user can click on a "process" button to perform the image processing.
I want to know what java gui technologies do i need to create such an interface, and any good resources from where i can read the same. I need resources, for example, about how to manage the layout, display images, mouse events on images etc.
Read the Java trail about Creating a GUI With JFC/Swing.
You will find better answers there than here.
Also, you can use Netbeans; it has a great GUI editor. Or you can check out Google WindowBuilder Pro and install it in your eclipse.
I use what I think is a typical layout in Eclipse: my workspace contains the Project Explorer on the left and the Java editor window taking up most of the screen, with the small console window at the foot of this editor pane.
When I open a very long Java class, containing a large number of method definitions, in the editor pane, it can take a long time to move between methods. I use CTRL-F to open the Find dialog and then type in the name of the method if I can remember it.
Is there a better way to navigate between method definitions in a large class in Eclipse?
Ctrl+O will open a dialog with the methods (and variables) list. It supports "advanced" :-) searching so you can just type a few letters of the method's name
Use the Outline View.
I use a layout much like yours but I keep the Outline panel open in it beneath the project/package explorer. This makes it easy to see the project's outline as well as the current editor's outline at a glance.
In addition to the Ctrl+O option for a quick outline, one can type (on a Mac) Cmd-Alt-Q then O to focus the Outline view. Once focus is in the Outline view, you can use the arrow keys or letter keys to navigate through the list of methods.
Cmd-Alt-Q is useful for opening many of the views. In my Eclipse Helios right now, a momentary delay after playing the chord presents a quick list of many different views, many of which have their own hot key.
Finally, you can use the "Next/Previous member" chord to jump to the previous or next method definition in the file. Again in my Helios build, the Next member key is Ctrl-Alt-down . Yours may be different.
To find out what the keystrokes are in your Eclipse build, open the eclipse preferences. Use the searcher to search for 'keys'. Open the configuration for Keys . Then in the keys search bar look for "member". There should be an item for "Next member" with a bound shortcut key/chord. Browsing the list of hotkeys is a great way to improve Eclipse productivity in the long run ;)
I try to build a gui (Swing) for a simple java application. The application should have a start window like a menu. From there I would like to navigate to several other windows.
My question is what is the best-practice to achieve such a navigation? Should I build several JFrames and switch the visibility of them on/off when navigating OR should I better have one JFrame and add/remove JPanels in this single frame to navigate between the windows?
Thanks.
I recommend
Do not do a MDI application with sub-frames like those found in the old Windows days. They suck as they make the matter confusing.
Do design a tabbed interface. The welcome page/menu will be displayed on a first tab that is always created on the start.
All cool kids do that nowadays:
Visual Studio
Eclipse
Firefox
If each of your windows correspond to different task (possibly nested), you could present your application as a SDI, with on the left a task panel like:
Each of the task would display one JFrame with the associated window.
Other solution: a table of content like this picture on the left side
(note: it actually also displays a task panel in this example on the bottom right)
Multiple JFrames sounds like a better idea to me. Much more OO.
You must find a balance between these goals:
Not too many things in one "window"
The user must quickly be able to find the correct window to do the next step of work
All relevant information must be visible at any time
Eclipse solves this by creating many small editors where each editor shows some specific information and allows to modify it. Editors are then arranged within one OS window in tabs and "views". A view is always completely visible and they can be arranged. Think of a view as a way to cut an existing editor in half (horizontal or vertical) and then being able to replace one of the halves with another editor. Between each half, you have a splitter so you can adjust the sizes.
Arrangements of views are then saved in "perspectives".
This allows every user to create a perspective which contains all the necessary editors at the same time, arrange them as they need it and work effectively.