Salesforce Automation with Hybrid Framework

Selenium Automation Hybrid Framework is a popular tool used to test the functionality of the web application and automate the testing.

Introduction:

Selenium Automation Hybrid Framework is a popular tool used to test the functionality of the web application and automate the testing. This framework is driven by two excel files named as Meta data and Test data. The test results are updated in the test data file; with the overall result an Extent-report is created.

Meta data contains the field names with related attributes and method names.

Test data contains the test execution, test flow, test results, status and the related test data.

Prerequisite:

Steps to configure the Selenium WebDriver.

http://www.guru99.com/installing-selenium-webdriver.html

Steps to install test-ng.

http://toolsqa.com/selenium-webdriver/install-testng/

Add the following jars must be added to the project.

  • Selenium 2.53.0
  • TestNG Library.
  • Jfreechart 1.0.1
  • ATUTestRecorder 2.1
  • Apache – POI jars (includes ooxml)
  • Xmlbeans- 2.3.0
  • Dom4j 1.6.1

Prepare the Meta data and Test data excel files.

Objective:

A valid user must log into the Salesforce website. Create a Lead with new account, open activity and closed activity. Then, convert the Lead and verify its contact, opportunity, open activity and closed activity.

All data inputs are available in the test data and the related attributes are available in the meta data.

Test data file:

 

Testcase sheet:

It is the main sheet, which contains all the test cases’ test execution, test flow, expected result, actual result and test status.

Login sheet:

It contains the test data information for login credential.

Headers are field names except TC ID.

Meta data file:

Login sheet:

It contains the meta data information for login credential.

The Field names used in test data file should be the same as in the meta data file.

Action denotes the method name to call for the field name.

Attributes is the element locator like ID, Name, Xpath etc.,

The test data file and meta data file are mapped with the field name and sheet name. Similarly, for all other sheets, the meta data and test data are defined in the above format.

How does it work?

When the program is executed, all the local variables, class variables, constant variables are initiated. The video recorder starts to record; browser will be launched.

Then the focus will move to Testcase sheet; it will filter the test cases with test execution indicator.

If the Test execution status is Y, it will run.

If the Test execution status is N, it will skip the test case and update the test status as Skipped.

Once the test execution indicator is Y, it will fetch the test case flow for the test case id. Those test cases are split into an array to execute the entire flow in a sequential manner.

Now, the first sheet login will get executed. From the test data file and meta data file, it will read the values like attribute, method name and test data. Once all the values are read, the corresponding methods are invoked from the ActionKeywords class.

Similarly, other fields are executed for the current login sheet. Once the login sheet gets completed, it will be iterated till end of the test flow. Once test flow gets completed the actual result and test status will be updated in the excel sheet. Then, with the test data file output, a chart will be created.

Logs are separately maintained in a log file. If a test case fails, screenshot will be taken in the spot. Once all the test cases are executed, the video recorder will stop, and the browser will close.

For excel operations– like reading a value from excel, writing a value from excel– all the methods are available under Excel utilities class.

After the successful completion, the individual test case status updated on the test data file and the overall test execution clear view is available on the chart excel file.

Let us, go through the test flow order.

Login

Test data.

Meta data.

Sales force login page.

The URL will open the Salesforce login page and the username and password input data will be passed to the fields with the help of attribute and action.

Lead

Test data.

Meta data.

New lead page.

Create a new Lead and enter the test input related to the test data and meta data.

Open Activity

Test data.

Meta data.

Open Activity.

Create a Task named Email with respect to the test data and meta data details.

Since the status is set to Not Started, it will move to the Open Activity.

Closed Activity:

Test data.

Meta data.

Closed Activity.

Create a task named Call with respect to the test data and meta data details.

Since the status is set to Completed, it will move to the Closed Activity.

Now, Open activity and the Closed activity are added to the lead.

Now, convert the above Lead to Account by clicking the convert button.

Convert:

Test data.

Meta data.

Convert the lead.

Convert the Lead to Account with the test data inputs available in the test data and meta data file.

After the lead conversion.

Now, verify the Contact, Opportunity, Open activity and Closed activity are created with the given input data.

Contact Verification

Test data.

Meta data.

Contact Details.

The contact name Suresh Kumar is verified in the Contact screen.

Opportunity Verification

Test data.

Meta data.

Opportunity Details.

The opportunity name HTC is verified in the Opportunity screen.

Open Activity

Test data

Meta data

Open Activity.

Open activity task is verified with the ‘Email’ subject and ‘Not Started’ status in Email task screen.

Closed Activity.

Test data.

Meta data.

Closed Activity.

Closed activity task is verified with the ‘Call’ subject and ‘Completed’ status in Call task screen.

Completed

When this stage comes, it means the test case is executed successfully and the actual result is updated in the excel sheet.

On comparison of Expected result and Actual result, the test status is updated with Passed or Failed.

As of now, the test result is updated in the test case sheet. With respect to the test case sheet, a new excel file should create with the test status field and count.

Under test status field, it should have the column values like Passed, Failed, Skipped

With respect to the count values in the new excel, a pie chart will create in the existing excel file.

Chart:

Once all the test cases are completed in the testcase sheet, the chart will be created.

Advantages:

  • Code re-usability.
  • It is applicable for all kinds of functional testing.
  • Any changes in attribute, test data and test flow can be managed from the excel file.
  • This framework can be utilized for different project with a minor change.
  • Test status can be obtained for individual test cases.
  • Overall test result is obtained in chart format.

Disadvantages:

  • OTP verification is not possible.
  • Requires more knowledge in terms of functional as well as in coding level to build the excel files.
  • A minor mistake in excel could stop the test execution. To resolve it, the tester needs debugging knowledge to trace the mistake.

About MST

At MST Solutions our cornerstone is to adapt, engage and create solutions which guarantee the success of our clients. The talent of our team and experiences in varied business verticals gives us an advantage over other competitors.

Recent Articles

Work with us.

Our people aren’t just employees, they are key to the success of our business. We recognize the strengths of each individual and allow them time and resources to further develop those skills, crafting a culture of leaders who are passionate about where they are going within our organization.