Join 34,000+ subscribers and receive articles from our blog about software quality, testing, QA and security.
 

TestRail Groovy Client with intuitive DSL


#1

Hi,

I have created a Groovy client for the TestRail API and like to share it, in case someone finds it interesting and/or useful.

The repo is here: https://github.com/dbac2002/testrail-groovy-client and it is work in progress.

The idea is to provide an intuitive DSL for accessing the TestRail API.

With the client, one can create something like the following:

connect '<server_url>'
login '<user>', '<password_or_key>'

// prints the name of user with id 7
show('name') of user(7) 

// prints the title of test with id 590
show('title') of test(590)

// prints the id of the test case in project 11, suite 14 and section 122
show('id') of testcases(project(11), suite(14), section(122)) 

// print the name of completed milestones in project with id 7
show('name') of milestones(project(7), 'completed')

// get the user with id 7
def user7 = get user(7)

// get the test case with id 308
def testcase308 = get testcase(308) 

Currently the client only supports GET requests, POST is coming in the next days. Also not all request filters are currently implemented, this will also follow.

Feel free to use it, work it, create pull requests etc.

Cheers
Andreas


#2

Hello Andreas,

Thanks for your posting and sharing this, this looks great!

Cheers,
Tobias


#3

Extended/Changed the library and now deletion and updating is included, as also more complex queries like

// get all tests of user 1 in run 13 - print out title, id and status_id
 def aT = get tests() of user(1), run(13) with 'title', 'id', 'status_id'
 println aT

// get all passed tests of user 1 in run 13 - print out title, id, status_id 
def pT = get tests('passed') of user(1), run(13) with 'title', 'id', 'status_id'
println pT

// get the progress of run 13 (all counts) - print out passed_percentage and passed_count
// passed_percentage is a custom field, not part of the original TestRail api
def pr = get progress() of run(13) with 'passed_percentage', 'passed_count'
println pr

The syntax for get requests have changed - see readme file in the project


#4

Thanks, Andreas!

Cheers,
Tobias