Is there some framework for testing GUI based on AWT? - java

There is a lot of frameworks support testing Java GUI based on Swing but I can't find any open-source framework supporting AWT GUI testing. The framework should support script writing (not mere recording of user actions). Is there such framework or tool?

You likely can use awt.Robot to write yourself such a tool.
Also meanwhile Swing and AWT can much better be mixed than in older times, you should consider to rewrite your UI, or at least do futur development Swing based.

a good open source framework for Java GUI testing is Maveryx.
It has many good point:
It can handle Swing, AWT, Java Web Start (and soon) applets and SWT.
There are no custom script language, you can write your test case in java.
Thera are no GUI MAP dependences, you don't need any "capture and replay", only write your test and go!
It's fully compatible with JUnit through the Maveryx Eclipse plug-in.
Mauro

Related

Difference between Java Swing application & Netbeans platform Swing

I want to develop a simple desktop application that connects to the Java DB , using Java Swing for the interface design.
I am new to Swing so I tried some tutorials on the net and came across
the Netbeans platform Swing components.
What is
the difference between the Java Swing architecture and the Netbeans Swing components?
Which one will be appropriate for developing interfaces
for desktop applications in Java?
From The NetBeans Platform:
The NetBeans Platform is a generic framework for Swing applications. It provides the "plumbing" that, before, every developer had to write themselves—saving state, connecting actions to menu items, toolbar items and keyboard shortcuts; window management, and so on.
It is an API built with Swing, that is supposed to provide some extra 'built-in' functionality. Since you need to know Swing to be able to use it. I suggest you concentrate on Swing for now.
Actually, it will be better to move on Intellij Idea from Jet Brains. It’s much more better than NetBeans IDE. Of course, it’s only my opinion.

Desktop GUI framework

I tried to create a new Swing GUI desktop application template using NetBean 7.0 and just found NetBean has a disclaimer:
"Note that JSR-296 (Swing Application Framework) is no longer developed and will not become part of the official Java Development Kit as was originally planned. You can still use the Swing Application Framework library as it is, but no further development is expected."
So does it mean swing will stay the same from now on and nothing new will be added? What will that impact the applications using Swing? Do I need to consider other GUI frameworks instead? What would be the best framework option for a scientific plotting and graphic heavy application?
Thanks.
Swing is part of JAVA since 1.2 and it is part of the JAVA STANDARD. It is not going anywhere any time soon.
The JSR-296 (Swing Application Framework) was a framework to simplify and help developing in swing, which didnt go very far. Netbeans uses it internally. If using JAVA 7 then, like many other netbeans specific libraries, you need to ship it separately with you app, because it is not standard.
So, feel free to develop in swing. A pure swing app WILL WORK on any JAVA STANDARD on almost any platform for a long time to come. If you use the SAF, thats also OK, but that is not standard and its pretty much dead, so just remember to ship the jar with your app.
Hope that clarifies the situation.

How do "professionals" make a GUI in java?

Thanks for your answers to my previous question about GUI in java. I now wonder what are the solutions chosen by professionals to get a nice GUI, for "real" applications. Do you use swing and JComponents and just change the "look and feel" ? Do you prefer awt or another library ?
Sorry if that question sounds weird, I'm a student and I don't really know how java is used in the real world...
In our company we use Swing, as that is supported by the JVM out of the box, but we do use color coded background colors for some panels and buttons.
If we'd use something different, like SWT or Jambi we'd also have to roll out those frameworks for all platforms, and test those frameworks for all OSses and (supported) java versions. Not nice at all.
It is however fairly tricky to create a nice responsive application with Swing; so you really need to use SwingWorker and the like. With a bit of experience however you can create a nice application that way.
And even if it isn't the fastest framework to develop in, development time is really small compared to defining the functional requirements of the user interface, and testing and support when the version is released.
That said, our target is desktops. If you target mobile devices or also need a web frontend your choices may vary.
I don't believe anyone prefers AWT anymore. Swing supplanted it entirely eleven years ago, building on top of it to correct flaws in the AWT 1.0 design.
Swing isn't the only way that professionals make Java UIs. That works for desktops, but there's also JavaFX now. For the web, UIs are built using HTML, CSS, JavaScript, and JSPs.
My experience is that most organizations that want to create rich GUIs still use Swing, and manually go through all the annoyances of layout managers, etc.
The use of SWT is fairly limited to organizations that are using the Eclipse RCP as their platform. I'm not sure why it hasn't caught on outside this platform.
It's sad to admit, but Java Swing GUIs don't generally look good unless you spend a lot of time creating a more native feel for them. Even then, they often lose out on aesthetics to equivalent programs written specifically for Windows and which use Window APIs like WinForms.
The most decent Apps I saw in the last years were build using Eclipse Rich Client Platform
Eclipse uses the Standard Widget Toolkit
and provides Graphical Editing Framework (GEF)
We typically use Swing becuse it's supported in standard JREs out of the box. Normally we do the initial form design and event hookup in Netbeans and then export it to whatever we wish, Eclipse, for example.
Netbeans spits out pure Java using standard libraries (plus a jar or two you have to include) so it's no big deal designing the form in Netbeans and later moving on to something else.
Some people suggested doing form layout by hand using a layout manager. I see that as an option only if you are doing something big and very well budgeted that has to be maintained ad infinitum. Otherwise it's just too time consuming to be worth it.
We rely on SWT for our Java GUIs. Yes, you have to include an external native library, but the look and feel is native, more responsive (although Swing has become much faster in the past few years) and seamless with other apps on the target platform.
Macintosh OS X creates their own Java runtime. They give Swing components the same look and feel as native applications.
I use strictly Swing. I distribute "real" desktop applications via Web Start for both Mac and Windows that interface with the user's smart card reader.
The NetBeans IDE gives you a WYSIWYG way to create your forms. I've tried it out, and it's pretty neat, but we still use Eclipse as our IDE and design the forms in code.

