Test Case Design Techniques for Manual and Automation Testing

By Andrew Luna | February 2, 2022

Have you ever planned out an itinerary before taking a trip or vacation? Most excited travelers will plan essential items to take along on the trip and think about places and things they would like to see and do. This process is similar to what QA Testers do prior to actually testing a project.

It is always good to have test cases in order to help give a clear direction with the testing for any project, especially large projects. Test cases are essential because they help with the testing efforts.

The best approach for having great test cases is to have business requirements and acceptance criteria for a project. Business requirements define the scope of the project and the objectives/goals the team is trying to accomplish. With good requirements in place, the team is able to build clear and concise acceptance criteria.

Acceptance criteria are what help the Development and QA teams define the details with testing. This also gives a clearer picture and guideline on what is acceptable for the project to be considered complete and working as intended.

Here is an example of acceptance criteria: A user cannot submit a form without completing all of the mandatory fields.

If there are no Acceptance Criteria or Business Requirements, the next best method is to examine the project itself and draw up a plan on what is being updated. For this example let's create our own project and define the test case examples:

Manual Test Case Example

For our Login page we will use this test website:

With the project in place, let's begin writing our test case template.

Basic template

The most basic template to use is something like this:

Optional fields:

PHP Travels Login Page 2FA Update Test Case

Step to Reproduce

Pass/Fail

Expected Results

Actual Results

Notes

1. Navigate to the Homepage

Pass

The Homepage will load without issues.

Homepage loads and no issues were found

2. From the Homepage: Click on the Login button

Pass

The Login page will load without any issues.

The Login page loads with no issues.

3. From the Login page: Login with a valid user

Fail

After logging in, the Two Factor Authentication prompt displays.

The Two Factor Authentication prompt does not display.

I entered a ticket in our bug tracking system. #1234

The example test case above is covering the first step, which is confirming the Login triggers a Two Factor Authentication. In a real testing scenario, there would be more test cases written so consider this as a starting point for your own template. It is also helpful to include the issue ticket number in the Actual Results. This gives the team more insight on where to find the issue. A test case like this also indicates the page with a From Statement. This is helpful in knowing where on the website or application this test case step is referring to.

This type of test case is great and ideal for manual testing since this gives manual testers the ability to copy and paste all of the information into an issue ticketing system such as Jira. In regards to automation testing, this can be a bit cumbersome since there are a lot of fields including Expected and Actual Results.

Reporting with UIlicious makes it easier to document testing results because these results can be downloaded and attached to ticketing systems like Jira.

Sign up for UI-licious now

Another method for writing test cases is the Given, When, Then, method.

This type of test case writing is very straightforward and one advantage is this format makes it quite easy and ideal for automation testing.

First, let’s break down what the three mean:

Using this in an actual testing scenario such as the 2FA test on the PHP Travels Login Page, it would be something like this:

Let’s create another testing scenario so we can see how this is used as a script for a testing tool such as Cucumber, Selenium, and UIlicious.

The example script would be:

Selenium is a widely used automation tool that gives teams the ability to automate functional features on a website. Depending on the tester’s skill level, there can be a steep learning curve when creating automation scripts in Selenium.

For Selenium the code snippet example will look like this:

public class annotation {
   WebDriver driver = null;
   @Given("^I am on PHP Travels Test Website login page$")

   public void goToPHPTravelsTestWebsite() {
      driver = new FirefoxDriver();
      driver.navigate().to("https://phptravels.net/");
   }

   @When("^I enter Username as Test")
   public void enterUsername(String arg1) {
      driver.findElement(By.id("Test")).sendKeys(arg1);
   }

   @When ("^I enter password as Test")
   public void enterPassword(String arg1) {
      driver.findElement(By.id("pass")).sendKeys(arg1);
      driver.findElement(By.id("u_0_v")).click();
   }

   @Then("^Login should pass$")
   public void checkFail() {
      if(driver.getCurrentUrl().equalsIgnoreCase(
         "https://phptravels.net/login.php?login_attempt=1&lwv=110")){
            System.out.println("Test1 Pass");
      } else {
         System.out.println("Test1 Failed");
      }
      driver.close();

The above code shows the Given, When, and Then test cases in action. It is straightforward to write these test cases in Selenium.

UIlicious is another automation tool, but unlike Selenium, UIlicious empowers anyone regardless of skill level with the ability to write automation scripts. Combining this straightforward coding language makes the Given, When, and Then test cases within the automation script easier to follow and understand.

For UIlicious the code snippet is easier to write and understand:

//Given
I.goTo("https://phptravels.net/")
I.click("Login")
//When
I.fill("Email",DATA.email)
I.fill("Password",DATA.password)
//When
I.click("Remember Me")
I.click("Login")
//Then
I.see("Welcome Back")

In the example above I am using a Dataset to truncate my sensitive login credentials. As you can see it is quite easy to understand and write the Given, When, and Then, test case format in UIlicious.

I hope this gives you an idea of why writing test cases is important for both manual and automation testing. Writing test cases gives everyone on the project a clear understanding of what is being tested and what the expected and actual results are. Project transparency means fewer hidden surprises.

Happy Testing!

Sign up for UI-licious now

About Andrew Luna

I love to write about all things related to QA and UIlicious.

Similar Posts