Integration Testing & Java Fundamentals
Learn Integration Testing approaches and Java programming basics including data types, variables, and operators
Lesson Overview
Today we'll complete our functional testing journey with Integration Testing and begin Java programming fundamentals. You'll learn integration approaches and Java basics essential for Selenium automation testing.
Integration Testing
3 approaches & concepts
Java Data Types
9 primitive types
Java Operators
Arithmetic operations
Integration Testing
What is Integration Testing?
- • Once development develops new module or functionality, they integrate latest code with existing code
- • Development team integrates dependent and independent modules to make the software
- • Development is responsible to integrate all modules based on HLD and LLD design
- • Testing team is responsible to test all integrated modules
Top Down Approach
- • Main module is developed but sub module or child module is under development
- • Development team writes temporary code to display main module functionality result in sub module pages
- • Temporary code is written using XML (Extensive Markup Language) or JSON (JavaScript Object Notation) format
- • Development team uses stub - temporary program written in XML or JSON format
- • Stub is also called "Called Program"
- • We validate expected main functionality result is present in result grid functionality
When to Use:
Use stub when main module is developed and sub module is under development
Bottom Up Approach
- • Main module is under development and sub module is developed
- • Development team writes temporary code to display or mark child functionality as part of main functionality
- • Temporary code is written using XML or JSON format
- • Development team uses driver - temporary program written in XML or JSON format
- • Driver is also called "Calling Program"
- • Once we achieve main module functionality using XML or JSON, same information should exist in sub module
When to Use:
Use driver when main module is under development and sub module is developed
Hybrid Approach
It is a combination of Top Down and Bottom Up approaches
Best of Both Worlds:
Combines the benefits of both Top Down (using stubs) and Bottom Up (using drivers) approaches
Java Data Types
What are Data Types?
Data types specify what kind of values we can store in Java programs. Java supports various data types for different purposes.
1. Numbers (Integer Types)
byte
Range: -128 to 127
short
Range: -32,768 to 32,767
int ⭐ (Most Used)
Range: -2,147,483,648 to 2,147,483,647
long
Very large numbers (add 'l' at end)
2. Decimal Values
float ⭐ (Most Used)
Precision: 6 to 7 digits (add 'f' at end)
double
Precision: Up to 15 digits
3. Other Data Types
boolean
Values: true / false
char
Single character (use single quotes)
String
Words or text (use double quotes)
Variable Declaration Syntax
Standard Syntax
1. Datatype
Specify the data type:
2. Variable Name
Any name you choose:
- • Can start with letter, _, $
- • Case sensitive
- • No Java keywords
- • No spaces
3. Value
Expected value:
- • Must match datatype
- • Numbers: 123
- • Text: "hello"
- • Character: 'a'
public class Demo1 {
public static void main(String[] args) {
// Variable declarations with different data types
byte a = 10;
System.out.println(a);
short b = 20;
System.out.println(b);
int c = 22333;
System.out.println(c);
long d = 234455555555l; // Note the 'l' at end
System.out.println(d);
float e = 344.45f; // Note the 'f' at end
System.out.println(e);
double f = 344555455.5566;
System.out.println(f);
boolean m = false;
System.out.println(m);
char n = 't'; // Single quotes
System.out.println(n);
String k = "automation"; // Double quotes
System.out.println(k);
}
}
Arithmetic Operators
Basic Operators
Unary Operators
Increase value by 1
Decrease value by 1
public class Demo2 {
public static void main(String[] args) {
int a = 100;
int b = 20;
// Basic arithmetic operations
System.out.println(a + b); // 120 (Addition)
System.out.println(a - b); // 80 (Subtraction)
System.out.println(a * b); // 2000 (Multiplication)
System.out.println(a / b); // 5 (Division)
System.out.println(a % b); // 0 (Modulo)
// Increment and Decrement
a++; // Increment a by 1
System.out.println(a); // 101
b--; // Decrement b by 1
System.out.println(b); // 19
}
}
Java Project Setup Guide
Java Project Creation Steps
Day 6 Knowledge Check
Which integration testing approach uses 'stub' as a temporary program?
Key Takeaways
Integration Testing Approaches
- Top Down: Main developed, sub under development (uses stub)
- Bottom Up: Sub developed, main under development (uses driver)
- Hybrid: Combination of both approaches
- Stub: Called Program (XML/JSON temporary code)
- Driver: Calling Program (XML/JSON temporary code)
Java Data Types
- Numbers: byte, short, int (most used), long (add 'l')
- Decimals: float (add 'f'), double
- Others: boolean (true/false), char ('single'), String ("double")
Variable Declaration
- Syntax: datatype variablename = value;
- Examples: int age = 25; float price = 99.99f;
- Rules: No keywords, case sensitive, no spaces
- Print: System.out.println(variablename);
Arithmetic Operators
- Basic: + (add), - (subtract), * (multiply), / (divide), % (modulo)
- Unary: ++ (increment), -- (decrement)
- Example: a++ increases value by 1
💡 These Java fundamentals are essential for Selenium automation. Master data types and operators as they form the foundation for writing automation test scripts.