My Quest to Find the Right Testing Automation Tool (Beginner-Friendly)
Tags: beginners, testing
Published: 2023-09-18 05:01:35

Before delving into this topic, I'd like to admit that my experience with testing automation tools is limited to JUnit. This blog post is part of my ongoing learning journey. So, if you're in search of more in-depth content on this subject, I recommend checking out the this article I've listed below.

[Choosing the Best Software Test Automation Tool 2023.](https://medium.com/@mynameisobi_63362/choosing-the-right-test-automation-tool-41375095659a)

With that said, let's dive in.

When I first started learning programming, I knew nothing about testing automation tools. They simply didn't seem important at that stage. However, as my coding skills grew and I began to create my own websites, the need for testing automation tools naturally evolved within me. So, I started on a quest to find the tool that best suited my needs.

> There are so many options out there, and each serves a different purpose.

Selenium, Appium, JUnit, TestComplete, Katalon Studio, Cypress—the list goes on. Unsure of where to start, I noticed that 'Selenium' frequently appeared in job postings as a requirement or must-have skill.

- **Selenium** is the most widely used for testing web applications. It supports multiple languages like Java, C#, and Python and is known for its extensive community support.
- **Appium** is specifically designed for testing mobile applications on both Android and iOS platforms.
- **Cypress** is a JavaScript-based end-to-end testing framework that is gaining popularity for its fast testing capabilities.

While Selenium supports multiple programming languages, some tools are specifically designed for particular languages or types of testing. For instance, JUnit is primarily used for unit testing within the Java ecosystem.

Below is a list of testing automation tools along with their basic functionalities:

[Best Automation Testing Tools for 2023](https://www.browserstack.com/guide/best-automation-testing-tools)

One more thing to be considered when choosing a testing tool is types of testing.

> There are various types of testing, including unit testing, integration testing, functional testing, performance testing, end-to-end testing, security testing, and more.

- **Unit Testing** is performed on individual units or components of the software to ensure that each unit is working as expected.
- **Integration Testing** is performed to test the integration between different units or components of the software.
- **Functional Testing** is somewhat similar to Integration Testing but it differs in that Functional Testing expect to get a specific value from the database as defined by the product requirements.

Since my website was a simple static site, I didn't want to use anything with a steep learning curve. Selenium had a broad set of features but because of it looked a little complicated. Besides, I couldn't wrap my head around why testing automation was necessary in the first place, because I could do it manually using command lines like 'console.log()' in JavaScript or System.out.println() in Java. I wanted to know why I would need testing automation tools.

>Testing automation tools provide lots of benefits for sizable or long-term projects.

- **Automation**: With automation tools, more tests can be run in the same amount of time.
- **Reusability**: Automated test cases are reusable, so I don't need to write new test cases from scratch for each new release.
- **Consistency and Reliability**: Automated testing eliminates the risk of human errors.

While a testing automation tool may not be strictly 'necessary' for every project, it seemed obvious that it provides benefits that can greatly improve software quality and development workflow.

After evaluating each tool's complexity, flexibility, and testing type capability, I chose Cypress as my testing automation tool. Cypress is known for its ease of use and setup, especially for JavaScript-based applications.

Here are the exemplary code that utilizes the Cypress framework and checks if the site redirects to a new section when users click the ‘education’ button.

```
describe('My First Test', () => {
  it('finds the content "education"', () => {
    cy.visit('https://d20ykr3p5423qyk.cloudfront.net/')

    cy.contains('Education').click()

    cy.url().should('include', '/#education')
  })
})
```
This code also uses the Cypress framework to test an AWS lambda function via API. It checks if the ‘visitor count’ returned by the API increases by 1 with each GET request.
```
context("GET /users", () => {
  it("add 1 to the current visitor counts", () => {
    cy.request(
      "GET",
      "https://x34sd8hfag.execute-api.us-east-1.amazonaws.com/go/mysite"
    )
      .its('body.count')
      .then((currentCount) => {
        cy.request(
          "GET",
          "https://x1txe9ifcp.execute-api.us-east-1.amazonaws.com/go/mysite"
        )
          .its('body.count')
          .should('eq', currentCount + 1);
      });
  });
});
```

Even though Cypress was easy for me to use, I'm thinking about learning Selenium if I work on a bigger project later on. Your needs may vary, so I highly recommend doing your own research and perhaps even trying out a few different tools.

Happy coding!