Quick start

Creating the Polarion client:

from polarion.polarion import Polarion
client = Polarion('http://example.com/polarion', 'user', 'password')

Opening a project using the project name:

project = client.getProject('Python')

Load a workitem:

workitem = project.getWorkitem('PYTH-510')

Modify a workitem:

x = workitem.getVailableActions() # x will be an array of actions
workitem.preformAction(x[1])

or:

x = workitem.getVailableStatus() #this forces the new state ignoring any rules set in Polarion
workitem.setStatus(x[1])

or:

workitem.setDescription('Some description..')
workitem.addComment('test comment', 'sent from Python')
workitem.addHyperlink('google.com', workitem.HyperlinkRoles.EXTERNAL_REF)

Getting options for this type of workitem:

workitem.getResolutionEnum() # these return an empty array of no workitem specific options are set
workitem.getSeverityEnum()
workitem.getStatusEnum()

You can modify any property and call the save method. Some require a certain structure, which methods like setDescription handle for you, not adhering to it will cause an exception.

Load a test run:

run = project.getTestRun('SWQ-0001')

or

runs = project.searchTestRuns('SWQ*') #this is a query and will work the same as in Polarion

Modifying a test record:

run = project.getTestRun('SWQ-0001')
run.records[0].setResult(record.Record.ResultType.PASSED, ' Comment with test result')