Beispiel #1
0
        public static DataListFormat ExecuteTests(IDSFDataObject dataObject, IPrincipal userPrinciple, Guid workspaceGuid, Dev2JsonSerializer serializer, ITestCatalog testCatalog, IResourceCatalog resourceCatalog, out string executePayload, ITestCoverageCatalog testCoverageCatalog)
        {
            executePayload = null;

            DataListFormat formatter = null;

            if (dataObject.TestsResourceIds?.Any() ?? false)
            {
                if (dataObject.ReturnType == EmitionTypes.TEST)
                {
                    formatter = dataObject.RunMultipleTestBatchesAndReturnJSON(userPrinciple, workspaceGuid, serializer, resourceCatalog, testCatalog, out executePayload, testCoverageCatalog);
                }
                if (dataObject.ReturnType == EmitionTypes.TRX)
                {
                    formatter = dataObject.RunMultipleTestBatchesAndReturnTRX(userPrinciple, workspaceGuid, serializer, resourceCatalog, testCatalog, out executePayload, testCoverageCatalog);
                }
                dataObject.ResourceID = Guid.Empty;
            }
            else
            {
                Dev2.Common.Dev2Logger.Warn("No tests found to execute for requested resource", Dev2.Common.GlobalConstants.WarewolfWarn);
            }

            Dev2DataListDecisionHandler.Instance.RemoveEnvironment(dataObject.DataListID);
            dataObject.Environment = null;
            return(formatter ?? DataListFormat.CreateFormat("XML", EmitionTypes.XML, "text/xml"));
        }
Beispiel #2
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);
        }