QAPortalAPI: a powerful new way to ensure quality and continuity for your DataMiner projects

QAPortalAPI: a powerful new way to ensure quality and continuity for your DataMiner projects

Say hello to the QAPortalAPI, a powerful new way to manage the test results for your DataMiner projects!

The QAPortalAPI package is now publicly available at https://www.nuget.org/packages/Skyline.DataMiner.Utils.QAPortalAPI.

How does the QAPortalAPI work?

By incorporating the QAPortalAPI NuGet package into your Automation script or DIS Automation solution, you can quickly and easily collect and report on test results and performance metrics, helping you ensure continuity and quality throughout the continuous delivery process and ensure that your DataMiner solution workflows are not impacted by new development or software changes.

Additionally, by automating your tests, you can save time and reduce the likelihood of errors occurring when tests are performed manually.

How do I get started?

To get started with the DataMiner QAPortalAPI, you’ll need to obtain a portalUrl, ClientID, and API key from your Skyline Communications contact.

Once you have these credentials, you can install the package from the NuGet store, using the package manager in Visual Studio or another compatible IDE.

The QAPortalAPI package is publicly available at https://www.nuget.org/packages/Skyline.DataMiner.Utils.QAPortalAPI.

Make sure to include the necessary references in your project so you can use the DataMiner QAPortalAPI. With the package installed and the necessary references included, you can now incorporate the API into your existing Automation script or DIS Automation solution to report test results and performance test results.

After reporting the test results using the DataMiner QAPortalAPI, you can easily consult the results in your DataMiner Project Collaboration project.

What is DataMiner Project Collaboration? Find out all about it in the Project Collaboration learning session!

In conclusion, by following these steps and using the DataMiner QAPortalAPI in your test Automation scripts, you can ensure that your DataMiner solution is of the highest quality, enabling you to deliver reliable and robust services to your solution.

The QAPortalAPI in action

In the example below, we test setting a Region parameter on a switch to “West” and expect the Paris element to come online. To push a single test result and a performance metric, see the code below.

using System;
using System.Collections.Generic;
using System.Diagnostics;
using Skyline.DataMiner.Automation;
using Skyline.DataMiner.Net;
using QAPortalAPI.Models.ReportingModels;
using QAPortalAPI.Enums;
using QAPortalAPI.APIHelper;

    public class Script
    {
        TestReport testReport;
        string portalUrl = "QAPORTALURL";
        readonly string scriptName = "RT_SLC_CheckSwitchRegion";
        Engine engine;
        
        public void Run(Engine engine)
        {
            try
            {
                testReport = new TestReport(new TestInfo(scriptName, "Lab", new List<int> { 8328 }, 
                "Check when we set region parameter on the switch element to West, status parameter of Paris should be online"),
                new TestSystemInfo("QAPORTALAGENTNAME"));
                
                Element eSwitch = engine.FindElement("SwitchRegion");
                Element eParis = engine.FindElement("Paris");
                
                //We set region to West, Paris should be online in 30sec
                eSwitch.SetParameter("Region","West");
                Stopwatch stopwatch = Stopwatch.StartNew();
                WaitUntilParisOnline(eParis,30);
                stopwatch.Stop();
                double parisTiming = stopwatch.Elapsed.TotalSeconds;
                testReport.PerformanceTestCases.Add(new PerformanceTestCaseReport("RT_SLC_CheckSwitchRegion_Paris", QAPortalAPI.Enums.Result.Success, 
                                                                                  $"Paris switching case", QAPortalAPI.Enums.ResultUnit.Second, parisTiming));
                testReport.TryAddTestCase(new TestCaseReport(scriptName, Result.Success, $"Paris was switched correctly"), out _);
            }
            catch (Exception ex)
            {
                testReport.TryAddTestCase(new TestCaseReport(scriptName, Result.Failure, ex.ToString()), out _);
            }
            finally
            {
                QaPortalApiHelper reportHelperViaAPI = new QaPortalApiHelper(engine.GenerateInformation, portalUrl, "SafelyStoredClientID", "SafelyStoredAPIKey");
                reportHelperViaAPI.PostResult(testReport);
            }
        }

        private void WaitUntilParisOnline(Element eParis, int maxTime)
        {
            while (!eParis.GetParameter("Status").Equals("Online"))
            {
                maxTime--;
                engine.Sleep(1000);
                if (maxTime == 0)
                {
                    throw new Exception($"Switching to Paris did not succeed in {maxTime} s");
                }
            }
        }
}

On collaboration.dataminer.services (Project Collaboration), on the project you specified, you can find your latest test result. For now, only internal Skyline staff can access the performance metrics and full history of the test results on the QAPortal.

1 thought on “QAPortalAPI: a powerful new way to ensure quality and continuity for your DataMiner projects

Leave a Reply