Network Diagnostics
Network testing, performance measurement, and connectivity analysis
Introduction
The Network Diagnostics system provides comprehensive tools for testing, measuring, and analyzing network connectivity, performance, and routing paths. It enables automated validation of network infrastructure, identification of bottlenecks, measurement of bandwidth capabilities, and troubleshooting of connectivity issues.
Core Capabilities
- Ping Testing - ICMP ? connectivity validation with RTT, jitter, packet loss
- Traceroute Analysis - Hop-by-hop routing path with geographic location
- Speed Testing - Bandwidth measurement for download/upload throughput
- Network Details - GeoIP enrichment with ISP, location, coordinates
Architecture Components
| Component | Purpose | Metrics |
|---|---|---|
FW_Audit_Ping | ICMP echo request/reply testing | RTT, packet loss, jitter, std dev |
FW_Audit_Traceroute | Network path analysis | Hops, per-hop RTT, geo location |
FW_Audit_SpeedTest | Bandwidth measurement | Download/upload Mbps, quality score |
FW_NetworkDetails | Network enrichment data | GeoIP, ISP, ASN, coordinates |
Ping Testing
Ping ? uses ICMP echo requests to verify network connectivity, measure round-trip time, and detect packet loss.
Using FW_Audit_Ping
// Direct API Usage
FW_Audit_Ping ping = FW_AuditManager.INSTANCE.getAuditPing();
Object result = ping.runAuditPing(
"www.example.com", // target host
10, // ping count
2, // timeout (seconds)
true // verbose output
);
// Test Suite Usage
@Test
@Tag("network")
@DisplayName("TC - Ping - Google DNS")
public void tc_ping_google_dns() {
FW_CustomAssertJU.autoPass(
FW_AuditManager.INSTANCE.getAuditPing()
.runAuditPing("8.8.8.8", 5, 2, true)
);
}
Ping Thresholds
| Metric | Excellent | Good | Fair | Poor |
|---|---|---|---|---|
| RTT (Round-Trip Time) | <50ms | 50-100ms | 100-200ms | >200ms |
| Packet Loss | 0% | <1% | 1-5% | >5% |
| Jitter | <5ms | 5-20ms | 20-50ms | >50ms |
Traceroute Analysis
Traceroute ? displays the network path packets take from source to destination, showing each "hop" along the way with timing and location data.
Using FW_Audit_Traceroute
// Direct API Usage
FW_Audit_Traceroute traceroute = FW_AuditManager.INSTANCE.getAuditTraceroute();
Object result = traceroute.runAuditTraceroute(
"www.example.com", // target host
120, // max duration (seconds)
30, // max hops
true // verbose output
);
// Test Suite Usage
@Test
@Tag("network")
@DisplayName("TC - Traceroute - Production Server")
public void tc_traceroute_production() {
FW_CustomAssertJU.autoPass(
FW_AuditManager.INSTANCE.getAuditTraceroute()
.runAuditTraceroute("www.saucedemo.com", 120, 30, true)
);
}
Speed Testing
Bandwidth measurement for download/upload throughput with quality scoring.
Using FW_Audit_SpeedTest
// Direct API Usage
FW_Audit_SpeedTest speedTest = FW_AuditManager.INSTANCE.getAuditSpeedTest();
Object result = speedTest.runAuditSpeedTest(true); // verbose
// Test Suite Usage
@Test
@Tag("network")
@DisplayName("TC - Speed Test - Network Bandwidth")
public void tc_speedtest_bandwidth() {
FW_CustomAssertJU.autoPass(
FW_AuditManager.INSTANCE.getAuditSpeedTest()
.runAuditSpeedTest(true)
);
}
Speed Thresholds
| Metric | Very Poor | Fair | Good | Excellent |
|---|---|---|---|---|
| Download Speed | <1 Mbps | 10-50 Mbps | 50-100 Mbps | >100 Mbps |
| Quality Score | 0-19 | 40-59 | 60-79 | 80-100 |
TS_Network_JUnit Test Suite
public class TS_Network_JUnit {
@Test
@Tag("network")
@DisplayName("TC - Traceroute - SauceDemo")
public void tc_traceroute_saucedemo() {
FW_CustomAssertJU.autoPass(
FW_AuditManager.INSTANCE.getAuditTraceroute()
.runAuditTraceroute("www.saucedemo.com", 120, 30, true)
);
}
@Test
@Tag("network")
@DisplayName("TC - Ping - Google DNS")
public void tc_ping_google() {
FW_CustomAssertJU.autoPass(
FW_AuditManager.INSTANCE.getAuditPing()
.runAuditPing("google.com", 4, 2, true)
);
}
@Test
@Tag("network")
@DisplayName("TC - Speed Test")
public void tc_speedtest() {
FW_CustomAssertJU.autoPass(
FW_AuditManager.INSTANCE.getAuditSpeedTest()
.runAuditSpeedTest(true)
);
}
}
Running the Test Suite
# Run all network tests
mvn test -Dtest=TS_Network_JUnit
# Run specific test
mvn test -Dtest=TS_Network_JUnit#tc_ping_google
# Run with tags
mvn test -Dgroups="network"
Configuration Options
# testConfig.properties
# Ping Configuration
network.ping.defaultCount=5
network.ping.defaultTimeout=2
network.ping.maxJitter=50
# Traceroute Configuration
network.traceroute.maxDuration=120
network.traceroute.maxHops=30
# Speed Test Configuration
network.speedtest.duration=15
network.speedtest.uploadDuration=10
# GeoIP Configuration
network.geoip.enabled=true
network.geoip.provider=ip-api.com
Troubleshooting
Cause: Target offline, firewall, DNS failure. Solution: Verify host is online, check firewall rules.
Cause: Network congestion, routing issues. Solution: Test wired connection, try different times.
Cause: ICMP blocked by router. Solution: Expected for some hops - routers may block ICMP.
Cause: Firewall, insufficient bandwidth. Solution: Check firewall rules, retry later.
Best Practices
For Test Writers
- Verify Connectivity First - Run ping before expensive operations
- Set Appropriate Timeouts - Adjust based on target location
- Handle Transient Failures - Network tests can be flaky - implement retries
- Document Baselines - Record expected performance for comparison
For DevOps
- Monitor Trends - Track network metrics over time
- Compare Environments - Ensure dev/staging/prod consistency
- Test After Changes - Validate infrastructure modifications
Related Documentation
| Document | Description |
|---|---|
| HTTP Security Assessment | HTTP audit tools |
| Test Development Guide | Writing tests |
| Test Execution Guide | Running tests |
| Architecture Diagram | Layer 6 details |