Invoking Testopia XML-RPC or JSON methods using Java

Most TestLink [1] users are aware that there is an external API, maybe for the external API token being displayed in the user profile section. Today after a meeting with Peter Florijn [2], I realized that the same may not be true for Testopia [3] users.

I am quite new to Testopia, and there are many features that I haven’t used yet. But if I understand it correctly, the database is interfaced by several Perl scripts that are, by its turns, exposed as Web Service (most of them). The web services are available via a JSON and a XML-RPC API (what is very useful, TestLink supports supports only XML-RPC).

The communication between different programming languages and the external API’s is accomplished by a client API. In TestLink you have testlink-java-api [4] and testlink-api-java-client [5].

Testopia has a Java client too, available in Testopia source repository [6] and can be used to integrate your existing Java code with Testopia.

Peter and I have been working on Jenkins Testopia Plug-in [7], released few weeks ago and with its new version being released at this very moment. It’s been fun to write this new plug-in, and we are using a type of Scrum to manage the project, what makes it even more interesting.

During the project feature definition and initial structure, we created a new implementation, motivated by the following reasons (in no special order):

We haven’t released this API to Maven central yet, as we still have to polish the code, add tests and more methods. But you can already start playing with this API, the code is at GitHub, http://www.github.com/kinow/testopia-java-driver [8], and here’s a Snippet of code to get you started with the API.

TestopiaAPI api = new URL("http://localhost/bugzilla-4.2.1/xmlrpc.cgi");
api.login("root", "pass");
TestRun testCaseRun = api.getTestRun(1);
TestCase[] testCases = api.getTestCases(this.getTestRunId());
for(TestCase testCase : testCases) {
  Status status = Status.BLOCKED;
  testCase.setStatusId(status.getValue());
  api.update(testCase, testCase.getRunId(), testCase.getBuildId(), testCase.getEnvId());
}

Have fun!