-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Results#add(int, List<Result>, List<ResultField>) leads to HTTP 400: "Field :results.test_id is a required field." #43
Comments
I'm curious, how are you calling the |
@davidbrazilparker Thanks for your response David. First, I've declared the factory method which produces a fun newResult(test: Test,
status: Status? = null,
assignedtoId: UserId? = null,
comment: String? = "Case [C${test.caseId}] completed with status ${status?.label}"): Result = Result().apply {
testId = test.id
caseId = test.caseId
statusId = status?.id
this.assignedtoId = assignedtoId
this.comment = comment
elapsed = "..."
defects = listOf("foo", "bar")
version = "..."
} Then, I map each runs.forEachIndexed { runIndex, run ->
val tests = run.tests
val testResults = tests.asSequence().map { test ->
newResult(test, status, user.id)
}.toList()
// This works
results.addForCases(run.id, testResults, resultFields).execute()
// This doesn't
results.add(run.id, testResults, resultFields).execute()
}
} |
First of all, Kudos for using Kotlin. It's my go to language now for developing in JVM and overall my preferred language of choice for development in general. More importantly, I think I found your issue. Currently you're receiving an error when calling:
For the following reason:
This is the method you're calling currently. Which only allows for a single result object to be passed in. The method you're trying to call is the following:
I don't think this is necessarily something wrong with your code but rather how the |
I'll look into this more when I have time. I am not sure I found the root cause definitively. |
Working on reproducing your error right now. You can check in on my progress here: https://github.com/chapeco/KotlinTestRailCodepineDebug Edit - Behavior was reproduced in the repo I shared. |
Okay so I think I know what the underlying issue of this particular behavior is. I am confident that it is a bug with how this API client sends the "list" of results. According to this post on the official Gurock forums - https://discuss.gurock.com/t/add-results-returns-an-error/2414 So for now your best bet is to do the workaround you have now as the issue needs to be fixed in this API client. |
@davidbrazilparker Thanks for your investigation David. I will take a closer look in a short while. |
Whenever I try to bulk-submit test results (via the
Results#add(int, List<Result>, List<ResultField>)
API), I get:-- most probably the
testId
field of the newly-createdResult
object is ignored.As a workaround, I currently use the
Results#addForCases()
API.TestRail version is 6.0.0.4140.
The text was updated successfully, but these errors were encountered: