microsoft / vss-web-extension-sdk

Visual Studio Teams Service Web Extension SDK
https://www.visualstudio.com/docs/integrate/extensions/overview
MIT License
133 stars 87 forks source link

getQueryTestsResults is returning Value cannot be null. ↵Parameter name: Results after updating from 1.x to 2.x #47

Open mmercan opened 7 years ago

mmercan commented 7 years ago

on version 1.102.0, I could get the the test results with getQueryTestsResults in "TFS/TestManagement/RestClient" I only replace VSS.SDK.min.js with 2.109.1and 2.117.0 start getting an error message, of Value cannot be null.↵Parameter name: Results"

My source code :

var query ="Select * from TestResult  WHERE TestCaseId IN ( 99,103,103,104 ) ORDER BY CreationDate DESC"
  var q = { query: query, fields: undefined, resultsFilter: undefined, results: undefined };
            this.testClient.getTestResultsByQuery(q, this.context.projectId).then((data) =>{
                observer.next(data);
            });

I also replaced the code with

var query ="Select * from TestResult  WHERE TestCaseId IN ( 99,103,103,104 ) ORDER BY CreationDate DESC"
  var q = { query: query };
            this.testClient.getTestResultsByQuery(q, this.context.projectId).then((data) =>{
                observer.next(data);
            });

still getting the same error message.

 VSS.require(['VSS/Service', 'TFS/Build/RestClient', 'TFS/Core/RestClient', 'TFS/TestManagement/RestClient', 'TFS/VersionControl/GitRestClient', 'TFS/VersionControl/TfvcRestClient', 'TFS/Work/RestClient', 'TFS/WorkItemTracking/RestClient', 'TFS/Dashboards/RestClient',  "ReleaseManagement/Core/RestClient"],
                    (VSS_Service, BuildRestClient, CoreRestClient, TestManagementRestClient, GitRestClient, TfvcRestClient, workRestClient, workItemTrackingClient, dashboardsApi, RM_WebApi) => {

 var testManagementClient = TestManagementRestClient.getClient();

........
});

this is how I obtain the client (as there are multiple version of the client)

whenI inspect the packages in my Browser's developer tools Version 1 is hitting: https://mrtmrcn.visualstudio.com/521cb215-8aff-4cad-8f2a-4a65ce72c454/_apis/test/Results/Query and this is where V 2.117 is hitting: https://mrtmrcn.visualstudio.com/521cb215-8aff-4cad-8f2a-4a65ce72c454/_apis/test/Results

Error I am getting in V 2.117.0 and V 2.109 .1

https://mrtmrcn.visualstudio.com/521cb215-8aff-4cad-8f2a-4a65ce72c454/_apis/test/Results $id:"1" errorCode:0 eventId:0 innerException:null message:"Value cannot be null. ↵Parameter name: Results" typeKey:"ArgumentNullException" typeName:"System.ArgumentNullException, mscorlib"

MrTarantula commented 7 years ago

This has to be a bug in the SDK. Here's the TS interface for 2.115.0, which is what I have installed:

/**
* @exemptedapi
* [Preview API]
*
* @param {Contracts.TestResultsQuery} query
* @param {string} project - Project ID or project name
* @return IPromise<Contracts.TestResultsQuery>
*/
getTestResultsByQuery(query: Contracts.TestResultsQuery, project: string): IPromise<Contracts.TestResultsQuery>;

According to the docs site the query object is a QueryModel, which makes sense. The current implementation wants you to provide a TestResultsQuery object in order to return a TestResultsQuery object. Surely this is wrong.

It is so difficult to figure out anything in this library. The documentation is out of date and there are no changelogs of any kind, just Updated to M### deployment.