We’re Here to Help!!

Find A Solution, Learn Best Practices & Get Support 24x7

Regression Testing

Follow

Release Management
Implementation Guide

Index

    Core Setups
  • 1Overview
  • 2Installing Flosum
  • 3Setting up Flosum integration user
  • 4Connecting sandboxes to Flosum
  • 5Setting up users in Flosum
  • 6Setting org permissions
  • 7Decide on naming convention
  • 8Initialize the repository
  • 9Setting up workflow permissions
  • Application Development Flow
  • 10Pulling changes from dev sandboxes
  • 11Branching strategy
  • 12Conflict and Merge strategy
  • 13Static Code Analysis
  • 14Apex
  • 15Regression testing
  • 16Reference Architecture
  • Integrations
  • 17Jira
  • 18TFS/Azure Devops
  • 19Git Integrations
  • Compliance & Governance
  • 20Compliance & Governance
Flosum can be tightly integrated with Selenium test cases for regression testing. 
 
Selenium test cases can be recorded and hosted on any provider including AWS, Azure, or any on-premise servers that customers may already have. There is absolutely no limitation as long as it can accept an incoming web service from Flosum.
 
Use cases:
 
Most customers integrate with Flosum on one of the following two conditions:
 
1. Whenever a new user story or release is deployed to a DevTest, QA or UAT sandbox.
2. The developer has finished the user story and committed new code to the repository. In order to maintain the sanctity of the code, the code is deployed to a build organization and tested on various sandboxes. Whenever a new code is committed to the repository, the regression test cases are automatically run to ensure that there are no failures in the build process.
 
In the example below, you can see the test cases are automatically run after the deployment is finished to the target org.
 
In the screenshot below, the "Regression Test Classes" captures the test classes that should be executed at the end of deployment.
 
Flosum_1.png
 
 
After the deployment is complete, the results of the Selenium test classes are captured in a related list.
 
 
Flosum_2.png
 
 
On clicking on the details, you can see the entire log details here:
 
 Flsoum__3.png
Sample code:
public class SeleniumHttpCaller implements Queueable, Database.AllowsCallouts{

 

        static final String SERVER_URL = 'http://ec2-3-16-54-178.us-east-2.compute.amazonaws.com:8080';

    

    public String MetadataLogId {get; private set;}

    public SeleniumHttpCaller(String metadataLogId){

        this.MetadataLogId = metadataLogId;

    }

    public SeleniumHttpCaller(){}

    

    public void execute(QueueableContext context){

        

        SeleniumHttpCaller.FutureMethod(this.MetadataLogId);

    }

    

    @future(callout=true)

    public static void FutureMethod (String metadataLogId){

        

        SeleniumHttpCaller.callTestExecution();

        SeleniumHttpCaller.checkTestResult(metadataLogId);

    }

    

    public static void callTestExecution(){

        HTTP h = new HTTP();

        HTTPRequest r = new HTTPRequest();

        r.setEndpoint(SeleniumHttpCaller.SERVER_URL + '/job/devsforce/buildWithParameters');

        Blob headerValue = Blob.valueOf('devsforce:11e6c770f095baff013bcecda82654fdfd');

        String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);

        r.setHeader('Authorization', authorizationHeader);

        r.setMethod('POST');

        r.setBody('testCase:DoSalesforce');

        HTTPResponse resp = h.send(r);

    }

    

    public static void checkTestResult(String metadataLogId){

        HTTP h = new HTTP();

        HTTPRequest r = new HTTPRequest();

        r.setEndpoint(SeleniumHttpCaller.SERVER_URL + '/job/devsforce/lastBuild/testReport/api/json');

        Blob headerValue = Blob.valueOf('devsforce:11e6c770f095baff013bcecda82654fdfd');

        String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);

        r.setHeader('Authorization', authorizationHeader);

        r.setMethod('GET');

        HTTPResponse resp = h.send(r);

        

        if(resp.getStatusCode() != 404){

            

            TestResponseBody objTestResponseBody = new TestResponseBody(System.JSON.createParser(resp.getBody()));

            List<Test_Result__c> lstTestResults = new List<Test_Result__c>();

            Test_Result__c testResult;

            for(TestResponseBody.Cases iCase : objTestResponseBody.suites[0].cases){

                testResult = new Test_Result__c();

                testResult.Metadata_Log__c = metadataLogId;

                testResult.Error_Details__c = (iCase.errorDetails != NULL) ? iCase.errorDetails.toString() : '';

                testResult.Error_Stack_Trace__c = (iCase.errorStackTrace != NULL) ? iCase.errorStackTrace.toString() : '';

                testResult.Skipped__c = iCase.skipped;

                testResult.Skipped_Message__c = (iCase.skippedMessage != NULL) ? iCase.skippedMessage.toString() : '';

                testResult.Status__c = iCase.status;

                testResult.Test_Case_Name__c = iCase.name;

                testResult.Complete_Log_JSON__c = resp.getBody();

                

                lstTestResults.add(testResult);

            }

            

            insert lstTestResults;

        }

    }

}

 

 
Print Friendly and PDF
Was this article helpful?
0 out of 0 found this helpful

Comments