I'm trying to get some information from an Azure DevOps server on premise. However, the following code only return 10 tests. How to get the test runs for a month?
$Api = "http://azuredepopsserver/tfs/Default/MyProject/_apis"
$testUrl = "$Api/test/runs?api-version=5.1&`$top=100"
$tests = Invoke-RestMethod $testUrl -UseDefaultCredentials
$tests
BTW, how to get the test cases counts?
I tried the following code from the answer of Levi,
$WorkItemType = "Test Case"
$WIQL_query = "Select [System.Id], [System.Title], [System.State] From WorkItems Where [System.WorkItemType] = '$WorkItemType'"
$body = @{ query = $WIQL_query }
$bodyJson = @($body) | ConvertTo-Json
Invoke-RestMethod -Uri "$($Api)?api-version=5.1-preview" -Method Post -ContentType "application/json" -Body $bodyJson -UseDefaultCredentials
But it got the error of
Invoke-RestMethod : {"$id":"1","innerException":null,"message":"Value cannot be null.\r\nParameter name: Configuration","typeName":"System.ArgumentNullException, mscorlib","typeKey":"ArgumentNullException","errorCode":0,"eventId":0}