Experiences with integration testing java web applications, is cucumber viable? - java

I know cucumber from the rails community, and it seems to potentially be used in java.
Has anyone actually used it successfully on a project? Any issues with it?
I am thinking selenium is probably the most stable solution for integration testing a spring app?
With selenium, I guess the best way would be to use the browser add-on correct? I am looking for a simple and effective solution that isn't time consuming to create/maintain and run.

Sure, it's viable, although I used JRuby for Java library integration.
Personally, I'm not a fan. I much prefer easyb, although part of the reason was an easier transition for some devs from Java to something higher-level. I find Cucumber a bit hoop-ful, but YMMV.
We had a few glitches making easyb output play nice with Hudson, but relatively minor.

Related

Java Web Framework similar with Ruby on Rails paradigm

in your opinion, what is java web framework that most close to or similar to the paradigm of the Ruby on Rails (like convention over configuration, DRY, noXML, etc), but without the need to learn scripting languages ​​like Groovy. And of course have a great documentation and community.
Take a look at Grails which follows the paradigms of Ruby on Rails.
You can take a look to Play Framework it follow MVC and RESTful architectures.
Maybe too late, but have looked at Spring Roo?
This question is a bit old, but this information may still be useful for people looking for a good java framework:
Try ninja framework (http://www.ninjaframework.org). I have tried various java web frameworks and this one was by far the easiest to setup and use. Just follow the tutorial on their page.
Developing with it is very easy, ninja web projects are standard Maven projects so you can open them with any ide that supports Maven. For example, you can open the project with Netbeans, and have the development server running in a commandprompt/terminal window. Any time you save your changes the development server will pickup your changes and restart very quickly.
Or you can use a standard text editor if you want.
Very comfortable to develop with. You can also debug very easily from Netbeans (http://www.ninjaframework.org/documentation/debugging.html)
Note: if you use an ide like netbeans, you dont actually run the project from netbeans, you just edit your changes on the ide and save. The development server picks up the changes automatically.
I think Stripes is what you are after.
http://www.stripesframework.org/display/stripes/Home
You can also take a look at Java on Rails
http://www.javaonrails.net/

How to test the performance of a java application?

I've created a stand alone java desktop application using Netbeans. I want a way to test the performance of my application. I need some tool with the help of which my application can be evaluated. I heard about Software metrics, is this related to my context. Or is there any tool or plugin available in Netbeans through which I can test.
Have a look at the Netbeans Profiler:
http://netbeans.org/features/java/profiler.html
Netbeans has one of the best profilers going for Java apps, it runs well and provides as much detail as you want. Since you're using Netbeans I'd take advantage of it!
In terms of tutorials, there's one here about memory leaks and how to debug / discover them using the profiler. Once you get going with it the other features should come pretty easily.

Open source projects with Java and Scala interaction

I'm going to give a talk about using Java and Scala together and I want to investigate some projects (large and small) which contains Java and Scala code.
If you know links to correspondent projects post them here.
This page on the Scala wiki is a good starting point...
The various scala testing frameworks come to mind. They all have some integration with JUnit or TestNG
Gimd is one example of small project: http://code.google.com/p/gimd/
Although development stalled for a while because I'm busy with other duties it already contains some examples of Scala<->Java integration. Notably:
unit tests are written using junit
Gimd is using JGit (library in Java) as underlying layer
While working on Gimd I found that using Java from Scala is mostly easy and seamless the contrary is not always true. It's not really a fault of Scala as it's simple manifestation that Java is a less expressive language.
Unfortunately I don't know any open source project but I have worked on very large projects over the last few years that have java and scala interacting and my experience has been mostly very positive. If I had one piece of advice it would be to use scala-javautils. It's a life saver and is far better than the scala jcl code. Before we started using it trying to get some interactions involving collections was heart-breaking. However I'm led to believe 2.8 will solve this.
In general I find the interactions between scala and java very close to using one language.

Playframework and Django

I have worked with Django before and have recently seen the Play framework.
Is this the Java community's answer to Django? Any experiences with it? Any performance comparisons with other Java web frameworks?
Edit:Almost similar to this question, the responses, unfortunately don't say much about the framework.
Play! is a breath of fresh air into Java and bypasses all the Enterprise cruft that has evolved over the years. Even the namespace is just play not com.playframework. It is supposed to be an answer to Rails, Django etc and is MVC based. It is needed for Java to stay relevant in all but deep entrenched enterprise shops.
Play! reduces the overabstraction and painful configuration of old Java. It is a complete stack it does not rely or play to the old Servlet/EJB methodology like Restlet tried to do (making REST easier in Servlets). Play! is a great REST based Java framework that is a valid contender to other platforms MVC frameworks.
It is very RESTful and it is easy to bind a parameter to a java method. They have also made JPA much easier to use through their play namespace.
play.db.jpa.Model
public void messages(int page) {
User connectedUser = User.find("byEmail", connected());
List<Message> messages = Message.find(
"user = ? and read = false order by date desc",
connectedUser
).from(page * 10).fetch(10);
render(connectedUser, messages);
}
Python is used for scripting instead of builds with Maven which might save a few lives.
I haven't been this excited about a Java framework since Red5 or Restlet. A bonus is they have easy ways to get your app up on Google AppEngine as well using the Java version of GAE.
I have been using Play! now for a few months and in fact have come to love the framework. I struggled with Rails and Django a bit, mostly because I am really not a fan of dynamically-typed languages; however, there was never a really good web development framework for Java to compete with these. In terms of productivity, Rails and Django were the leaders for the MVC arms race that was going on. Play! is awesome, it's concise, scalable, powerful, and it has a great community that is growing all the time. If you're still really into using a language like a Python or Ruby, you can use Play! with Scala too. I am really trying to get into Scala right now because I think it has a great future and it's a lot of fun to use. Anyway, I would recommend giving it a try!
The Play! framework is a really good piece of software, and that the JavaEE bloated environment should be inspired from.
I moved from Java -> Django because of the fast cycle "modify file" / "reload browser", and the Play! framework makes me came back to my favorite Java language.
It could also be compared in some terms to what Grails and in general dynamic languages in Java (Groovy is used in Play!) are trying to import: simplicity, speed and reliability.
I am also a Django user. I've just visited the Play framework and skim thorugh its documentation. It has the simplistic design Django has been known of. It even has app engine support built-in. I'm sure many java developers will support it, and it only need some time to see cool plugins from the community.
We recently started using Play for building a webservice for various mobile applications. I come from a Java environment. I can tell you that the learning curve isn't all that steep--literally in an hour I had the webservice running with basic API already. One week later we were on Amazon Web Services. I definitely see a future for Play as it simplifies web development for Java developers.
Couple of things that I noticed however (asset versioning, etc.) still are not built into the framework, but i'm sure they'll be there in time. I would say it is definitely worth a shot using Play.
I come from a very strong java background. So my answer here could be a little biased.
Play finally brings to the java community what django has been for all these years in the python community, but just a way better.
Play is built on the jvm therefore inheritance all the goodies from a solid platform that has been proving over the years to be the most reliable and scalable one that allows to write and run applications at scale.
I want to say that I did try django. Its popularity among the web community made me curios and I wanted to give it a try.
Strangely I did not find it as easy to use as I had expected.
So many configurations. Too may libraries doing the same thing and often not play very well with each other. A way too much magic.
Furthermore, not having type safety makes very hard to manage and maintain
web application at big scale.
Don't get me wrong, I am pretty sure that people managed to do it, but in my experience I still find java/scala best suited for this, especially when you share the code base with a lot of other developers.
IDE support for Java it is unbeatable. If you implement TDD you will find yourself refactoring code and moving things around on the daily basis. And java IDEs give you all this power. With type safety and more.
My take away is that as long as you find yourself writing a simple CRUD application/prototype/toy without even thinking too much of advanced features and big scale then you can probably find some advantages on using python/django. Otherwise the whole java ecosystem wins hands down. And play is the cherry on top.

Is JRuby ready for production?

I just found out about JRuby, and I like the idea of running Ruby on Rails and being able to call Java libraries.
I would like to know about some experiences with running enterprise production applications in JRuby. Are stability and performance acceptable?
Thanks.
Here is a blog post from a company that created a cross-platform, multithreaded, desktop simulation application with JRuby. I think their success indicates JRuby is ready for enterprise production applications.
http://spin.atomicobject.com/2009/01/30/ruby-for-desktop-applications-yes-we-can
Actually it's pretty fast too. I'm not sure how they all compare now, but with the new dynamic invoke bytecode added to the JVM, it should become by far the fastest implementation available.
Groovy and Grails should also get a big speed boost from this pretty soon.
We're using it at our company on a large project. The major problem we find is that there isn't as large of a community built around the technology as say Java or .Net. Which makes recruiting difficult.
JRuby is among the fastest Ruby implementations right now and definitely production ready.
Here's some "success stories" from jruby.org:
http://wiki.jruby.org/wiki/Success_Stories
Jason Seifer says yes. His presentation on Ruby VM's is on InfoQ.
A look at the different Ruby virtual machines (JRuby, MagLev, IronRuby, Rubinius, MacRuby) and how to choose what fits best within the enterprise.
http://www.infoq.com/presentations/seifer-ruby-vm-comparison
The JRuby Wiki has moved to Kenai. The success stories page can be found here now:
http://kenai.com/projects/jruby/pages/SuccessStories

Categories