Posted: 14 May 2020 7:53 EDT Last activity: 9 Jul 2020 5:36 EDT
BrowserStack integration with Scenario Testing framework
As part of testing an application, there is a need to test its behavior on various web browsers and operating systems keep on coming and being available in industry. To perform this testing, using a rich set of browsers and operating systems there are tools available on Web. One among those good tools is BrowserStack. Others are also there namely CrossBrowserTesting, Saucelabs etc.. Scenario Tests created in Pega can also be executed using the tool BrowserStack.
One can create an account in BrowserStack going to the website https://www.browserstack.com/.Once an account is created, the access key related information can be taken a note. This information is required to run the tests. Below navigation will direct to the screen that shows the info that includes Username and Access key.
Account -> Settings -> Automate
BrowserStack Local Testing Setup
As part of verification of BrowserStack integration with Scenario Testing framework, a local setup is used to perform the testing. To run the tests which are created on the local setup (meaning in a private network), one needs to do Browser stack local testing setup. To do this, a jar/zip(based on OS) has to be downloaded from https://www.browserstack.com/automate/java. Once downloaded, extract the contents and open the command-line interface and navigate to the folder containing the Local binary. Run the binary. The setup tried as a sample, was on Linux operating system. Below is the command used to enable the local testing with proper configuration.
The screenshot provided below can also be referred to see how the console looks like after running this command.
As shown above, a local server will be brought up along with the console being launched automatically. And the console looks like the below.
Running Scenario tests using BrowserStack
The scenario tests available on a system under test can be run by configuring and running a
Task on a Deployment Manager pipeline.
Event on any third-partypipeline like Jenkins
The functionality can even be quickly verified by invoking underlying activity responsible for running set of tests.
The use case configuration presented below is done by invoking the activity. The similar configuration can be done to run through other means as well.
JobID : It can be any string.
ProviderAuthName: Username provided by BrowserStack website upon account creation.
ProviderAuthKey: Access key provided by BrowserStack website upon account creation.
Browser: Browser of choice.
ScreenResolution: Desired screen resolution. Default provided by Scenario Testing framework is “1920x1080”.
SUTURL: URL of system under test. If it is local machine, Host and Port after port forwarding can be used to form URL. (Ex: http://x.x.x.x:abcd/prweb/)
SUTUserID: User ID to log in to system under test.
SUTPassword: Password to log in to system under test.
There are default values provided for a few parameters mentioned below. Specific values can be passed, if not the values mentioned below will be considered by default for tests invocation.
Platform: Windows 10
Configuring task on Deployment Manager pipeline:
A task named “Run Pega scenario tests” can be configured on Deployment manager pipeline. Please find the below picture showing the configuration required by Scenario test task on DM pipeline.
A similar configuration like the one mentioned above in the document for activity invocation can be done to run the tests from Deployment Manager pipeline as well. Parameters needed by the task are explained in detail which will help configuring the task properly.
The execution details can be taken from pipeline logs of Deployment Manager, which will help debugging activities. And the task passes if the pass percentage mentioned on task is met, if not it fails.
Event on any third-partyparty pipeline like Jenkins:
Scenario tests can even be run from an event configured on any third pipeline like jenkins by integrating it with REST API exposed for running scenario tests. A similar configuration like the one mentioned above in the document for activity invocation can be done to run the tests from any third-party pipeline event as well. Parameters needed by the REST service are explained in detail, which will help configuring the event properly.
Running test’s status on BrowserStack local server console:
Once the “Run” is triggered, the tests will be executed and Network logs indicating the same can be verified in BrowserStack local server console like the one below.
Verification of Test results
The statuses, execution time taken by the test cases and the other details can be found by going to the developer studio and launching Scenario Tests landing page. The page can be launched by clicking on the Scenario Testing icon which is a conical flask on the footer.