1 of 17

API Resiliency Testing

Leveraging Kotlin’s Functional Programming at Scale

Naresh Jain�naresh@specmatic.io

© 2025 All Rights Reserved

2 of 17

© 2025 All Rights Reserved

3 of 17

© 2025 All Rights Reserved

4 of 17

© 2025 All Rights Reserved

5 of 17

Resiliency Testing

  • Negative Functional Testing
    • Boundary Value Testing
    • Equivalence Partitioning
    • Invalid Data Types Testing
    • Format Validation Testing
    • Overflow and Underflow Testing
  • Service Dependency Testing
    • Contract Testing
    • Backward Compatibility Testing
  • Chaos Engineering
    • Fault Injection Testing
    • Failover Testing
    • Recovery Testing
    • Network Partitioning
  • Performance Testing
    • Load Testing
    • Stress Testing
    • Soak Testing
    • Latency Testing
    • Concurrency Testing
  • Security Resilience Testing
    • SQL Injection Testing
    • Cross-Site Scripting (XSS) Testing
    • Unauthorized Access Testing
    • Session Expiry Testing
    • Penetration testing
    • DDoS
    • Vulnerability Scans
  • Observability, Monitoring & Alerts

© 2025 All Rights Reserved

6 of 17

Application Architecture

Test

Request

Response

Request

Response

1

2

3

4

5

Message

Topic

Product Service

App

Order Service

Analytics Service

© 2025 All Rights Reserved

7 of 17

API Resiliency Testing Live Demo

© 2025 All Rights Reserved

8 of 17

Why 351 Tests?

Fields

Data Type

Required

Nullable

Constraints

Values

name

string

Yes

No

-

-

type

string

Yes

No

Enum

book, food, gadget & others

inventory

number

Yes

No

min & max

min = 1 & max = 9999

cost

number

No

Yes

min

min = 0.00

Positive Variations

Negative Variations

Variation Count

string

int, bool, null

4

4 enum values

int, bool, null

7

1, 1<random value<9999, 9999

0, 10000, string, bool, null

8

0, random value, null

-ve numbers, string, bool

7

= 1,568

© 2025 All Rights Reserved

9 of 17

© 2025 All Rights Reserved

10 of 17

© 2025 All Rights Reserved

11 of 17

Classic Combinatorial Explosion

12 of 17

Before and After

© 2025 All Rights Reserved

13 of 17

Test Execution

Dynamic Test Factory

API

Request

Response

Request Generator

Response Validator

© 2025 All Rights Reserved

14 of 17

Before with Eager List & Try/Catch Blocks

Not enough memory

Dynamic Test Factory

Scenarios

Types / Patterns

Email

Item

String

Date

Order

API

Request

Complete Test List

Response

Request Generator

Response Validator

Filtered

Test List

Exception?

Exception?

yes

no

© 2025 All Rights Reserved

15 of 17

After with Lazy List & Either Monad

Dynamic Test Factory

Scenarios

Types / Patterns

Email

Item

String

Date

Order

API

Request

Response

Request Generator

Response Validator

Lazy List of Tests (Just In Time)

Stream -> Filter -> Map to Tests

Minimal memory usage

Either Monad

Failed Tests

error / left

© 2025 All Rights Reserved

16 of 17

Specmatic Code Walk-thru

© 2025 All Rights Reserved

17 of 17

© 2025 All Rights Reserved

Thank you!

Naresh Jain

naresh@specmatic.io