Blog

A dive into Functional Testing Framework for Mule 4

Joji VargheseWritten by Joji Varghese

Functional Testing is a type of software testing that validates the software system against the functional requirements/specifications. There are two approaches to perform functional testing. They are manual testing and automation testing. Manual testing can be error-prone and requires human intervention whereas automation testing can automate the test execution and are very less prone to error if coded accurately.

One of the most common SAP integration scenarios is SAP and Salesforce integration, a customer relationship management (CRM) platform available as Software as a Service (SaaS) service. Integration between SAP and Salesforce, in particular, has become a high priority requirement for many organizations, who are going through digital transformation.

This testing has three main steps:

Functional Testing Framework for Mule 4

Functionality of functional testing

  • It mainly involves blackbox testing
  • It is carried out to verify software actions
  • It concentrates on user requirements
  • It describes what the product does

How to do Functional Testing?

  • Understand the Functional Requirements
  • Identify test input or test data based on requirements
  • Compute the expected outcomes with selected test input values
  • Execute test cases
  • Compare actual and computed expected results

Comparison between various testing tools in Market

Functional Testing Framework for Mule 4

Automating the functional testing for Mule API based on the BDD method:

Behavior Driven Development (BDD) has become a popular approach in communicating requirements between stakeholders of agile teams. It is mostly about technical insight and business knowledge.

To accomplish this automation in Mule we use the following capabilities:

  • Cucumber: It is a BDD tool used for creating automated script using Gherkin language(Plain text)
  • Rest Assured: Rest Assured is one of the most powerful java libraries for Rest API Automation Testing
  • Jenkins – We will use Jenkins as a CI/CD tool for scheduling our test run and auto report generation
High level Architecture:

Functional Testing Framework for Mule 4

Framework for functional testing in mule:

  • In Anypoint Studio Go to File » New»Mule Project
  • Right-click on the src/test/java folder, and add a new package for config, feature, runner and step definition.

Functional Testing Framework for Mule 4

  • Now go to pom.xml file and add Junit, cucumber, RestAssured dependencies.

Functional Testing Framework for Mule 4

  • Now right click on features and create a file named “customer.feature”

Functional Testing Framework for Mule 4

  • Now right click on step definition and create a class named “CustomerStepDefinition.java”

Functional Testing Framework for Mule 4

  • Add a driver class to runner package where we write the implementation part.

Functional Testing Framework for Mule 4

Functional Testing Framework for Mule 4

  • Add extentreport.xml for config package -Here you can add all the custom related configuration for the reports.

Functional Testing Framework for Mule 4

  • Now let’s go to runner package and add TestRunner class and run the class.

Functional Testing Framework for Mule 4

  • After successful execution go-to target » cucumber-reports and open the report.html file in any browser.

Functional Testing Framework for Mule 4

Later we will need to build, deployment, integration testing and email to users, so we will prefer to create a pipeline (Blue Ocean) which can be discussed in the next blog.