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!