Watij WebSpec is born!!

This post has been a long time coming. Brian and I started Watij a bit over 5years ago and from the start we envisioned a lightweight application testing framework written in java that would allow folks to automate their web applications. We have learned a ton and since have written other frameworks and continued in our quest for making testing easier.

After partnering with TeamDev, Watij became an opensource project built on top of a commercial product. It was great news for us and for Watij. At some point (maybe two years ago) we heard about a new product that TeamDev was planning….JxBrowser. The initial idea was that it would be a similar component to what we were using for ie support. TeamDev changed directions and boy was it a great opportunity for us to grow our relationship with them. JxBrowser was to become a multiplatform multibrowser swing component. We quickly saw the potential for Watij and began to discuss what it would mean for Watij to be multibrowser capable…..we felt change was needed.

We saw some problems with our existing approach. Unfortunately we were abstract happy…we had too many interfaces and too much inheritance that made following the Watij code a bit cumbersome. I will say that it was very modular and was written well…I just think it was “too much abstraction”. We abstracted before we had a need. We didnt have multibrower support, but were coding as if we had. We also noticed that ie specific code began to creep into watij core. So we wanted to rethink everything…. Based on our learnings over the past 5 years we wanted to make Watij lighter, faster, leaner, and meaner.

Yes that is scary…scary for you and us as well. We are taking a small gamble here and have completely rewritten Watij and are reintroducing it as WebSpec. This has some very large implications for you. The next version of Watij is NOT backwards compatible. If you know me you know that I subscribe to the belief that you should never see Watij code in a test case. You should a dsl for your application where the dsl implementation uses Watij. If you followed this pattern, you will change your dsls implementation and be done. If you have not taken that approach and your test cases are tightly coupled to the current Watij api…you have some work to do!

We have dropped the implementations of every html element as concrete classes and have opted for a much smaller api built around accessing and manipulating webpages using javascript. In a nutshell, when you make calls in watij, they will be proxied through to the JxBrowser component. This gives us immediate support for Safari, even though DOM is not supported for Safari on JxBrowser. We have also taken the approach of providing a more fluent interface for using watij.

What happens now??? Well, that is a great question. We would first like to get some feedback. So checkout trunk and take a look at the watix directory. There is a run.sh that will kick off a sample test. Of course we will need to create new documetation, usage guides, the whole nine.

So thats it for now…I’m sure in the coming days/weeks we will have some healthy debate over WebSpec.. :)

Happy Testing!

