!define TEST_SYSTEM {fit:A} part II 26

Posted by Brett Schuchert Wed, 04 Mar 2009 10:07:00 GMT

In 11/2008 I wrote the first part of this article but I really did not give the background on why I originally asked Bob to add this feature.

So why does FitNesse need to be able to run different parts of suites in different VM’s?

Imagine you are testing services registered on an ESB. That ESB allows deployment of services as EJB’s. There’s something important about that fact. By default, different EJB’s run with their own class loader. You can dig into the EJB spec if you’d like, but there’s roughly a hierarchy of 5 class loaders by the time you get to an executing EJB (can be more, could be less).

Why is this important? If two EJB’s make reference to the “same” JAR file, then each could get loaded by the same or a different class loader. If the JAR file is installed high in the class-loader hierarchy, then they will be loaded by the same class loader instance and therefore will be the same classes.

However, let’s assume that each EJB represents ones service. Furthermore, each EJB makes a reference to some JAR file directly, that is, it is not visible to a hierarchically higher class loader. Then that same JAR file will get loaded twice, once by each class loader (this really happens), and those exact same classes will be considered different.

That’s right, the exact same JAR file loaded by 2 different class loaders are treated as unrelated classes.

In reality, each deployed EJB is “complete” in that in includes the JAR’s it needs to execute. So the “same” jar – same in terms of file contents – exists twice in the system and is loaded by two class loaders.

Now, it gets a little worse. Those two EJB’s work off a “common” data model. Common in that the underlying business objects are common across a set of applications. However, the common data model is a moving target (it’s grown as needed). To manage complexity, not all services are forced to update to the latest version of the common data model at the same time (it’s not really a manageable solution – generally).

So now we have 2 (really several) EJB’s that refer to logically the same JAR but different versions. Luckily, this is no problem because each EJB has its own class loader, so it is OK for 2 EJB’s to refer to different versions of the same logical data model.

How does any of this have anything to do with FitNesse? When FitNesse executes a suite, by default all tests are executed in the same VM with one class loader. So if you have a suite of tests that test different services, each of which might be using a different version of the common data model, then the first service executed loads the common data model, which really isn’t exactly common. This causes tests to fail that would not fail if each text executed with its own class loader.

Rather than deal with writing custom class loaders, Bob instead make it possible to name a VM (see the title for the syntax). By doing this, Bob make it possible to effect a similar environment to that experienced by EJB’s by default.

Comments

