Java 101 for software testing (Using fruits and vehicle as example)

Alan Liew
3 min readJan 16, 2023

--

I think many of you might have similar experience like me where I found myself struggle to understand of Java language.

There was a time I try to avoid myself from writing selenium testing script in Java, instead, I’m using Python to code.

And when I decided to learn and write selenium testing script using java but I’m devastated because of the endless of error seem to appear.. I can’t understand the error log, the console log and etc. And I knew that was because lack of basic understanding of Java language.

Hence, I strongly recommend you to read this article before you write any selenium test scripts because you must build your foundation right before you write any scripts.

First, we ask WHY ? Why Java ?

✅ Java is a programming language that is commonly used in combination with the Selenium web automation tool.

✅ Selenium is a powerful tool for automating web browsers, and it can be used to automate a wide variety of web-based tasks.

When used with Java, Selenium allows developers to write automated tests for web applications using the Java programming language. This can be useful for a variety of purposes, including functional testing, performance testing, and regression testing. Not only that, selenium has a number of libraries that can be used to extend its functionality or make it easier to use in certain situations.

Next, what is Java ?

Java is an object-oriented programming (OOP) language.

You may wonder what is OOP means ? Don’t freak out.

Let me make this simple for you. For example:

Fruits

There are bananas, cherries, oranges, kiwis, grapes and apples in the picture.

These are called Objects.

And what are they categories as ? Fruits

Hence, Fruits is the Class and bananas, cherries, oranges, kiwis, grapes and apples is the Objects.

Is this sound simple ?

Vehicles

What about this picture ?

We can see trucks , ambulance, bus and car.

And what are they ? Vehicles

So we know Vehicles is Class and trucks , ambulance , bus and car is an Object.

Now, what is the color of the car ? Blue

Blue is the attribute of the Car.

How do we operate the vehicles ? Drive

Drive is the method

We can conclude 4 things from this , we know the class (vehicles), the object (car, bus, trucks, ambulance), attributes (blue, 4 tires , etc) and method (drive).

public class Vehicle {      <- this is class = vehicles

String carBrand = honda; <- this is objects and attributes
Int numOfTires = 4; <- this is objects and attributes


void Drive(){ <- this is drive method
System.out.print("Car is driving");
}

public static void main(String[]args){

Car myCar = new Car();

myCar.drive();

This is just a simple java program to show you how the java structure it is. It’s OK not to understand everything in the first place. Just get along with me , and I can assure you will have sufficient java knowledge to write your first selenium script with Java.

❤️

Related Articles:

  1. Cloud Computing , let’s talk about it [Part 2]
  2. AWS ! the terms you must know 🤫
  3. ISTQB 🧙🏻‍♀️The software testing Myth, do you need that?
  4. Why software testing is needed in the first place ?
  5. What is Agile Methodology ?

❤️

or connect with me in LinkedIn to discuss more !

Connect with me in LinkedIn for more !

#Softwaretesting #softwaretestere #SDLC #STLC #ISTQB #Java101 #SeleniumJava

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Alan Liew
Alan Liew

Written by Alan Liew

I eat, drink and talk about software testing.. "No Bugs is allowed"

No responses yet

Write a response