19 Responses to “Watij WebSpec is born!!”

  1. Jake Dempsey Says:

    Just to be clear..the name Watij is not going away. Its just now we have WebSpec which is the library for automating the web. We have a couple of new ideas for other products that would fit under the “Watij” brand.

  2. Darrell Grainger Says:

    This could not have come at a better time for me. I am between jobs and will take the time to try out the new Watij WebSpec. Should we be using the Google group, http://groups.google.com/group/watij, or will you be creating a new group, e.g. http://groups.google.com/group/webspec, if we want to post comments and questions.

    I’ll definitely be willing to try it out with:

    - Windows XP/IE8
    - Windows XP/Firefox
    - Windows XP/Safari
    - Windows XP/Chrome
    - Mac OS X/Firefox
    - Mac OS X/Chrome
    - Mac OS X/Safari

    I’d even consider setting up a Linux environment for it.

  3. Darrell Grainger Says:

    I tried opening the SVN repository noted in the Build Instructions area and it failed to open in Eclipse with subclipse. If I use https://watij.svn.sourceforge.net/svnroot/watij it opens okay. Is the trunk branch the WebSpec code? Or is the watix? I’m checking out the watix code right now.

  4. Jake Dempsey Says:

    Darrell, that is great news. We wont be creating a new group…at least that was not my intention. Watij Webspec is the future of Watij. We may just need to refer to WebSpec specifically in our google group for now until until we sunset the current Watij implementation. If we find there is confusion in the group, we can discuss other options. Welcome back to Watij! :)

  5. Jake Dempsey Says:

    Its the watix dir

  6. Tweets that mention Watij » Blog Archive » Watij WebSpec is born!! -- Topsy.com Says:

    [...] This post was mentioned on Twitter by Knorr Kuhn, Željko Filipin. Željko Filipin said: Watij WebSpec is born!! http://bit.ly/aJhgN0 #watir [...]

  7. Darrell Grainger Says:

    Thanks Jake. Checked out watix.

  8. Darrell Grainger Says:

    Found a new job and I’m free for the next week to try out WebSpec. I created a project and checked out the trunk from the svn repository noted above. I realized the code requires Java 6 (there is an isEmpty call for String which didn’t exist in Java 5). Additionally, I added the all the files in the watix/lib directory to the build path. These two changes (Java 6 instead of Java 5 and adding all the watix/lib/*.jar files) eliminated all the errors in building the project but I’m still seeing 15 warnings. Things like:

    ArrayList is a raw type. References to generic type ArrayList should be parameterized, Spec.java, /watix/src/org/watij/webspec/dsl, line 203

    Is this normal? Do you need to clean up some of the warnings still?

    Finally, I tried running watix/src/org/watij/webspec/Test.java and got:

    Exception in thread “main” java.lang.ExceptionInInitializerError
    at org.watij.webspec.dsl.Spec.mozilla(Spec.java:109)
    at org.watij.webspec.Test.main(Test.java:14)
    Caused by: java.lang.RuntimeException: JxBrowser license check failed: No valid license found.

    Do I need to configure something so it can find the license?

  9. Brian Knorr Says:

    Please don’t worry too much about the warnings…we will clean those up. Also please add -d32 to your vm args…this is required by jxbrowser.

    Thanks!

    -Brian

  10. mbt shoes Says:

    Great article Thank

    you so much!

  11. Deangelo Korte Says:

    I did like the article very much, really was helpful and you know what was that precisely the required aspect was elaborated,to the point short information often facilitates and preserves readers running around searching for the data would not require a read again.

  12. Andrzej Says:

    Hi

    Is there a support for frames in web spec? Something like selectFrame method in selenium? Also does webspec run a real browser when it is testing?

    Thanks
    Andrzej

  13. Jake Dempsey Says:

    If you get the latest you will find support for iframes. From our own tests:

    tag(“iframe”).tag(“title”).shouldHave(“I am an iframe”);

  14. Jake Dempsey Says:

    And yes…webspec uses the real browser embedded in a JFrame. Also webspec supports a regular html frame in addition to iframes. For example to select a frame by name:

    Java:
    Tag myFrame = tag(“frame”).with(“name==’my_frame’”);

    JRuby:
    my_frame = frame.name ‘my_frame’

  15. Andrzej Says:

    Thanks for that Jake, but are you sure it is working. I run your example first on my page then on yours and in both cases it failed, at least on Safari Mac. I get:
    “TAG iframe.play invoke on target = org.watij.webspec.dsl.Tag@4486de method = tag params = [iframe]” all the time.
    I obviously tried that on new source code. Also, I heard that popup windows are supported, can you tell how. Is there a method like selectWindow or something.

    Thanks

  16. Bruce Says:

    Hi

    Is there a support for frames in web spec? Something like selectFrame method in selenium? Also does webspec run a real browser when it is testing?

    Thanks
    Andrzej

  17. Bruce Says:

    Please don’t worry too much about the warnings…we will clean those up. Also please add -d32 to your vm args…this is required by jxbrowser.

    Thanks!

    -Brian

  18. Steve Says:

    Hi

    Is there a support for frames in web spec? Something like selectFrame method in selenium? Also does webspec run a real browser when it is testing?

    Thanks
    Andrzej

  19. Dannie Cobetto Says:

    Valuable info. Lucky me I observed your web-site by accident, I bookmarked it.

Leave a Reply