Why do we need Test Automation?
In today’s agile software development and fast moving market it’s crucial to release the quality product to market on time. It is a challenge for any company to continuously maintain and improve the quality and efficiency of software systems development. Every Test Engineer strives to catch bugs before the product is released. But they sometimes creep in and often reappear, even with the best manual testing processes. Here is where Test Automation comes into play. Test Automation can bring many benefits to your testing cycles, allowing you to build a better product with less effort. It is less time consuming as well and therefore enables increase in ROI.
Test Automation Framework Features
When it comes to Automation Script Development the main objective is to develop a script that covers all acceptance criteria which are reliable. Here is where a framework helps an Automation Engineer to develop reliable script in less time and effort. Other features of a framework are
- Re-usability: We can make use of same user flow / code for multiple projects or multiple platforms
- Maintainability: Test Automaton Scripts can be easily maintained
- Reporting: Reporting feature will enable mail reporting to the stakeholders after each and every execution
- Test Data: Test Data will help in managing user inputs to the script. Test data are fetched from JIRA using API calls
- Object Repository: Object repository will have all the element identifiers kept in a properties file. This will help in having minimal updation in the script file even if there is a UI change
Selenium is a framework for automated softwaretests of webapplications and was developed by ThoughtWorks Company. It is widely spreaded and among the most popular testing tools.
- Selenium is platform independent. It works in almost all major platforms
- It is open source hence cost-effective and has a wide community base
- Selenium supports multiple programming languages
- It supports Opera, Safari, Chrome, IE 6, 7, 8 and Mozilla Firefox
- So far as Selenium is concerned, we have a number of robust methods for location of elements such as CSS, Xpath, DOM, and so on.
- With Selenium, it is convenient to implement frameworks that revolve around Object Oriented Programming like keyword-driven, data-driven and hybrid
- Selenium provides support for integration of open source frameworks like TestNG, JUnit, NUnit and other
- With the use of Selenium, it is possible to execute simultaneous tests leveraging various browsers on various machines. This cuts down the time for test execution when a large project is in progress.
Salesforce Automation Challenges
When it comes to Salesforce test automation there are few challenges when we perform automation with Selenium. As Selenium is highly based on unique identifiers (preferably IDs), Salesforce IDs are dynamic which may increase script maintainability in each cycle. The page layout in Salesforce Visualforce pages are subjected for regular updates or changes.
logicline Test Automation Framework
The logicline Test Automation Framework for Salesforce is build on top of the Selenium webdriver along with the programming language Java, unit test framework TestNG and Eclipse IDE.
The major components of this framework are:
- Base class: This is a Java class file where all the functions are written. It can be utilized across any script file, thus maintaining the script re-usabilty.
- Main script runner class: This is the testing class where it is specified which scripts need to run. Here the precondition and post condition are mentioned.
- Script classes: These are classes that extend the base class. It’s where the test steps resides for each test cases. Each and every testcase should be a separate script file which is finally called in the main script file.
- OR properties: This is the object repository file where all element identifiers used in the scrips are written. This helps in maintaining the script. If any change happens to the visual-force page that makes changes to the element identifiers, a Test Engineer can change only this one file instead of changing it in the actual script file.
- Config properties: Config properties file is a run time configuration file where we can provide all run time configurations like browser type, browser version, username, password and other.
- TestData.xls: This is an Excel file where all test datas used throughout the script are provided. The user can just add or modify this Excel file rather than making changes to the script thus helping in improving maintainability.
Steps to Create Script Automation Script
- Import logicline framework to Eclipse IDE
- Add packages Main and script to the project
- Convert the project to testNG format
- Under script package create a new java class and write the steps to automate the testcases
- Under main package create a testNG class and under @test tag create an object of the script and call the function
- After above steps are completed right click on testNG.xml and run as testNG suite
The script shown in the demo is of the CleverReach for Salesforce app. This is the integration of a mass mailing software with Salesforce and was developed by logicline. The test scenario is creating a campaign and then creating a lead and contact. Then the created lead and contact are added to the newly created campaign as campaign members. Then the campaign is sent to CleverReach and the next step is syncing the campaign. Afterwards it’s checked if the campaign is successfully created and synched with CleverReach.
In this video you can see how the logicline Test Automation Framework works: