Ejemplo n.º 1
0
        public static DataListFormat ExecuteTests(string serviceName, IDSFDataObject dataObject, DataListFormat formatter,
                                                  IPrincipal userPrinciple, Guid workspaceGuid, Dev2JsonSerializer serializer, ITestCatalog testCatalog, IResourceCatalog resourceCatalog, ref string executePayload)
        {
            if (dataObject.TestsResourceIds?.Any() ?? false)
            {
                if (dataObject.ReturnType == Web.EmitionTypes.TEST)
                {
                    formatter = dataObject.RunMultipleTestBatchesAndReturnJSON(userPrinciple, workspaceGuid, serializer, formatter,
                                                                               resourceCatalog, testCatalog, ref executePayload);
                }
                if (dataObject.ReturnType == Web.EmitionTypes.TRX)
                {
                    formatter = dataObject.RunMultipleTestBatchesAndReturnTRX(userPrinciple, workspaceGuid, serializer, formatter,
                                                                              resourceCatalog, testCatalog, ref executePayload);
                }
                dataObject.ResourceID = Guid.Empty;
            }
            else
            {
                if (dataObject.ReturnType == EmitionTypes.TEST)
                {
                    formatter = dataObject.RunSingleTestBatchAndReturnJSON(userPrinciple, workspaceGuid, serializer, formatter,
                                                                           serviceName, testCatalog, ref executePayload);
                }
                if (dataObject.ReturnType == Web.EmitionTypes.TRX)
                {
                    formatter = dataObject.RunSingleTestBatchAndReturnTRX(userPrinciple, workspaceGuid, serializer, formatter,
                                                                          serviceName, testCatalog, ref executePayload);
                }
            }

            Dev2DataListDecisionHandler.Instance.RemoveEnvironment(dataObject.DataListID);
            dataObject.Environment = null;
            return(formatter);
        }