Showcase Expertise in Mendix Testcase automation! (Banner Image)
Showcase Expertise in Mendix Testcase automation!

Showcase Expertise in Mendix Testcase automation with Selenium!

Rishabh Shandilya
Mendix Community
Published in
6 min readMay 7, 2024

--

Learn how to streamline access to applications using automation tools and techniques. We will guide you through the process step-by-step, from setting up your automation environment to executing flawless login sequences. Discover how automation not only saves time but also enhances your workflow efficiency. Say goodbye to manual logins and embrace a smoother, more productive application experience today!

We delve into menu and submenu navigation, displaying how automation can revolutionize your interaction with your application’s features. Learn how to traverse through your app’s extensive menus effortlessly. Discover the time-saving benefits of automating menu navigation while minimizing the risk of navigation errors.

In this blog, we’ll explore how automation tools can handle login and homepage sequences, freeing you to focus on what truly matters — building connections and fostering professional growth. Join us as we unlock the doors to efficiency and productivity in the application.

Understanding the Use Case

Introducing: a comprehensive back-office solution tailored specifically for the travel industry. This innovative application serves as a cornerstone for travel leaders, streamlining essential operations and boosting efficiency in managing diverse facets of their business.

At its essence, this application serves as the central command center for configuring fundamental settings for the front-end application. From fine-tuning loyalty points systems to orchestrating cancellation policies and overseeing seamless API integrations, it empowers travel companies to effortlessly manage pivotal aspects of their operations.

With this solution, travel businesses gain the ability to seamlessly administer loyalty programs, ensuring customers receive deserved rewards for their ongoing support. Additionally, the platform simplifies the task of adjusting and enforcing cancellation policies, providing agility while upholding operational integrity.

Furthermore, the application boasts robust API management capabilities, enabling seamless integration with external systems and partners. This ensures fluid data exchange and enriches the overall customer experience.

In summary, this back-office solution emerges as the quintessential tool for travel industry leaders striving to optimize their operations. Intuitive interface and potent features enable businesses to maintain control, streamline processes, and deliver exceptional service to their valued customers.

Prerequisites

Before you get started, it’s a good idea to go over what you will need:

  • We used Eclipse to design and develop automation test scripts.
  • We have established a foundational framework by integrating Selenium WebDriver with Java programming to automate our application. Our toolset includes the Gradle build tool and TestNG framework for seamless management and efficient execution of automated tests.

Automating Application Login

In Eclipse, we created a new project for our travel management app and imported the required libraries for Selenium WebDriver. Next, we instantiated a WebDriver object, specifying the browser (e.g., Chrome) and the path to the browser driver executable.

Using the get() method of the WebDriver object we can navigate to the login page’s URL. Next, we use the find Element() method to locate the username and password input fields on the login page using their respective HTML attributes (e.g., id, name, class) and enter the username and password by using the Sendkeys() method.

To locate and click on the login button, we can use the find Element() method and the appropriate locator strategy (e.g., By Xpath()). Implemented error handling and exception methods for no such element exceptions. Execute the scripts using the TestNG suite via the command line using the Gradle Build tool.

public class HomePage {
WebDriver driver;
@findBy(xpath="//input[@id='usernameInput']") //locate UserName Element
WebElement UserId;
@findBy(xpath="//input[@id='passwordInput']") //locate Password Element
WebElement Password;
@findBy(xpath="//button[@id='loginButton']") //locate Login button
WebElement login;
@findBy(xpath="//a[@class='mx-name-menuBar1-1']") //locate "Admin" Icon from menu list Element
WebElement admin;
@findBy(xpath="//a[@title='Module']") //locate value from dropdown of Admin menu
WebElement Module;

public HomePage(WebDriver driver){
this.driver = driver;
PageFactory.initElements(driver, this);
}

public void Login() throws InterruptedException{
driver.manage.window().maximize();
UserId.click();
Thread.sleep(5000);
UserId.sendKeys("MxAdmin");
Thread.sleep(5000);
Password.click();
Thread.sleep(5000);
Password.sendKeys("1");
Thread.sleep(5000);
login.click();
}
}

Output

The automation user enters user credentials and clicks the Sign in button
The automation user is authenticated and is directed to the home page

Automating application “Menu“ functionality

After completion of the login scenario, the automation script will use the findElement() method to locate the menu icon, click on it, and select a value from the dropdown using their respective HTML attributes (e.g., id, name, class).

It’s important to apply separate classes for each Menu and its submenu to perform all other actions present in the same use case. Execute the same scripts in the testNG suite with the help of the Gradle build tool.

Code Snippet

public void Admin() throws InterruptedException{
Actions action = new Actions(driver);
actions.moveToElement(admin);
Thread.sleep(5000);
actions.click().build().perform();
Thread.sleep(5000);
}

public void SubmenuAdmin() throws InterruptedException{
Module,click();
Thread.sleep(5000);
}

public void quittingDriver() {
driver.quite();
}

Output

Benefits and Future Possibilities

Automating login and menu navigation in an application, not only improves the operational efficiency of the development and testing team but also enhances user satisfaction and contributes to the overall success of the project.

As technology continues to evolve, the potential for enhancing automation workflows within applications is limitless. Here are some exciting future possibilities:

a. Imagine seamlessly integrating login and menu navigation automation with other business processes, such as expense management, itinerary planning, or customer support.

b. Future developments may involve creating automation scripts designed for mobile interfaces, allowing users to perform tasks like login and menu navigation effortlessly on their smartphones or tablets.

c. Future automation workflows may incorporate advanced security measures to safeguard sensitive login credentials and data. This could include implementing multi-factor authentication (MFA), biometric authentication, or encryption techniques.

d. Cloud-based automation platforms offer scalability, flexibility, and accessibility for organizations of all sizes. Future possibilities involve migrating automation workflows to the cloud, enabling seamless collaboration among team members.

e. Automation workflows can be augmented with continuous testing and optimization strategies to ensure ongoing performance and reliability.

f. As travel management applications expand into new markets and regions, automation workflows may need to accommodate diverse languages, currencies, and regulatory requirements. Future developments could involve incorporating localization capabilities into automation scripts to ensure compatibility and compliance with local standards.

Conclusion

First and foremost, automation liberates valuable time by eliminating the need for manual intervention in repetitive tasks. In the context of our travel management app, this translates to swift and seamless access to crucial functionalities without the burden of manual labor. Employees can redirect their focus towards higher-value activities, whether attending to clients’ needs, optimizing travel itineraries, or strategizing business expansion.

As you delve into the realm of automation and witness its transformative power firsthand, we encourage you to embark on a journey of exploration and discovery. Automation is not just a tool but a gateway to unlocking untapped potential and reshaping the landscape of productivity and efficiency. Take the insights gained from this exploration and apply them to your workflows and processes. Whether you are a seasoned professional or just starting on your automation journey, there’s always room to innovate and optimize. Experiment with different tools, techniques, and methodologies to find what works best for you and your organization!

Read more

From the Publisher -

Inspired by this article to bring your ideas to life with Mendix? Sign up for a free account! You’ll get instant access to the Mendix Academy, where you can start building your skills.

For more articles like this one, visit our Medium page. And you can find a wealth of instructional videos on our community YouTube page.

Speaking of our community, join us in our Slack community channel. We’d love to hear your ideas and insights!

--

--