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

Using custom_steps_separate with Python API


#1

Hi,

I’m using the Python API and haven’t been able to figure out how to specify the custom_steps_separated as a POST field for add/update_case. Does anyone have any examples?

Thanks,

Rob


#2

Hello Rob,

Thanks for your posting. Do you use our API binding for Python?

http://docs.gurock.com/testrail-api2/bindings-python

If so, the code for adding a case with separate steps would look as follows:

[code]result = client.send_post(
‘add_case/1/1’,
{
‘title’: ‘A test case with steps’,
‘custom_steps_separated’: [
{ ‘content’: ‘Step 1’, ‘expected’: ‘Expected 1’},
{ ‘content’: ‘Step 2’, ‘expected’: ‘Expected 2’}
]
}
)

pprint(result)[/code]

I hope this helps and please let me know in case you have any further questions!

Regards,
Tobias


#3

Hallo Tobias,

How do I get the custom steps once I added them? It appears that the normal get_case does not return them. Or is there something that I have to change in the setup (Configuring Separate Test Steps) that I need to do first? I have held off doing that because I had originally created everything with simple steps.

Vielen Dank,

Rob


#4

Never mind…I realized that I needed to enable separate steps via the administration customizations first. Oddly, submitting separate steps prior to that just silently ignores them.

Danke,

Rob


#5

Hello Rob,

Thanks for your feedback and great to hear that it works now. Yes, the API ignores any unknown fields and doesn’t return an error in this case.

Regards,
Tobias


#6

Hallo Tobias,

I have a follow-on question: In my test, when I enabled separate steps, it seemed to leave the existing custom_steps alone. So my assumption is that it’s possible to have both simple and separate steps for a TestRail environment. Is that correct?

Vielen Dank,

Rob


#7

Gerne! :slight_smile:

Yes, this is correct and you can use the standard steps field (custom_steps) and the separated steps (custom_steps_separated) at the same time. The original steps field is just another custom field of type text and you can use both fields simultaneously or only use either one of them depending on the complexity of a test case.

Regards,
Tobias