MVC/MVP/MVVM frameworks for Java GUI applications

Can anybody recommend a (preferably open-source) framework for decoupling GUI from model in Java desktop applications?
Fundamentally decoupling a GUI model from your core java code is best done with a databinding library. Which is to say you have your pojo business code, you have the GUI component code, and you don't fancy writing a load of logic to sync them up all the time whilst updating the view and implementing the business logic. So don't. Find a mature databinding framework for the GUI widgets you are using and learn that; have it keep the screen controls in sync with your pojo code.
JGoodies and beanbindings are good examples of Swing variants of binding onto an OO model. The core bits of JGoodies are opensource. If you go to /articles on the jgoodies site it has articles on pattern and databinding. Whilst each binding framework has different classes the patterns for writing good clean code are portable between GUI frameworks and bindings frameworks.
If you download the now opensource WindowsBuilderPro tool then it has excellent examples in both Swing and SWT of doing good databindings. The swing jphonebook example uses the beanbindings library. WindowsBuilderPro is a drag and drop GUI builder; you used to have to pay for it as a leading drag and drop GUI builder which works with the leading free GUI libraries. It was bought by google and opensourced so that they could beef up its graphical screen builder support for GWT (the Google web GUI framework).
That GUI builder tool has both excellent sample code and is an excellent opensource tool now. It does the same example of a phonebook in both Swing and SWT GUI libraries to demo its drag-and-drop GUI builder tool power. So it is a great way to compare and contrast Swing to SWT whilst learning databindings.
Java Swing actually makes good use of MVC for just this purpose.
I would strongly suggest you to try the ZK framework. I have not found until today such a srtong framework. In my company we have applied new projects within a few weeks using the latest patterns like MVVM. The style of programming is much like developing a classic 'desktop' app.
PS: I am in no way related to the ZK people. I am just using their framework.
From your reaction to the suggestion that Swing is an MVC framework for desktop apps, I think that you really need some kind of generator framework that will generate the 'model' and 'view' code from higher level specifications. Examples I'm (more or less) familiar with are Eclipse EMF, GEF and related technologies.
Biscotti is a great framework

Rapid Java UI tools for backend server testing

We have a Java server application using a message based communication passing around strongly typed complex POJO messages. Our regular client is a rich-client Flex application that has a very heavy art and UI development process that doesn't lend itself to rapid prototyping.
We are planning on building a Java UI to test server functionality, currently we have been testing our backend Java server using a console based client using basic commands. The reason we need it in Java is because the messages we are passing around are strongly typed complex Java objects (integrating in any other language requires parsing custom JSON which we are building a code generator for Actionscript to ease this pain).
The issue with using the basic console client, is we're developing a new application where state is being tracked across multiple messages, and simple text console output doesn't make sense we need a more complex UI to show results.
What tools are there for rapidly building a rich client Java UI for use by developers to quickly add new UI's to test a Java backend?
Coding Swing and UIs by hand sucks.
I've looked at Eclipse Rich Client Platform and it looks promising but I'm concerned that the learning curve, and the ease of adding a new UI to test server functionality is not going to be easy. Is there like a light-weight Eclipse RCP, I wouldn't be against having a small subset of developers working on the core Eclipse RCP application while day to day work can be done in a simple rapid-prototyping environment that will easily integrate.
Some Java UI technologies I've been looking into (has anyone had experience rapidly prototyping UI's with a low learning curve for server developers).
Spring RichClient
Groovy Swing Builder
Eclipse Rich Client Platform (RCP)
If you prefer Flex;
Try spring with blazeds
Test it with flexunit
or JSF;
simple jsf design connect to managed bean (mix with spring) and managed bean connect to your service layer ....n
Test it with jsfunit.
You can test it selenium also.
or Swing;
Design with Swixml or Thinlet ((these are remind mxml)
P.S: Don't waste your time to design nice ui. You can do it later. Functionality is important than good looking. Later CSS do it for you. I repeat this, by myself :)
Really, if you are going to use Swing, your developers are going to face a learning curve. Groovy SwingBuilder and similar libraries are just DSLs that cut out a lot of boilerplate and repetitive code. SwingBuilder certainly saves time (and is more elegant than pure java), but really the complex part of using Swing is dealing with the underlying framework.
The NetBeans Swing UI builder (Matisse) is really nice if you want drag-and-drop Swing development, but you still have to be pretty familiar with Swing if you want to understand how to hook everything together.

Categories