Skip to content

Test Suites

Thijs Kok edited this page Dec 9, 2021 · 1 revision

A test suite allows you to categorize test cases in such a way that they match your planning and analysis needs.

In order to work with test suites, make sure you have created a project first.

Get a list of test suites

To get a list of test suites, use the list method:

Project project = client.projects().get(1);
ArrayList<TestSuite> testSuite = client.testSuites(project).list();

This will get a paginated list of test suites for project ID 1.

Pagination

You can request a different page and change the record limit simply by passing them as arguments:

Project project = client.projects().get(1);
ArrayList<TestSuite> testSuite = client.testSuites(project).list(4, 10);

This will retrieve the fourth page using a list of 10 records, i.e., records 31 through 40.

Get a single test suite

To get a single test suite, use the get method, which takes a test suite ID as parameter:

Project project = client.projects().get(1);
TestSuite testSuite = client.testSuites(project).get(1);

You can access its properties by using its getters:

Project project = client.projects().get(1);
TestSuite testSuite = client.testSuites(project).get(1);

System.out.println(testSuite.getId());
System.out.println(testSuite.getName());

This will output the test suite ID and name.

Create a test suite

You can create a new test suite by using the create method and specifying its name as a parameter.

TestSuite testSuite = client.testSuites(project).create("A Test Suite"));

The client provides a convenient findOrCreate method. This will try to find a test suite matching the given name first - otherwise, it will be created.

Project project = client.projects().get(1);
TestSuite testSuite = client.testSuites(project).findOrCreate("A Test Suite"));

This will look for a test suite named "A Test Suite"; when it's present, it will return this test suite as an object. Otherwise, it will create a new test suite using that name and return it as an object.

Updating a test suite

Updating a test suite is just a matter of using the setters and the update method:

Project project = client.projects().get(1);
TestSuite testSuite = client.testSuites(project).get(1);

testSuite.setName("A New Name");

client.testSuites(project).update(testSuite);

Clone this wiki locally