FinCheck Methods & Modular Automation Design

Business Scenario

After successfully understanding Loops and repeated Validation Processing inside Java Programs, your manager now assigns you responsibility for creating Reusable Validation Logic using Methods inside the FinCheck Banking System.

Inside Banking Applications, the same Validation Logic is used repeatedly during :-
Transaction Validation

Balance Verification

Customer Verification
Account Validation
Report Processing

Recently, QA Testers reported that large Java Programs are becoming difficult to manage because same Validation Code is written repeatedly multiple times.

The testing team now needs to understand how Methods help organize reusable Testing Logic inside Java Programs.

Additionally, developers informed the QA team that banking applications also use :-
Public Methods
Private Methods
Getter Methods
Setter Methods

to secure and manage sensitive Banking Data properly.

Before starting testing activities, your manager clearly says :-
“”A QA Tester must understand how reusable Methods and modular Validation Logic help simplify Automation Programs. “”

Your responsibility is to understand :-
How Methods Work in Java
How Reusable Validation Logic is Created
How Parameters are Passed into Methods

How Modular Validation Design Works
How Access Specifiers Improve Security
How Getters and Setters Protect Banking Data
How Code Reusability Improves Testing Programs

Pre-Lab Preparation

  • Create reusable functions
  • Pass parameters
  • Modularize validation logic
  • Improve code reusability
git pull origin branchName

Git Pull

Task 1: Understand Methods in Java

Understand Methods  

1

What are Methods?

Methods are reusable blocks of code used to perform specific operations inside Java programs.

Methods help testers :-

  • reuse validation logic

  • reduce repetitive code

  • organize programs properly

  • improve readability

How Methods Work

  • Method is created using method syntax.

  • Method gets called whenever required.

  • Same method can execute multiple times.

Real Life Example

Tester creates reusable validation method to validate multiple banking transactions automatically.

Syntax

METHOD SYNTAX — NO PARAMETER , NO RETURN

public void finCheck_Login() {
// code
}

CALL A METHOD

public static void main(String[] args) {
finCheck_Login();
}

Activity

  • Create reusable transaction validation method

  • Create transaction amount parameter inside method

  • Apply validation condition on transaction amount

  • Check transaction amount should be greater than zero

  • Print VALID transaction message

  • Print INVALID transaction message

  • Call validation method multiple times

  • Execute Java program

  • Observe reusable validation execution flow

Task 2: Pass Parameters into Methods

Understand Parameters

1

What are Parameters?

Parameters are values passed into methods during execution.

Parameters help methods process dynamic data instead of fixed values. 

How Parameters Work

  • Values are passed during method call.

  • Method receives values using parameters.

  • Processing happens dynamically.

Real Life Example

Tester passes transaction ID into validation method to validate different banking transactions.

Syntax

METHOD WITH PARAMETER

public void finCheck_Login(String Username String password) {
// code
}

CALL METHOD WITH ARGUMENT

public static void main(String[] args) {
finCheck_Login("argument 1 for username", "argument 2 for password");
}

Activity

  • Create reusable customer validation method

  • Create customer name parameter inside method  

  • Pass customer name during method call

  • Print customer validation message

  • Call method multiple times using different customer names

  • Execute Java program

  • Observe parameter-based method execution

Task 3: Understand Access Specifiers

Understand Public and Private  

1

What are Access Specifiers?

Access specifiers control the visibility and accessibility of variables and methods inside Java programs.

They help secure sensitive banking information.

Banking applications contain sensitive data like :-

  • account balance

  • PIN number

  • customer details

  • transaction amount

Private access helps protect sensitive information from unauthorized access.

Types of Access Specifier

  • Public

Accessible from anywhere

  • Private

Accessible only inside same class  

Syntax

PUBLIC ACCESS SPECIFIER IN VARIABLE AND METHOD

