Discussions

News: Why Groovy has made my life easier

  1. Why Groovy has made my life easier (1 messages)

    Groovy is an object-oriented programming language for the Java platform and can be used as a scripting language. Most of us but instead of using Groovy alone, we use Grails (web framework based on Groovy) for developing web applications.

    But Groovy can be used standalone for developing your internal tools. Let me explain why Groovyscripts have simplified our development of tools for generating data for integration tests.

    In my company we create clinical instruments. These instruments are so expensive, and big enough to say that they are not portable. For these reasons each instrument has an emulator, so integration tests are run without having physically any instrument.

    Our emulator has an XML file where all required resources for running tests are configured. In summary each file contains a list of blood barcodes, and reagent barcodes. In our case barcodes have a meaning (kind of resource, expiry date, checksum, ...).

    So one can think about creating a standard configuration file that is used in integration tests. It is a good idea if you don't know that expiry date is expressed in months. So one day without knowing exactly why your tests begin to fail. The answer is obvious, resources have become expired. We need a (script ?) that updates this XML file so when a resource is becoming expired, its month field is changed.

    Continue Reading Post

     

     

    Threaded Messages (1)

  2. Why Java is Easy Too[ Go to top ]

    Well, you could also use jaxb and have just a couple of lines of java code, with classes representing your xml with all advantages (strong typing, code completion, ...).

    There are many alternatives to parse xml in java, DocumentBuilder is only a possibility. Have a look at jdom (non-standard but widely used), for example.