Used Code Plugin in Eclipse - swing

I tried to analyze a swing application. It's an old project and it has been growing over years, so it's very hard to read the code. Now we should redesign the application.
Now I'm looking for an Eclipse plugin which could me support to understand this application. Here what kind of plugin I'm looking for:
start application from Eclipse in debug mode
I run in the application to a point
I start the record in Eclipse plugin
I run some kind of business logic in the application
I stop the record
the tool shows me, which code is used or not during the record
Does someone know if this kind of plugin exists?
Cheers
Julia

Not a specific plugin, but you can get something what you want by smartly placing breakpoints:
For example to find where the action listener code is for a button, set a break point in the ActionEvent constructor just before you press the button. Then you can step forward until you get to the listener.
You could also use VisualVM (or other profiler) to do CPU sampling while you take your action and then look in which code the CPU time was spent (in the EDT for the Swing GUI specifically).

It sounds like a coverage tool that can be switched on and off at runtime. I don't think this is possible with Emma or Cobertura; best guess is to use these for unit tests (or small test applications that only use partial functionality) and hide any unused types to get partial views. But that may not work well when you want to understand GUI actions and responses.
Even if it is not exactly part of your question I would recommend to have a look into the X-Ray plugin which helped me a lot with a legacy application.
Oh, and Eclipsecolorer Profiler helped... but the project is not active any more.

Related

AIR Build Server Setup

I am at the point where I am running into incredibly long build times for my project and more projects to come. I would like to make a build server but I have not had any experience with them aside from downloading files from them as an end user.
My ideal setup is this: A GitHub where I can place my .fla file, classes and ANEs. The server sees this, compiles it, and allows me to test it remotely or hook into some debugger that lets me see stack traces and active variables at breakpoints and errors like Adobe Animate or Flash Builder.
Now I see there are GitHub plugins for Jenkins. I see there are questions referring to how to set one up with Flex/AIR. I come here with a few issues.
I am too far into my project to switch over from using Animate to something like Flash Develop or anything ADT related. The only thing I have found is how to take existing elements from my library in Animate and have them in a .swc for handling. However, this doesn't let me access existing elements in the Timeline and would rather not try to export/position/handle them in code (which is the only workaround that I see if this is not possible)
I run ANEs that are dependent on Google Play services and other Android specific libraries. Thus, I haven't been able to use the standard mobile debug launcher for AIR. I see Jenkins has some specific abilities for Android. Is it possible to somehow use this to give me a proper window for testing? I am thinking that I would need to run their emulator after compiling everything but I am unsure if there is a more efficient method or if it would even work.
I have never worked with Jenkins before or any other tools capable of automating tasks. Any step by step explanations is appreciated if you have the time.

Can Alcatraz be used to add build rules?