public dataType variableName = value;
public void methodName() { // code }

PRIVATE ACCESS SPECIFIER IN VARIABLE AND METHOD

private dataType variableName = value;
private void methodName() { // code }

Activity

  • Create private variable

  • Access variable using public method

  • Execute Java program

  • Observe controlled data access

Task 4: Understand Getter and Setter Methods

Understand Encapsulation

1

What is Encapsulation?

Encapsulation means protecting variables using private access and accessing them using public getter and setter methods.

Encapsulation improves :-

  • data security

  • controlled access

  • code maintainability

  • modular programming

Types of Encapsulation Methods

  • Getter Methods

Getter methods are used to retrieve private variable values.

Purpose of Getter Methods :-

  1. Access private data safely

  2. Read variable values

  3. Maintain data security

  • Setter Methods

Setter methods are used to update private variable values safely.

Purpose of Setter Methods  :-

  1. Modify private data safely

  2. Control data updates

  • code maintainability

  • modular programming

Types of Encapsulation Methods

  • Getter Methods

Getter methods are used to retrieve private variable values.

Purpose of Getter Methods :-

  1. Access private data safely

  2. Read variable values

  3. Maintain data security

  • Setter Methods

Setter methods are used to update private variable values safely.

Purpose of Setter Methods  :-

1. Modify private data safely

2. Control data updates

3. Apply validations before updating values

Real Life Example

Tester retrieves account balance using getter method and updates customer details using setter method.

Syntax

ENCAPSULATION — PRIVATE VARIABLE

private dataType variableName = value;

GETTER METHOD

public dataType methodName() {
return variableName;
}

SETTER METHOD

public void methodName (dataType variableName) {
this.variableName = variableName;
}

Activity

1. Retrieve Account Balance using Getter Method

  • Create private balance variable

  • Assign balance value

  • Create getter method

  • Return balance value using getter method

  • Access getter method using object

  • Print account balance

  • Execute Java program

  • Observe secure data retrieval process

2. Customer Name using Setter Method

  • Create private customer name variable

  • Create setter method

  • Pass customer name into setter method

  • Update customer name using setter method

  • Create getter method

  • Print updated customer name

  • Execute Java program

  • Observe controlled data update process

Task 5: Modularize Validation Logic

Understand Modular Validation

1

What is Modular Validation Logic?

Modular validation means separating validation logic into reusable methods instead of writing everything inside main method.

This helps testers :-

  • simplify programs

  • reuse validation logic

  • manage large programs easily

  • improve readability

How Modular Validation Works

  • Validation logic gets separated into methods.

  • Main method calls reusable validation methods.

  • Each method handles specific operation.

Real Life Example

FinCheck QA team creates separate reusable validation method for validating transaction amounts.

Activity

  • Create reusable transaction validation method

  • Pass transaction amount parameter

  • Apply validation condition

  • Print valid or invalid status

  • Call validation method multiple times

  • Execute Java program

  • Observe modular validation execution

Task 6: Improve Code Reusability

Understand Code Reusability

1

What is Code Reusability?

Code reusability means using the same method multiple times instead of rewriting the same logic repeatedly.

Reusable code helps testers :-

  • reduce duplicate code

  • improve maintenance

  • simplify automation programs

How Reusability Works

  • Reusable method gets created once.

  • Same method executes multiple times with different values.

Real Life Example

Tester uses same validation method to validate multiple banking transactions automatically.

Activity

  • Create reusable transaction validation method

  • Pass transaction ID and transaction amount parameters

  • Print transaction details

  • Apply validation condition on transaction amount

  • Print transaction status

  • Call same method multiple times

  • Execute Java program

  • Observe reusable modular validation flow

 

Good Job!!

In this lab, you learned about Methods in Java, Reusable Validation Logic, Parameters, Encapsulation, Access Specifiers, and Getters & Setters.

You also practiced creating Reusable Methods, passing Transaction Data, reducing Repetitive Code, improving Program Readability, and protecting Sensitive Data.

By completing this lab, you now understand how QA Testers Build Modular Automation Programs, Reuse Validation Logic, Secure Data, and Simplify Testing using Java Methods.

Checkpoint

Next-Lab Preparation

   Git Push

git push origin branchName
  • Read data from CSV/text files
  • Write results to output files
  • Process large datasets
  • Store validation logs

10 FinCheck Methods & Modular Automation Design

By Content ITV

10 FinCheck Methods & Modular Automation Design

  • 11