Useful External Libraries for Plug-In Development

In this forum thread, we will collect the external libraries that people have found useful in development of ZebraTester plug-ins. A great advantage of having Java available as a language for writing plug-ins is that it is possible to leverage the extraordinary variety of Java libraries already written to avoid having to “reinvent the wheel”. By doing so, it is usually possible to solve most tasks with just a few lines of plug-in specific code.

The library that I find myself using more than anything is Jsoup. Jsoup is a powerful HTML parser, and the feature that I find particularly useful is the ability to extract elements using CSS selectors. For an example of how this can be done, there is an extended example available at “Extending ZebraTester with Plug-ins”.

For working with JSON, I can recommend two libraries. The first is that is gson. This library can serialize/de-serialize JSON to/from Java objects, and is useful if you need to write some more complex transformation of JSON input. A good tutorial on gson can be found here. In cases you just need to extract some particular attribute, a more lightweight alternative is org.json.

Before considering using external libraries for extracting from JSON responses, please also first check whether the built-in JSON extraction capabilities in ZebraTester will fullfil your needs.

If you have any libraries you find yourself using for plug-in development, please feel free to share in this thread!

List

  • Jsoup - library for parsing HTML

  • gson - library for serializing/de-serializing JSON

  • org.json - simple JSON parser

1 Like

I’ve found another JSON library that has proved to be very useful, Boon. When it parses the JSON it turns it to a table structure close to that of an actual database. It also allows you to get content from this map structure using ‘SQL-esque’ queries.

Cool, got any snippets where this is used?