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

Elapsed field datatype - API question


#1

Hello,
In the POST for
add_result or add_result_for_case, we can pass in elapsed. What is the datatype for this field? I am trying to pass the time/duration from our automated junit reports to TestRail so that we start using TestRail’s forecasting feature.

The time field in Junit reports is a double. Example

Can I pass the the time to elapsed as is ?

Ali


#2

We add our elapsed time in as a humanized format - e.g. 31 minutes 41 seconds


#3

gmcdonald,
The API takes in the parameter value as ‘31 minutes 41 seconds’ ? Seems a bit odd


#4

Hello Ali,

Thanks for your posting. Yes, the API accepts human-readable values for the Elapsed and Estimate fields. To pass in the values as seconds, you can simply use:

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

Regards,
Tobias


#5

I am wondering how to pass in elapsed time in milliseconds?

I tried ‘518ms’ but getting {“error”:“Field :elapsed is not in a valid time span format.”}.


#6

[quote=ccy]I am wondering how to pass in elapsed time in milliseconds?

I tried ‘518ms’ but getting {“error”:“Field :elapsed is not in a valid time span format.”}.[/quote]

Convert it to seconds and submit as:

.518s

For bigger values, you can do hours (h), minutes (m), and seconds (s), like so:

2h 3m 5s


#7

.518s or 0.581s doesn’t work either. The API call returns 200, but it is just treated as 518 seconds.

{
“status_id”: 1,
“elapsed”: “.159s”
}

{
“status_id”: 1,
“elapsed”: “0.159s”
}


#8

Hello,

Thanks for your posting. There’s currently no support for milliseconds unfortunately (it’s already planned to look into this) and you would need to round it up to 1 second on your side. You can then submit this as follows:

{
    "status_id": 1,
    "elapsed": "1s"
}

Regards,
Tobias


#9

Hi

Has milliseconds been implemented yet?

Thanks


#10

Hi!

The elapsed and estimate values still use seconds as lowest unit but it’s still planned to look into millisecond support as well. I’m happy to add another vote to this feature request, thanks for your feedback!

Cheers,
Tobias


#11

Hi,

Please add another vote to millisecond support. Useful for tracking automated tests.

Thanks,
Pablo.


#12

Added to the list, thanks Pablo!

Cheers,
Tobias


#13

please another vote here… especially the automated tests would benefit from this


#14

Added, thanks!

Cheers,
Tobias


#15

This feature is very glitchy…
If I put a timespan into the system ‘0.0136s’ or ‘.0136s’, both of them are processed by the system as 2m 16s.
This does not help.

Better than processing what we pass in, simply take it as a string literal.
We may be reporting information that is only valid to my own organization.


#16

Hello David,

Thanks for your feedback! The elapsed/estimate (timespan) fields currently have a minimum value of one second so we would recommend rounding your timespan values to the nearest second. Storing this in a structured format instead of a simple string has many advantages and allows TestRail to calculate estimates and forecasts based on previous test times, for example:

http://docs.gurock.com/testrail-userguide/userguide-gettingstarted#tracking_progress_and_activity

If this is not important for you (e.g. for automated tests), you can also look into adding a separate custom field for this (of type string) and this would not change/interpret the value in any way:

http://docs.gurock.com/testrail-userguide/howto-fields

I hope this helps!

Cheers,
Tobias


#17

Hi Tobias,

Thanks for the response. I’ve changed my results to whole integers and that appears to work just fine. Thanks!


#18

That’s great to hear, David, and thanks for your feedback!

Cheers,
Tobias


#19

Hi,

Please add another vote for me to get millisecond support. It would really help to measure performance of our automation.

Thanks


#20

Added to the list, thanks Maxime :slight_smile:

Cheers,
Tobias