Leave a response

  1. Avatar
    Johannes Brodwall about 13 hours later:

    Do you think you might be yak shaving?

    Is FitNesse the right tool to test at the EJB level? (I would use FitNesse for functional testing, not integration testing) Is it a good idea to use a shared but unstable data model? (You have hinted it is not) Should two services that are this separate use the same FitNesse instance? Is the ESB causing more problems than it is solving?

  2. Avatar
    Brett L. Schuchert about 16 hours later:

    Is the ESB yak shaving? Yes. In this particular case, they were mandated to buy versus build and already had purchased a stack.

    Given that constraint, they needed a means to execute suites of tests across components.

  3. Avatar
    Johannes Brodwall about 19 hours later:

    I’m getting flashbacks from a talk I gave a few years ago titled “why I hate SOA.” ;-)

  4. Avatar
    Brett L. Schuchert about 19 hours later:

    I heard that!

  5. Avatar
    mmorpg 3 days later:

    much more efficient than writing custom class loaders.

  6. Avatar
    Pandora about 1 year later:

    but that all attempts to improve quality would be short lived and followed by a larger drive to decrease quality even further.

  7. Avatar
    http://www.whiteiphone4transformer.com about 1 year later:

    I just can’s believe how surprise when i receive my iphone 4. Its so charming and functional! But there’s one thing i don’t satisfy, i don’t like the color. Waiting for the coming white iphone 4 conversion kit.

  8. Avatar
    mosic about 1 year later:
  9. Avatar
    Sell Gold for Cash about 1 year later:

    Thanks for sharing this great post Brett! Just had a look at that first article too (excellent analysis in this follow up posting). Cheers.

  10. Avatar
    iPhone SMS to Mac Backup about 1 year later:

    Thanks for shareing! I agree with you. The artical improve me so much! I will come here frequently. Would you like to banckup iphone SMS to mac, macBook, macbookPro as .txt files? Now a software iphone SMS to Mac Backup can help you to realize it.

  11. Avatar
    iPad ePub Transfer for Mac about 1 year later:

    I really like this essay. Thank you for writing it so seriously. I want to recommend it for my friends strongly. iPad ePub Transfer for Mac is a Professional transfer that can transfer the ePub books onto your iPad on Mac and export the iPad ePub to Mac local folder.

  12. Avatar
    SLA prototype about 1 year later:

    @Johannes Brodwall Haha Yes- SOA is an easy thing to hate, it is also hard to read about.

  13. Avatar
    okey oyunu oyna over 2 years later:

    good work.

    internette görüntülü olarak okey oyunu oyna, gerçek kisilerle tanis, turnuva heyecanini yasa.

  14. Avatar
    funny pictures over 2 years later:

    You explain TEST_SYSTEM in a very efficient and unqiue way I must appreciate this post

  15. Avatar
    christian louboutin shoes on sale over 2 years later:

    Have the christian louboutin patent leather pumps is a happy thing. Here have the most complete kinds of christian louboutin leather platform pumps.

  16. Avatar
    cookies gift baskets over 2 years later:

    hmm ,i’m not sure if this is what i’m looking for but anyway this is interresting and could be useful some day,thanks for taking time to write such cool stuff

  17. Avatar
    beats by dre store over 2 years later:

    useful some day,thanks for taking time to write such cool stuffbeats by dre sale cheap beats by dre

  18. Avatar
    canada goose coat over 3 years later:

    Canada Goose Outlet is Marmot 8000M Parka. The Marmot 8000M Parka is really a waterproof, breathable jacket with 800 fill canada goose jacket feathers. It truly is design and light colored shell is produced for trendy, but uncomplicated, protection from cold temperatures. Reinforced shoulders, elbows and adjustable waist and hem make the Marmot a perfect alternate for skiing and other outdoor sports that want fairly a bit of arm motion. The 8000M Parka weighs three lbs., comes in bonfire and black colours and might be stuffed and stored like a sleeping bag to your convenience.This is one of well-know and prime down jacket brands.Hope our friends like its!Like canada goose womens and Canada Goose Expedition Parka.There are wholesale canada goose.

  19. Avatar
    Tips For Bowling over 3 years later:

    A man should look for what is, and not for what he thinks should be.

  20. Avatar
    christian louboutin over 3 years later:

    The professional design make you foot more comfortable. Even more tantalizing,this pattern make your legs look as long as you can,it will make you looked more attractive.Moveover,it has reasonable price.If you are a popular woman,do not miss it.

    Technical details of Christian Louboutin Velours Scrunch Suede Boots Coffee:

    Color: Coffee
    Material: Suede
    4(100mm) heel
    Signature red sole x

    Fashion, delicate, luxurious Christian louboutins shoes on sale, one of its series is Christian Louboutin Tall Boots, is urbanism collocation. This Christian louboutins shoes design makes people new and refreshing. Red soles shoes is personality, your charm will be wonderful performance.

  21. Avatar
    christian louboutin over 3 years later:

    The professional design make you foot more comfortable. Even more tantalizing,this pattern make your legs look as long as you can,it will make you looked more attractive.Moveover,it has reasonable price.If you are a popular woman,do not miss it.

    Technical details of Christian Louboutin Velours Scrunch Suede Boots Coffee:

    Color: Coffee
    Material: Suede
    4(100mm) heel
    Signature red sole x

    Fashion, delicate, luxurious Christian louboutins shoes on sale, one of its series is Christian Louboutin Tall Boots, is urbanism collocation. This Christian louboutins shoes design makes people new and refreshing. Red soles shoes is personality, your charm will be wonderful performance.

  22. Avatar
    iPhone contacts backup over 3 years later:

    Get to know about C# and C++. In fact, I find there is no much difference between the two. However, If we want to do much better. I need work hard.

  23. Avatar
    Monster beats dre over 3 years later:

    Monster beats dre shop preferential DaChouBin! Monster Butterfly, Monster Butterfly,Monster diddy beats ~ ~ ~ all discount in progress!

  24. Avatar
    longchamp outlet online over 3 years later:

    sdassdasdadsadsasda

  25. Avatar
    birkin hermes over 3 years later:

    Handbags will forever be the ultimate fashion accessory for women of all ages?

  26. Avatar
    cosplay outfits costumes over 3 years later:

    http://www.outfitscosplay.com/cosplay-catalog/07-ghost-cosplay Deluxe 07-Ghost Cosplay Costumes for Sale.Find your favorite characters and cosplay outfits from all the popular anime and games.

Comments