I'd like to create an Alcatraz plugin that adds a new project Build Rule to Xcode. Currently our tutorial requires that the developer manually add the rule, pasting in a script. None of the current plugins appear to add build rules -- is it possible?
It's probably possible because when writing a Xcode plugin you basically gain access to all Xcode's private classes & methods + the current Xcode state in memory. So yes, with a good amount of reverse engineering it should be doable.
Now I doubt this is a very good idea as such a plugin would act at the IDE level and not a project level, so you'd have to ask the user to select a project before adding the build rule.
From my point of view, building a plugin for this is way overkill, and a tutorial is good enough (you're interacting with developers after all, they probably know how to click a few buttons), and if you really want to take your users by the hand I'd recommend using a script (bash, python, ruby, etc.).
Crashlytics and Cocoapods both require to add a build step to the developer's project, and they both seems to do pretty well with instructions / a script.

Can I test that a transaction has been added to the database with Selenium IDE?

I am testing using Selenium IDE and Firefox.
Can I check that a transaction done in my website is added to my database without manually opening a new tab with localhost/phpmyadmin and selecting the transaction table?
Though you can use it but most people will advise you against it. Here's why :-
It can be unreliable. I mean it can lead to many false negative creating a lot of noise in your test result.
Very tightly coupled.
You will have to run it from Firefox all the time (last time I checked) and you will need Firefox wherever you want to test. [Restriction]
Can't use programming tricks like looping, conditions, etc.
Difficult to maintain as won't fit in any framework. (or can it?)
...and some more...
I would suggest use Selenium IDE to create a test-case for basic steps you follow. Export it to any language of your liking and then create history. :)
And like Dave said above, you may like to explore other tools specifically for database.
You can't, and shouldn't, directly look in the database with Selenium IDE. You can, and should, indirectly test that the transaction happened.
When you use Selenium, or any other browser controlling or simulating testing tool, you're testing your app from the user's point of view (writing a 'functional' or 'acceptance' test). Users don't know what's in the database -- they just know what they see on the screen. So if doing something in your web app changes something on some page of your web app that a user can see (not phpmyadmin but your application that you're testing), go there in Selenium and test that.
This is the right thing to do even if your testing tool does have a way to look in the database.
If your app writes some kind of information to the database that is never shown to any user, such as auditing information, the only way to test that with Selenium IDE is to add a page (appropriately authenticated!) to your web app so that Selenium IDE can see it. If you aren't able to do that, you need a testing tool that can look in the database.
RSpec and Cucumber, with the Capybara Ruby gem, are examples of testing tools that can both test an application through its user interface and also look in (and even change) the database.

Flash Builder bug?

Irritatingly, Flash Builder refuses to implement any changes I make to the program when I run it. I can't find any documentation of this anywhere online after a brief googling, just wondering if anyone has come across this problem before and/or found a solution? I don't want to have to export a release build every time I want to check if any changes have been implemented successfully (I'm just assuming that'd work)
It happened to me once before but I overcame this problem simply by starting a new project as there wasn't much of any significance, and couldn't easily fix it.
It's pretty much as simple as it sounds tbh, having returned to my computer a couple of hours after leaving it I find any changes to any part of the code have no impact on what is displayed when I go to run...
Any insight would be much appreciated
Thanks
Josh
It could be the cache of your browser. Clear your cache and see if that works..
It could also be because you have classes that are compiled in external swf's. If you compile in Flash Builder, you're not persee recompiling those classes. Instead, compile the external swf which has links to those classes.
You'd think if this were a bug in Flash Builder, people would be complaining about it a bit more often, check that your browser is updating properly, most likely you've got the SWF stuck in your browser cache.
Check the "clear application data on each launch" in Run/Debug Configuration window.
This will clear and uninstall existing app installed in your test device, so every new launch will have clean build.
Tips : Make sure to cmd/ctr + B first, In every run/build.

Easiest way to unit test SWT and Swing apps in a headless environment?

I'm looking to unit test some SWT and Swing code for a project I'm working on and the tests run fine as long as I'm running them from eclipse.
As soon as I run them in my hudson environment it fails since hudson runs the tests in headless mode.
What's the best way of doing this? Open source solutions only please (since the project is open source).
You could run Xvfb (X virtual framebuffer, an X11 server that performs all graphical operations in memory) and this works fine.
But there is another solution with Hudson's plugin for Xvnc. Simply install the plugin and check the checkbox in the job configuration screen:
alt text http://www.justinedelson.com/blog/wp-content/uploads/xvnc_box.jpg
Hudson will then automatically start up a Xvnc session and set the DISPLAY environment variable to the appropriate value and then shut down the session when the build is complete. One advantage this has over the Xvfb method is that if you have multiple Swing/SWT projects building simultaneously, each build has its own X session. This may not be an issue at all but it seems like a good idea.
Before using this plugin, you obviously have to have Xvnc installed. What's less obvious (although sensible) is that you must also set a password. You do this by running:
$ vncpassword
This has to be done as the same user Hudson runs as.
Try the Abbot Java GUI Testing Framework and SWTbot. At least SWTbot should be able to do it.
If neither offers a headless mode, then this blog post might give you some ideas how to get rid of the UI for testing.
Using Swing I tend to organise things so that the component tree can be created without a Window at the top. Doing this allows you to simply create a JPanel in a unit test and use that as your top-level component. There are certain things you cannot test, such as focus and any logic involved in the creation of the Frame for normal operation, but the vast majority can be tested.
You may want to look into the FEST library to make life easier whether you go headless or not, it looks very good: http://fest.easytesting.org/swing/wiki/pmwiki.php
I was sure I posted this here before, not sure what happened to it.
Cacio allows for running Swing app headless.
http://rkennke.wordpress.com/2011/10/17/cacio-for-ui-testing/
I don't know about SWT, but with Swing you can't. Any instantiation of a Window (JFrame, JDialog, etc.) even if it is never set to visible will blow up in headless mode (on JDK 5). What we did was not run in headless mode and install Xvfb to provide the windowing without actually having a real windowing system installed.
You could try RedDeer Testing framework
https://github.com/jboss-reddeer/reddeer
• Support for running tests in a Jenkins CI environment (Hudson like)