Slide 1

Slide 1 text

@arafkarsh arafkarsh Architecting & Building Apps a tech presentorial Combination of presentation & tutorial ARAF KARSH HAMID Co-Founder / CTO MetaMagic Global Inc., NJ, USA @arafkarsh arafkarsh AI / ML Generative AI LLMs, RAG 6+ Years Microservices Blockchain 8 Years Cloud Computing 8 Years Network & Security 8 Years Distributed Computing 1 Testing Strategies Behavior Driven Design JUnit 5, TestNG, Spring Spock Cucumber, Selenium, Mockito, WireMock, Pact Microservices Architecture Series Part 8 of 15 To Build Cloud Native Apps Composable Enterprise Architecture

Slide 2

Slide 2 text

@arafkarsh arafkarsh 2 Source: https://arafkarsh.medium.com/embracing-cloud-native-a-roadmap-to-innovation-a6b06fe3a9fb Cloud-Native Architecture

Slide 3

Slide 3 text

@arafkarsh arafkarsh 3 Source: https://arafkarsh.medium.com/embracing-cloud-native-a-roadmap-to-innovation-a6b06fe3a9fb

Slide 4

Slide 4 text

@arafkarsh arafkarsh 4 Slides are color coded based on the topic colors. Microservices Testing Strategies 1 Unit Testing JUnit 5 2 Behavior Driven Development Cucumber, Selenium Mockito 3 Integration / Contract Testing WireMock, Pact 4

Slide 5

Slide 5 text

@arafkarsh arafkarsh Github Codebase 5 Source: https://github.com/arafkarsh/ms-quickstart Springboot Examples 1. Kafka 2. Kafka Connect 3. Kafka Stream 4. OWASP Top Vulnerabilities & Fixes 5. Kubernetes 6. Test Automation 7. WebFlux Reactive Programming 8. Gen AI Examples github.com

Slide 6

Slide 6 text

@arafkarsh arafkarsh 6 Source: https://github.com/arafkarsh/ms-test-quickstart o SpringBoot 3.3.4 o Jakarta EE 10 o Java 23

Slide 7

Slide 7 text

@arafkarsh arafkarsh Agile Scrum (4-6 Weeks) Developer Journey Monolithic Domain Driven Design Event Sourcing and CQRS Waterfall Optional Design Patterns Continuous Integration (CI) 6/12 Months Enterprise Service Bus Relational Database [SQL] / NoSQL Development QA / QC Ops 7 Microservices Domain Driven Design Event Sourcing and CQRS Scrum / Kanban (1-5 Days) Mandatory Design Patterns Infrastructure Design Patterns CI DevOps Event Streaming / Replicated Logs SQL NoSQL CD Container Orchestrator Service Mesh

Slide 8

Slide 8 text

@arafkarsh arafkarsh 8 Source: https://cloud.google.com/resources/devops/state-of-devops DORA – DevOps Research & Assessment

Slide 9

Slide 9 text

@arafkarsh arafkarsh 9 Our Goal Source: https://cloud.google.com/resources/devops/state-of-devops

Slide 10

Slide 10 text

@arafkarsh arafkarsh 0 Microservices Testing Strategies o Unit testing o Component testing o Integration Contract testing o Integration testing 10

Slide 11

Slide 11 text

@arafkarsh arafkarsh Microservices Testing Strategies 11 E2E Testing Integration Testing Contract Testing Component Testing Unit Testing Number of Tests Speed Cost Time Mike Cohen’s Testing Pyramid Test Pyramid: https://martinfowler.com/bliki/TestPyramid.html 70% 20% 10% Ubiquitous Language Domain Expert Analyst Developers QA Design Docs Test Cases Code Architect

Slide 12

Slide 12 text

@arafkarsh arafkarsh Other Testing Strategies or Anti Patterns 12 End 2 End Testing Integration Testing Unit Testing Inverted Pyramid / Ice Cream Cone Strategy Unit Testing Integration Testing End 2 End Testing Hour Glass Strategy 70% 20% 10% 45% 45% 10%

Slide 13

Slide 13 text

@arafkarsh arafkarsh Microservices Testing Strategy 13 Unit Testing A unit test exercises the smallest piece of testable software in the application to determine whether it behaves as expected. Source: https://martinfowler.com/articles/microservice-testing/#agenda Component Testing A component test limits the scope of the exercised software to a portion of the system under test, manipulating the system through internal code interfaces and using test doubles to isolate the code under test from other components. Integration Testing An integration test verifies the communication paths and interactions between components to detect interface defects Integration Contract Testing An Integration Contract test is a test at the boundary of an external service verifying that it meets the contract expected by a consuming service. End 2 End Testing An end-to-end test verifies that a system meets external requirements and achieves its goals, testing the entire system, from end to end Say NO to End 2 End Tests - Mike Walker April 22, 2015. Google Test Blog

Slide 14

Slide 14 text

@arafkarsh arafkarsh Microservices Testing Scenarios / Tools 14 Testing Tools Contract Testing Scope Integration Testing Verifies the communication paths and interactions between components to detect interface defects Contract Testing It is a test at the boundary of an external service verifying that it meets the contract expected by a consuming service. Payment Mock Integration Contract Testing Scope Test Double Montebank Cart Component Testing Unit Testing Integration Testing Scope Order REST / HTTP or Events / Kafka Item ID, Quantity, Address.. Mock Order Component Testing A component test limits the scope of the exercised software to a portion of the system under test. Order Payment Unit Testing Firewall Integration Testing Scope REST / HTTP Payment Sandbox Component Testing U

Slide 15

Slide 15 text

@arafkarsh arafkarsh 15 Junit 5 5.10.2 Cucumber 7.18.0 Mockito 5.12.0 Selenium 4.12.0 WireMock 3.6.0 Pact 4.0.10 Source: https://github.com/arafkarsh/ms-test-quickstart Rest Assured 5.4.0 SpringBoot 3.3.4 TestNG 7.10.2 Spock 2.4

Slide 16

Slide 16 text

@arafkarsh arafkarsh Package Structure 16 1. Order Service 2. Payment Service 3. Packing Service 4. Shipping Service 5. Warehouse Service 6. Delivery City Service Services 1. Order Controller Controllers Source: https://github.com/arafkarsh/ms-test-quickstart

Slide 17

Slide 17 text

@arafkarsh arafkarsh Order Service API Calls 17 http://localhost:9080/swagger-ui.html Based on Open API v3

Slide 18

Slide 18 text

@arafkarsh arafkarsh Diffblue Cover o Autogenerate Unit Test cases with Mock Objects 18

Slide 19

Slide 19 text

@arafkarsh arafkarsh Setup 19 1. Open IntelliJ IDEA. 2. Navigate to the File menu → Settings (or Preferences on macOS). 3. In the settings window, select Plugins from the left- hand menu. 4. In the Marketplace tab, search for Diffblue Cover. 5. Click Install next to the Diffblue Cover plugin. 6. Restart IntelliJ IDEA to complete the installation. 2 3 4 5

Slide 20

Slide 20 text

@arafkarsh arafkarsh 20 Auto Generate Test Cases Order Service

Slide 21

Slide 21 text

@arafkarsh arafkarsh 21 Auto Generate Test Cases Order Service

Slide 22

Slide 22 text

@arafkarsh arafkarsh 22 Auto Generate Test Cases Order Service

Slide 23

Slide 23 text

@arafkarsh arafkarsh 23 Auto Generate Test Cases Order Service

Slide 24

Slide 24 text

@arafkarsh arafkarsh 24 Order Repository Test Generation Process

Slide 25

Slide 25 text

@arafkarsh arafkarsh 25 Testing Frameworks

Slide 26

Slide 26 text

@arafkarsh arafkarsh 1 Unit Testing o JUnit 5 Concepts o Annotations o Assertions – Junit, Hamcrest, Google Truth o Assumption o Tags and Filtering 26

Slide 27

Slide 27 text

@arafkarsh arafkarsh JUnit 5 – Unit Testing 27 Assert @BeforeAll @BeforeEach @Test @AfterEach @AfterAll System Under Test All the Test Cases Setup Check Verify Teardown Test Suites Teardown All Setup All 5

Slide 28

Slide 28 text

@arafkarsh arafkarsh JUnit 5 – Test Annotations 28 @Test @RepeatedTest @ParametrizedTest @NestedTest @ValueSource @EnumSource @MethodSource @CsvSource @CsvFileSource @ArgumentSource @DisplayName Give meaningful name for your tests @Tag Categorize and Filter your tests. @Order Execute your tests in a specific order. @Disabled Disables your test

Slide 29

Slide 29 text

@arafkarsh arafkarsh JUnit 5 – Tags and Filtering 29 Functional Non-Functional Performance Usability Security Accessibility Stress Load

Slide 30

Slide 30 text

@arafkarsh arafkarsh JUnit 5 – Meta Annotations 30 Non-Functional Performance Load

Slide 31

Slide 31 text

@arafkarsh arafkarsh Filtering in POM File using SureFire Plugin o Tags allow you to selectively execute specific tests during the build process, offering greater flexibility and control. o For instance, if you have tags such as All, Unit, Component, Contract, and Integration, and you only want to run Component and Contract tests while excluding Non- Functional tests, you can easily configure your test suite to achieve this. Component, Contract Non-Functional

Slide 32

Slide 32 text

@arafkarsh arafkarsh Basic Assertions in JUnit 5 32 Assertion Details fail Fails a test with a given message and or Exception assertTrue Validates that the supplied Condition is True assertFalse Validates that the supplied Condition is False assertNull Validates the the supplied Object is Null assertEquals Validates that 2 supplied Objects are equal assertArrayEquals Validates that 2 supplied Arrays are equals assertIterableEquals Validates that 2 supplied Iterable Objects are equal. assertLineMatch Validates that 2 lines of Strings are equal. assertNotEquals Validates that 2 supplied Objects are NOT Equal assertSame Validates that 2 Object are same – compared with == assertNotSame Validates that 2 Objects are not same – compared with != assertAll Groups different Assertion at the same time assertThrows To verify that a given Exception is thrown from piece of code. assertTimeout Verifies the timeout of a given operation assertTimeoutPreemptively If the timeout exceeds then terminated. 3rd Party Assertions assertThat An object is matched with a Matcher to see if it meets the expectation.

Slide 33

Slide 33 text

@arafkarsh arafkarsh Basic Assertions in JUnit 5 33 Key Assertions: • assertEquals(expected, actual): Checks if two values are equal. • assertNotEquals(expected, actual): Ensures two values are not equal. • assertTrue(condition): Validates that the condition is true. • assertFalse(condition): Validates that the condition is false. • assertNull(object): Ensures that the object is null. • assertNotNull(object): Ensures that the object is not null. • assertThrows(expectedException, executable): Verifies that a specific exception is thrown. JUnit (particularly JUnit 5) provides a set of straightforward and commonly used assertions to validate test outcomes. These assertions are designed to be simple and effective for unit testing.

Slide 34

Slide 34 text

@arafkarsh arafkarsh Hamcrest Assertions 34 Hamcrest is a library focused on matcher-based assertions, which provide a more flexible and readable way to define assertions. It is often used alongside JUnit to enhance test readability. Key Features: • Provides matchers for complex assertions (e.g., collections, strings). • Improves readability with natural language-like syntax (assertThat). Common Matchers: • is(equalTo(value)): Asserts equality. • not(value): Asserts inequality. • containsString(substring): Checks if a string contains a specific substring. • hasItem(value): Checks if a collection contains a specific item. • everyItem(greaterThan(value)): Verifies all elements in a collection match a condition.

Slide 35

Slide 35 text

@arafkarsh arafkarsh Google Truth Assertions 35 Google Truth is a fluent assertion library developed by Google, emphasizing readability and clarity. Its syntax is designed to flow naturally, making tests easy to understand. Key Features: • Fluent, chainable syntax. • Built-in support for collections, strings, exceptions, and more. • Customizable with user-defined assertions. Common Assertions: • assertThat(value).isEqualTo(expected): Checks equality. • assertThat(value).isNotEqualTo(unexpected): Ensures inequality. • assertThat(collection).contains(value): Validates that a collection contains a value. • assertThat(string).contains(substring): Verifies a substring is present. • assertThat(exception).hasMessageThat().contains(“message”): Validates exception messages.

Slide 36

Slide 36 text

@arafkarsh arafkarsh Feature JUnit 5 Hamcrest Google Truth AssertJ Purpose Basic unit test assertions. Matcher-based assertions for expressive and flexible checks. Fluent, readable assertions focused on clarity and correctness. Fluent, feature-rich assertions for comprehensive testing. Core Design Simple assertions for correctness. Provides matchers for complex conditions (e.g., is, not, allOf). Fluent API with a focus on readability and developer-friendly syntax. Fluent API with an extensive range of built-in assertions and chaining capabilities. Simplicity Simple and direct; suitable for basic tests. Requires matchers, making it slightly more verbose. Clean and readable, ideal for concise assertions. Very intuitive and natural; supports chaining for compact and clear assertions. Use Case Lightweight, straightforward tests for correctness. Best for expressive, matcher-based checks (e.g., for collections). Readable assertions with great support for collections, strings, and exceptions. Advanced and detailed testing with extensive type support, ideal for large and complex projects. Fluency Limited fluency; separate assertions for each check. Moderate; matchers add some readability but lack full chaining. Fluent API for single assertions; limited chaining support. Fully fluent API with comprehensive chaining support. Basic Assertions assertEquals, assertTrue, assertNull. assertThat(actual, is(expected)), not(equalTo(value)). assertThat(actual).isEqualTo(expected), isNotEqualTo(value). assertThat(actual).isEqualTo(expected), isNotEqualTo(value). String Assertions Limited: assertTrue(string.contains(substring)). assertThat(string, containsString(substring)). assertThat(string).contains(substring), startsWith(prefix). assertThat(string).contains(substring), startsWith(prefix), matches(regex). Date Assertions Limited, requires manual comparisons or third-party support. Limited to custom matchers or external libraries. Moderate: isBefore(date), isAfter(date). Extensive: isBefore(date), isAfter(date), isBetween(start, end). Collection Assertions Limited: assertTrue(collection.contains(item)). assertThat(collection, hasItem(item)), contains(expectedItems). assertThat(collection).contains(item), doesNotContain(item). Rich API: contains(item), containsExactly(items), containsAnyOf(items). Chaining Assertions Not supported. Limited; chaining possible with combined matchers (allOf, anyOf). Partially supported; multiple assertThat calls required. Fully supported; allows chaining multiple assertions for compact and readable tests. Exception Assertions assertThrows(Exception.class, () -> code). Limited; exceptions must be handled manually. Fluent: assertThatThrownBy().hasMessageThat(). Rich API: assertThatThrownBy().isInstanceOf().has MessageContaining(). Community Support Extremely high (core part of JUnit ecosystem). Good, widely used, but overshadowed by modern libraries. Strong, with Google backing and active updates. Very strong, widely adopted in enterprise projects and actively maintained.

Slide 37

Slide 37 text

@arafkarsh arafkarsh JUnit 4 >> JUnit 5 37 JUnit 4 JUnit 5 @BeforeClass Executed Before All @Test in the Current Class @BeforeAll @Before Executed Before each @Test @BeforeEach @After Executed After Each @Test @AfterEach @AfterClass Executed After All @Test in the Current Class @AfterAll @Category To Group the test cases @Tag

Slide 38

Slide 38 text

@arafkarsh arafkarsh Junit 5 – Parametrized Tests 38 Value Source Enum Source

Slide 39

Slide 39 text

@arafkarsh arafkarsh JUnit 5 – Parametrized Tests 39 CSV Source CSV File Source

Slide 40

Slide 40 text

@arafkarsh arafkarsh JUnit 5 – Parametrized Tests 40 Method Source

Slide 41

Slide 41 text

@arafkarsh arafkarsh JUnit 5 – Parametrized Tests 41 Argument Source Argument Source Provider

Slide 42

Slide 42 text

@arafkarsh arafkarsh JUnit 5 – Nested Tests 42

Slide 43

Slide 43 text

@arafkarsh arafkarsh JUnit 5 – Repeated Tests 43

Slide 44

Slide 44 text

@arafkarsh arafkarsh 2 Component / Contract Testing o Behavior Driven Development o Mockito o SpringBoot Test o Rest Assured o Cucumber 44

Slide 45

Slide 45 text

@arafkarsh arafkarsh Features of BDD 45 • Focus on Behavior of the System rather than tests. • Collaboration between Business Stake holders, Analysts, Developers, QA. • Ubiquitous Language • Driven By Business Value • Extends Test Driven Development https://cucumber.io/ Free and Open-Source Framework for Java Stack. Free and Open Source BDD Framework for .Net Stack https://specflow.org/

Slide 46

Slide 46 text

@arafkarsh arafkarsh Behavior Driven Development 46 Source: https://dannorth.net/introducing-bdd/ As an insurance Broker I want to know who my Gold Customers are So that I sell more Given Customer John Doe exists When he buys insurance ABC for $1000 USD Then He becomes a Gold Customer BDD Construct Role-Feature-Reason Matrix As a Customer I want to withdraw Cash from ATM So that I don’t have to wait in line at the bank Given The account is in Credit AND the Card is Valid AND the dispenser contains Cash BDD Construct Role-Feature-Reason Matrix When The Customer requests Cash Then Ensure that the Account is debited AND Ensure cash is dispensed AND ensure that Card is returned.

Slide 47

Slide 47 text

@arafkarsh arafkarsh Theme/Epic – Shopping Portal / Cart 47 As a Consumer I want to Add a Product to Cart So that I can buy the product Role-Feature-Reason Matrix User Story – 1: Add to Cart BDD Acceptance Criteria – 1: Add to Cart Given The user logged into the portal and a Product is selected and Product details are available When The user then clicks Add to Cart Button Then The system will add the Item (Product) into the card and Updates Item counter in the Cart Icon AND Saves the Cart information in the DB AND if the save fails the system shows an Error “Unable to Add Product to the Cart”. BDD Acceptance Criteria – 2: Save Cart Given The Request is authenticated When The Input contains user login id, product id Then The system will add the Item (Product) into the Cart & Saves the Cart information in the DB AND if the save fails the system shows an Error “Unable to Add Product to the Cart”.

Slide 48

Slide 48 text

@arafkarsh arafkarsh Theme/Epic – Shopping Portal / Customer 48 As a Consumer I want to Select Shipping Address So that I can ship the items to that Address Role-Feature-Reason Matrix User Story – 2: Select Address BDD Acceptance Criteria – 1 : Show Address Given The user in the Shopping Cart Page When User Clicks Proceed to Buy Button Then The System shows the Available Address for Shipping BDD Acceptance Criteria – 2 : Select Address Given The user in the Shopping Cart Page with Available Shipping Address When User Selects Address and Clicks Proceed to Buy Then The System save the Temp Order details from Items from Shopping and Selected Shipping Address AND this details are valid only for the user session. If the order is not placed Temp Order items will be put back in Cart DB BDD Acceptance Criteria – 3 : Save Temp Order Given The Request is authenticated When Input contains user login id, items, shipping address Then The System save the Temp Order details from Items from Shopping and Selected Shipping Address AND this details are valid only for the user session. If the order is not placed Temp Order items will be put back in Cart DB

Slide 49

Slide 49 text

@arafkarsh arafkarsh Theme/Epic – Shopping Portal / Order 49 As a Consumer I want to Process the Order So that I can buy products Role-Feature-Reason Matrix User Story – 1 : Process Order BDD Acceptance Criteria – 1 : Add Payment Given The user in the Order Cart Page with Items and selected Shipping Address When User Selects Payment Option As Credit Card AND Input the Credit Card Details in the following fields Card Name, Card No. Expiry Date, CVV Number Then The System Validates the Credit Card Number and the Expiry Date and Card Name & CVV Must NOT be Null IF Invalid Systems says invalid Payment details else Saves the info and proceed for payment. BDD Acceptance Criteria – 3 : Save Payment Given The Request is authenticated When Input contains user login id, order id, payment details (card number only last 4 digits) Then The System Validates the Credit Card Number and the Expiry Date and Card Name and CVV Must NOT be Null IF Invalid Systems returns invalid Payment details ELSE Saves the following info Card Name, Card Number (only last 4 digits), Expiry Date BDD Acceptance Criteria – 3 : Payment Gateway Given The Request is authenticated When Input contains Valid payment details Then With the Valid Payment Details System calls External Payment Service for Payment Processing and Returns Result to Calling System

Slide 50

Slide 50 text

@arafkarsh arafkarsh As a Patient I want to get diagnosed by a Doctor So that I can be healthy again Role-Feature-Reason Matrix User Story – 1 : Patient Diagnosis BDD Acceptance Criteria – 1 : Show Patient Info Given The Patient John Doe Exists and has an Appointment with the doctor When The Doctor selects the Patient Info Then The System shows the Patient Info with following details Patient Name, Age, Gender, Contact No. and the Health info contains the following Pulse, Blood Pressure, Height and Weight BDD Acceptance Criteria – 2 : Add Diagnosis Given Patient Details are Available When Doctor Selects Add Diagnosis Then The system shows a text area for adding the diagnosis and the doctor can add multiple diagnosis. BDD Acceptance Criteria – 4 : Save Diagnosis Given The Request is authenticated When Input contains Patient Diagnosis Details Then With the Valid Patient Diagnosis Details and the system will save the data send the response back to the user. BDD Acceptance Criteria – 3 : Add Prescription Given Patient Details & Diagnosis are Available When Doctor Selects Add Prescription Then The system shows a text area for adding the prescription, and the frequency of usage in a day and for how many days, and the doctor can add multiple prescription. Theme/Epic – Hospital / Diagnosis 50

Slide 51

Slide 51 text

@arafkarsh arafkarsh Mock Testing Tools Trends for the Last 10 Years 51

Slide 52

Slide 52 text

@arafkarsh arafkarsh Mockito Component / Mock / Contract Testing 52

Slide 53

Slide 53 text

@arafkarsh arafkarsh Mock Testing Tools Trends for Last 5 Years 53

Slide 54

Slide 54 text

@arafkarsh arafkarsh Mockito Concepts 54 Verify 3. Verify Expectations and Results Verify Result 1. Set the expectations Expect When() Then Return() Use 2. Use the object being tested Test your Component

Slide 55

Slide 55 text

@arafkarsh arafkarsh 55 Mockito Concepts

Slide 56

Slide 56 text

@arafkarsh arafkarsh Annotation – @Mock, @InjectMock 56 Create Mocks for 1. Repository 2. Payment Service Inject the Mocks into Order Service Scenario Create Mocks for the following 1. Repository Service 2. Payment Service Annotations • @Mock • @InjectMocks Test Cases 1. Given a Valid Order 2. Test for Payment Accepted 3. Test for Payment Declined

Slide 57

Slide 57 text

@arafkarsh arafkarsh 57 Stubbing: when().thenReturn() Test Cases Given a Valid Order 1. Test for Payment Accepted 2. Test for Payment Declined

Slide 58

Slide 58 text

@arafkarsh arafkarsh Annotation - @Spy 58 Spy works on the Actual Implementation Inject the Mocks into Order Service Scenario Create Mocks for the following 1. Packaging Service 2. Shipping Service Annotations • @Spy • @Mock • @InjectMocks Test Cases 1. Given a Valid Paid Order 2. Test for Packaging 3. Test for Shipping

Slide 59

Slide 59 text

@arafkarsh arafkarsh Annotation - @Spy 59 Scenario – 1 Create Mocks for the following 1. Packaging Service 2. Shipping Service Annotations • @Spy • @Mock • @InjectMocks Test Cases 1. Given a Valid Paid Order 2. Test for Packaging 3. Test for Shipping

Slide 60

Slide 60 text

@arafkarsh arafkarsh Annotation – @Spy 60 Scenario – 2 Create Mocks for the following 1. Packaging Service 2. Shipping Service Annotations • @Spy • @Mock • @InjectMocks Test Cases 1. Given a Valid Paid Order 2. Test for Packaging 3. Test for Shipping

Slide 61

Slide 61 text

@arafkarsh arafkarsh Annotation – @Spy 61 Scenario – 3 Create Mocks for the following 1. Packaging Service 2. Shipping Service Annotations • @Spy • @Mock • @InjectMocks Test Cases 1. Given a Valid Paid Order 2. Test for Packaging 3. Test for Shipping

Slide 62

Slide 62 text

@arafkarsh arafkarsh Advanced Features 62 Scenario Shipping Service with Delivery City Details for the final Shipment Mockito Advanced Features 1. Argument Matcher 2. Built In Answer 3. Storing Arguments – Captor 4. Ordering the Input – InOrder 5. Counts 6. Throwing Exceptions

Slide 63

Slide 63 text

@arafkarsh arafkarsh Argument Matcher – Basic Mathers 63 Matcher Description Example any() Matches any value (of any type). when(mock.someMethod(any())) .thenReturn(value); anyString() Matches any String value. when(mock.someMethod(anyString())) .thenReturn("response"); isNull() Matches null. when(mock.someMethod(isNull())) .thenThrow(new NullPointerException()); eq(value) Matches the exact value provided. when(mock.someMethod(eq("specific value"))) .thenReturn("response");

Slide 64

Slide 64 text

@arafkarsh arafkarsh Argument Matchers – Logical Matchers 64 Matcher Description Example or(arg1, arg2) Matches if either arg1 or arg2 is true. when(mock.someMethod (or(eq("value1"), eq("value2")))) .thenReturn("response"); and(arg1, arg2) Matches only if both arg1 and arg2 are true. when(mock.someMethod (and(notNull(), anyString()))) .thenReturn("response"); not(arg) Matches if the argument does not match arg. when(mock.someMethod (not(eq("invalid")))) .thenReturn("response");

Slide 65

Slide 65 text

@arafkarsh arafkarsh Advanced Features – Argument Matcher 65

Slide 66

Slide 66 text

@arafkarsh arafkarsh Advanced Features – Built in Answers 66

Slide 67

Slide 67 text

@arafkarsh arafkarsh Advanced Features – Built in Answers 67

Slide 68

Slide 68 text

@arafkarsh arafkarsh Advanced Features – Captor : Argument Capture 68

Slide 69

Slide 69 text

@arafkarsh arafkarsh Advanced Features: InOrder 69

Slide 70

Slide 70 text

@arafkarsh arafkarsh Advanced Features – Count : External Calls 70

Slide 71

Slide 71 text

@arafkarsh arafkarsh Advanced Features – Catching Exception 71

Slide 72

Slide 72 text

@arafkarsh arafkarsh Cucumber • Features • Steps 72

Slide 73

Slide 73 text

@arafkarsh arafkarsh BDD Specs 73 BDD Style Specs for Searching for a Product in Amazon

Slide 74

Slide 74 text

@arafkarsh arafkarsh Cucumber JUnit 4 Integration 74 Specs Definition Steps for Testing

Slide 75

Slide 75 text

@arafkarsh arafkarsh Step Definitions 75 Dependency Injection

Slide 76

Slide 76 text

@arafkarsh arafkarsh Specs for Payment Criteria 76

Slide 77

Slide 77 text

@arafkarsh arafkarsh Cucumber Junit 4 Integration 77 Specs Definition Steps for Testing

Slide 78

Slide 78 text

@arafkarsh arafkarsh SpringBootTest 2 With JUnit 5 78

Slide 79

Slide 79 text

@arafkarsh arafkarsh Spring Boot Test 79 1. Getting Application Context 2. Auto wiring the dependencies 3. JUnit 5 Based Examples ✓ This is required for WireMock and Pact Actual Payment Service Implementation is loaded

Slide 80

Slide 80 text

@arafkarsh arafkarsh SpringBootTest POM Config for JUnit 5 80 Exclude Default JUnit 4 SBT v 2.5.3

Slide 81

Slide 81 text

@arafkarsh arafkarsh REST Assured o Concept o General Test Cases o Security Test Cases o Other Test Cases 81

Slide 82

Slide 82 text

@arafkarsh arafkarsh Features 82 1. DSL (Domain Specific Language): REST Assured provides a robust set of DSL keywords like given, when, then, post, get, etc., which are easy to understand and help write expressive tests. 2. Request and Response Specification: REST Assured allows you to set common properties that can be shared across multiple tests. For example, if all your API endpoints require standard headers, you can set them in a request specification and use them in all your tests. 3. Path, Query, and Form Parameters: REST Assured provides manageable methods to set path parameters, query parameters, and form parameters. 4. Headers and Cookies: You can easily set headers and cookies in your requests. 5. Authentication: REST Assured supports multiple types of authentication, like Basic, Digest, Form, OAuth, etc. 6. Content Parsing: REST Assured can automatically parse JSON and XML responses. This allows you to navigate the response body and perform validations efficiently. 7. Validations: REST Assured supports a variety of validations, including status codes, headers, cookies, and body.

Slide 83

Slide 83 text

@arafkarsh arafkarsh Embedded Springboot App 83 Embedded Server

Slide 84

Slide 84 text

@arafkarsh arafkarsh GET Request 84

Slide 85

Slide 85 text

@arafkarsh arafkarsh POST Request 85

Slide 86

Slide 86 text

@arafkarsh arafkarsh Put Request 86

Slide 87

Slide 87 text

@arafkarsh arafkarsh Delete Request 87

Slide 88

Slide 88 text

@arafkarsh arafkarsh Shared Specs 88

Slide 89

Slide 89 text

@arafkarsh arafkarsh Shared Specs 89 Shared Specs across multiple test cases.

Slide 90

Slide 90 text

@arafkarsh arafkarsh Security: Deny Page rendering in Frame 90

Slide 91

Slide 91 text

@arafkarsh arafkarsh XSS Protection 91

Slide 92

Slide 92 text

@arafkarsh arafkarsh 3 Integration / Contract Testing o WireMock o Pact 92

Slide 93

Slide 93 text

@arafkarsh arafkarsh WireMock o Without SpringBootTest o With SpringBootTest 93

Slide 94

Slide 94 text

@arafkarsh arafkarsh WireMock Architecture 94 Service (Client) WireMock Request Mapping Response Data HTTP/S Calls

Slide 95

Slide 95 text

@arafkarsh arafkarsh Use Case – Order and Payment Service 95 Worker Nodes Order Pod Order Pod Order Pod Order Service N4 N3 MySQL DB EndPoints N2 Payment Pod Payment Pod Payment Pod Payment Service Service Call Kube DNS EndPoints 1. Order and Payment Service are loosely coupled. 2. Both need to be tested without any dependencies. 3. Payment Service is an External Service, So a Mock Server is required to do the integration Testing.

Slide 96

Slide 96 text

@arafkarsh arafkarsh WireMock – Setup 96 1. WireMock Mock Payment Server is setup. 2. Payment Service is initialized with Payment Gateway (Pointing to Mock HTTP Server). 3. Step 2 is required if SpringBootTest is Not used.

Slide 97

Slide 97 text

@arafkarsh arafkarsh WireMock – Payment Accepted 97

Slide 98

Slide 98 text

@arafkarsh arafkarsh WireMock – Payment Declined 98

Slide 99

Slide 99 text

@arafkarsh arafkarsh WireMock with SpringBootTest 99 Actual Payment Service & Config Implementation is loaded

Slide 100

Slide 100 text

@arafkarsh arafkarsh PACT o Consumer Driven Contracts o Provider Verification o Pact Broker o Comparison Mockito / WireMock / Pact 100

Slide 101

Slide 101 text

@arafkarsh arafkarsh Use Case – Product and Product Review Service 101 Worker Nodes Product Pod Product Pod Product Pod Product Service N4 N3 MySQL DB EndPoints N2 Review Pod Review Pod Review Pod Review Service N4 N3 N1 Service Call Kube DNS EndPoints Mongo DB 1. Product and Product Reviews are two Microservices getting developed independently. 2. Both need to be tested without any dependencies. 3. Contract is driven by Product Service (Consumer of Product Review).

Slide 102

Slide 102 text

@arafkarsh arafkarsh E2E Testing Vs. Integration Testing 102 Product Service Mock Provider Review Service Review Service Mock Consumer Product Service Break the Test into 2 independently testable units. Product Service Review Service End 2 End Testing is Time Consuming and Error Prone

Slide 103

Slide 103 text

@arafkarsh arafkarsh PACT Architecture – Consumer Testing 103 Product Service Mock Provider Expected Request Minimal Response Interaction • Pact = A contract between Consumer and Provider • Each Pact is a collection of interactions Compare Reply Expected Request Minimal Response Interaction Provider State Pact – Contract between Consumer & Provider Once the Consumer Testing is done Pact file is generated by Pact Framework Pact Broker Publish Pacts to Pact Broker pact-broker publish --consumer-app-version 1.0.0 --broker-base-url https://broker.com --broker-token SomeToken /path/to/pacts/consumer-provider.json --tag master $>

Slide 104

Slide 104 text

@arafkarsh arafkarsh PACT Architecture – Provider Testing 104 Review Service Mock Consumer Expected Request Minimal Response Interaction Provider State Compare Send Once the Consumer Testing is done Pact file is generated by Pact Framework Expected Request Minimal Response Interaction Provider State Pact – Contract between Consumer & Provider

Slide 105

Slide 105 text

@arafkarsh arafkarsh Pact Definition 105 Provider Name Consumer Name Contract Definition • @PactTestFor : Provider • @Pact : Consumer • Building Request / Response Pact

Slide 106

Slide 106 text

@arafkarsh arafkarsh Pact Definition 106 Consumer Name Contract Definition • @PactTestFor : Provider • @Pact : Consumer • Building Request / Response Pact • Running Consumer Pact Test

Slide 107

Slide 107 text

@arafkarsh arafkarsh Pact Contract JSON 107 1. Contract Defines the Provider and Consumer 2. N number of Interactions can be defined under a single Contract 3. Interaction Defines Request, Response, Provider States, Rules etc. 4. Pact Specs v3.0

Slide 108

Slide 108 text

@arafkarsh arafkarsh Pact : When to use? 108 ✓ Development of Consumer / Provider is controlled by your team/department/org. ✓ No. of Consumers are small for a given Provider ✓ Consumer and Provider are under active development. ✓ Consumer Driven Contract – Provider features are driven by Consumer. ✓ Provider team can easily control the data in the response. Pact is Good for When Source: https://docs.pact.io/getting_started/what_is_pact_good_for ✓ Both teams (Consumer & Provider) don’t use Pact. ✓ When the Consumers can’t be identified (Public APIs) ✓ Functional / Behavior Testing of the Provider ✓ Functionality is Driven by the Provider. ✓ Performance and Load Testing ✓ You can’t control the Response Data. Pact is NOT Good When

Slide 109

Slide 109 text

@arafkarsh arafkarsh Comparison – Mockito / Pact 109 # Feature Mockito WireMock Pact TEST SCOPE >>> API Wire Inter Service 1 Contract Testing Yes Yes Yes 2 Behavior / Functional Testing Yes 3 Test Double (Mock Provider) Yes 4 Consumer / Provider Testing using Shared Contract Yes 5 Mock System (For Consumer / Provider) Yes Yes 6 Multi Protocol Support (HTTP, Messaging) HTTP Yes 7 Centralized Contract Management Yes 8 API Documentation and Version Management Yes 9 Record and Playback Yes Yes 10 Supports JSON/XML Yes Yes

Slide 110

Slide 110 text

@arafkarsh arafkarsh 4 Monitoring / Performance Testing o Dynatrace o Java Visual VM o Apache JMeter 110

Slide 111

Slide 111 text

@arafkarsh arafkarsh Dynatrace 111 DynaTrace is an application performance management tool that provides real-time visibility and AI-powered insights into every process across your entire digital ecosystem. It covers end-to-end transaction tracing, synthetic monitoring, real user monitoring, infrastructure monitoring, and more. In a Java environment, DynaTrace helps monitor the performance of Java applications by tracing requests from end to end within the context of the Java Virtual Machine. It provides a detailed view of your applications’ health and allows you to find performance bottlenecks.

Slide 112

Slide 112 text

@arafkarsh arafkarsh Java VisualVM 112

Slide 113

Slide 113 text

@arafkarsh arafkarsh Java VisualVM 113 VisualVM is a visual tool integrating several command-line JDK tools and lightweight performance and memory profiling capabilities. Its primary purpose is to monitor, troubleshoot, and profile Java applications. It can display detailed live information about Java applications while running on a JVM, including their process ID, consumed CPU time, class loading, and system properties.

Slide 114

Slide 114 text

@arafkarsh arafkarsh Java VisualVM – Monitor 114

Slide 115

Slide 115 text

@arafkarsh arafkarsh Java VisualVM – Visual GC 115

Slide 116

Slide 116 text

@arafkarsh arafkarsh Java Heap and GC o Java Memory Space o Java Garbage Collection o Java Garbage Collectors 116

Slide 117

Slide 117 text

@arafkarsh arafkarsh Java Memory Space 117 1. Eden Space: All new objects are initially created in the Eden space in the Young Generation. This area is typically larger than each Survivor Space (S0 and S1). 2. Survivor Spaces (S0 and S1): Live objects from Eden are moved to the first Survivor space (S0). When the following Minor Garbage Collection occurs, live objects from Eden and those still live from S0 are moved to the other Survivor space (S1). Objects that have survived several rounds of Minor GC are aged, and once they reach a certain age threshold, they are promoted to the Old Generation (Tenured space). 3. Old Generation (Tenured): This space is typically much larger than the Young Generation. When an object has survived several rounds of Minor Garbage Collection (the exact count is determined by the JVM parameter Survivor Ratio), it is moved from the Young Generation to the Old Generation. When the Old Generation becomes full, a Major Garbage Collection (also known as Full GC) is triggered. 4. Permanent Generation (or Metaspace since Java 8): This is the heap area used to store metadata about the classes in your Java application. Class definitions, method definitions, and other metadata are stored here. This space is also garbage collected.

Slide 118

Slide 118 text

@arafkarsh arafkarsh Java Garbage Collection 118 1. Minor Garbage Collection: A Minor Garbage Collection is triggered when Eden space fills up. Objects in Eden that are still in use ("live") are moved to one of the Survivor spaces (S0), and the rest are discarded. Eden space is then emptied and ready for new objects. 2. Major Garbage Collection: A Major GC is more time-consuming as it involves all the application's live objects. The JVM checks the Old Generation and reclaims memory used by the non-live objects. Usually, a Major GC takes longer to run and will have a higher impact on the application's performance.

Slide 119

Slide 119 text

@arafkarsh arafkarsh Java Garbage Collection 119 Metaspace Eden S0 S1 Tenured Young Generation Old Generation Java Heap (-Xms –Xmx) Ex. 900 MB Heap Size 240 MB 30 30 600 MB 2/3 of Memory 1/3 of Memory

Slide 120

Slide 120 text

@arafkarsh arafkarsh Java Garbage Collectors 120 1. Serial GC (Serial Collector): This is the simplest garbage collector and it uses a single thread for garbage collection. It's useful for single-processor machines since it doesn't benefit from multiple processors. Serial GC pauses all application threads during garbage collection which can affect the performance of the application. It is selected by default on certain systems and for certain configurations. 2. Parallel GC (Throughput Collector): This garbage collector uses multiple threads for garbage collection, thus making it more efficient on multi-processor machines. It's also a generational collector like the Serial GC but it uses multiple threads to speed up the garbage collection. Parallel GC is the default GC for many JVM configurations. 3. CMS GC (Concurrent Mark Sweep Collector): This collector aims to minimize the pauses due to garbage collection by doing most of the garbage collection work concurrently with the application threads. It's designed for applications that prefer shorter garbage collection pauses and can afford to share processor resources with the garbage collector while the application is running. 4. G1 GC (Garbage-First Collector): G1 GC is a server-style garbage collector targeted for multi-processor machines with large memories. It meets garbage collection (GC) pause time goals with high probability while achieving high throughput. 5. ZGC (Z Garbage Collector) and Shenandoah GC: These are newer garbage collectors introduced in more recent versions of the JVM (Java 11 and onwards), that focus on delivering low pause times without being constrained to a particular size of the heap or application. From 200 MB to 200 GB, the pause times are consistent.

Slide 121

Slide 121 text

@arafkarsh arafkarsh Java Garbage Collection 121 java -XX:+UseG1GC -jar springboot.jar $ Garbage Collector Usasge Version 1 Serial Collector -XX:+UseSerialGC 1.0 2 Parallel (Throughput) Collector -XX:+UseParallelGC 1.4 3 CMS Collector -XX:+UseConcMarkSweepGC 1.4.2 4 G1 Collector -XX:+UseG1GC 9 5 ZGC -XX:+UseZGC 11 6 Shenandoah -XX:+UseShenandoahGC 12

Slide 122

Slide 122 text

@arafkarsh arafkarsh Apache JMeter o Thread Groups o Headers / Cookies / Http Calls o Assertions o Reports 122

Slide 123

Slide 123 text

@arafkarsh arafkarsh Apache JMeter 123 Apache JMeter is open-source software first developed by Stefano Mazzocchi of the Apache Software Foundation. It is a pure Java application designed for load testing and measuring performance. It can be used to simulate a heavy load on a server, network, or object to test its strength or to analyze overall performance under different load types.

Slide 124

Slide 124 text

@arafkarsh arafkarsh JMeter – Thread Group 124

Slide 125

Slide 125 text

@arafkarsh arafkarsh JMeter – Http Call 125

Slide 126

Slide 126 text

@arafkarsh arafkarsh JMeter – Report: Results Tree 126

Slide 127

Slide 127 text

@arafkarsh arafkarsh JMeter – Report: Results Table 127

Slide 128

Slide 128 text

@arafkarsh arafkarsh JMeter – Report: Results Summary 128

Slide 129

Slide 129 text

@arafkarsh arafkarsh JMeter – Result: Aggregate Summary 129

Slide 130

Slide 130 text

@arafkarsh arafkarsh Comparison o Dynatrace o Java VisualVM o Apache JMeter 130

Slide 131

Slide 131 text

@arafkarsh arafkarsh DynaTrace / Java VisualVM / JMeter 131 Feature/Aspect Dynatrace Visual VM JMeter Purpose Application performance management & monitoring Monitoring, troubleshooting & profiling Java apps Load & performance testing Functionality End-to-end tracing, Synthetic monitoring, etc JVM operation insights Simulate heavy load, performance analysis Usability User-friendly, commercial tool Part of JDK, less user-friendly Open-source, vast community Cost Commercial Free (open-source) Free (open-source) Adaptability Supports a wide range of applications/platforms Specific to Java Primarily for web applications Real-time Monitoring Yes Yes No AI-powered insights Yes No No Load testing No No Yes License Type Commercial GPL v2 with the Classpath Exception Apache License 2.0 Open Source No Yes Yes

Slide 132

Slide 132 text

@arafkarsh arafkarsh JMeter Command Line 132 jmeter -n -t ms-sb-272-j8.jmx -l ms-sb-272-j8-2023-06-20-13-27-20.jtl -e -o jmoutput-2023-06-20-13-27-20 $ Please run the “run” script inside the jmeter folder

Slide 133

Slide 133 text

@arafkarsh arafkarsh Jmeter Command Line Output 133

Slide 134

Slide 134 text

@arafkarsh arafkarsh Conclusion 134

Slide 135

Slide 135 text

@arafkarsh arafkarsh Microservices Testing Scenarios / Tools 135 Testing Tools Contract Testing Scope Integration Testing Verifies the communication paths and interactions between components to detect interface defects Contract Testing It is a test at the boundary of an external service verifying that it meets the contract expected by a consuming service. Payment Mock Integration Contract Testing Scope Test Double Montebank Cart Component Testing Unit Testing Integration Testing Scope Order REST / HTTP or Events / Kafka Item ID, Quantity, Address.. Mock Order Component Testing A component test limits the scope of the exercised software to a portion of the system under test. Order Payment Unit Testing Firewall Integration Testing Scope REST / HTTP Payment Sandbox Component Testing U

Slide 136

Slide 136 text

@arafkarsh arafkarsh Microservices Testing Strategies 136 E2E Testing Integration Testing Contract Testing Component Testing Unit Testing Number of Tests Speed Cost Time Mike Cohen’s Testing Pyramid Test Pyramid: https://martinfowler.com/bliki/TestPyramid.html 75% 25% 0% Ubiquitous Language Domain Expert Analyst Developers QA Design Docs Test Cases Code Architect

Slide 137

Slide 137 text

@arafkarsh arafkarsh Chaos Engineering – Load / Stress / Performance 137 Chaos Monkey Randomly disables production instances Chaos Kong Similar to Chaos Monkey, simulates an outage of an entire Amazon availability zone. Doctor Monkey Checks CPU load, Memory usage and removes it from network if the health is bad. Janitor Monkey Search for unused resources and disposes them. Compliance Monkey Finds instances that don’t adhere to best-practices and shuts them down. Latency Monkey Induces Artificial delays Security Monkey Is an extension of Compliance Monkey. Find security vulnerabilities and terminates offending instances. Source: https://github.com/Netflix/SimianArmy/wiki Source: http://principlesofchaos.org/

Slide 138

Slide 138 text

@arafkarsh arafkarsh Testing Strategy Summary 138 1. Unit Testing A unit test exercises the smallest piece of testable software. 2. Component Testing A component test limits the scope of the exercised software to a portion of the system under test. 3. Contract Testing It is a test at the boundary of an external service verifying that it meets the contract expected by a consuming service 4. Integration Testing It verifies the communication paths and interactions between components to detect interface defects.

Slide 139

Slide 139 text

@arafkarsh arafkarsh 139 100s Microservices 1,000s Releases / Day 10,000s Virtual Machines 100K+ User actions / Second 81 M Customers Globally 1 B Time series Metrics 10 B Hours of video streaming every quarter Source: NetFlix: : https://www.youtube.com/watch?v=UTKIT6STSVM 10s OPs Engineers 0 NOC 0 Data Centers So what do NetFlix think about DevOps? No DevOps Don’t do lot of Process / Procedures Freedom for Developers & be Accountable Trust people you Hire No Controls / Silos / Walls / Fences Ownership – You Build it, You Run it.

Slide 140

Slide 140 text

@arafkarsh arafkarsh 140 Design Patterns are solutions to general problems that software developers faced during software development. Design Patterns

Slide 141

Slide 141 text

@arafkarsh arafkarsh 141 Thank you DREAM EMPOWER AUTOMATE MOTIVATE India: +91.999.545.8627 https://arafkarsh.medium.com/ https://speakerdeck.com/arafkarsh https://www.linkedin.com/in/arafkarsh/ https://www.youtube.com/user/arafkarsh/playlists http://www.slideshare.net/arafkarsh http://www.arafkarsh.com/ @arafkarsh arafkarsh LinkedIn arafkarsh.com Medium.com Speakerdeck.com

Slide 142

Slide 142 text

@arafkarsh arafkarsh 142 Slides: https://speakerdeck.com/arafkarsh Blogs https://arafkarsh.medium.com/ Web: https://arafkarsh.com/ Source: https://github.com/arafkarsh

Slide 143

Slide 143 text

@arafkarsh arafkarsh 143 Slides: https://speakerdeck.com/arafkarsh

Slide 144

Slide 144 text

@arafkarsh arafkarsh References 144 1. July 15, 2015 – Agile is Dead : GoTo 2015 By Dave Thomas 2. Apr 7, 2016 - Agile Project Management with Kanban | Eric Brechner | Talks at Google 3. Sep 27, 2017 - Scrum vs Kanban - Two Agile Teams Go Head-to-Head 4. Feb 17, 2019 - Lean vs Agile vs Design Thinking 5. Dec 17, 2020 - Scrum vs Kanban | Differences & Similarities Between Scrum & Kanban 6. Feb 24, 2021 - Agile Methodology Tutorial for Beginners | Jira Tutorial | Agile Methodology Explained. Agile Methodologies

Slide 145

Slide 145 text

@arafkarsh arafkarsh References 145 1. Vmware: What is Cloud Architecture? 2. Redhat: What is Cloud Architecture? 3. Cloud Computing Architecture 4. Cloud Adoption Essentials: 5. Google: Hybrid and Multi Cloud 6. IBM: Hybrid Cloud Architecture Intro 7. IBM: Hybrid Cloud Architecture: Part 1 8. IBM: Hybrid Cloud Architecture: Part 2 9. Cloud Computing Basics: IaaS, PaaS, SaaS 1. IBM: IaaS Explained 2. IBM: PaaS Explained 3. IBM: SaaS Explained 4. IBM: FaaS Explained 5. IBM: What is Hypervisor? Cloud Architecture

Slide 146

Slide 146 text

@arafkarsh arafkarsh References 146 Microservices 1. Microservices Definition by Martin Fowler 2. When to use Microservices By Martin Fowler 3. GoTo: Sep 3, 2020: When to use Microservices By Martin Fowler 4. GoTo: Feb 26, 2020: Monolith Decomposition Pattern 5. Thought Works: Microservices in a Nutshell 6. Microservices Prerequisites 7. What do you mean by Event Driven? 8. Understanding Event Driven Design Patterns for Microservices

Slide 147

Slide 147 text

@arafkarsh arafkarsh References – Microservices – Videos 147 1. Martin Fowler – Micro Services : https://www.youtube.com/watch?v=2yko4TbC8cI&feature=youtu.be&t=15m53s 2. GOTO 2016 – Microservices at NetFlix Scale: Principles, Tradeoffs & Lessons Learned. By R Meshenberg 3. Mastering Chaos – A NetFlix Guide to Microservices. By Josh Evans 4. GOTO 2015 – Challenges Implementing Micro Services By Fred George 5. GOTO 2016 – From Monolith to Microservices at Zalando. By Rodrigue Scaefer 6. GOTO 2015 – Microservices @ Spotify. By Kevin Goldsmith 7. Modelling Microservices @ Spotify : https://www.youtube.com/watch?v=7XDA044tl8k 8. GOTO 2015 – DDD & Microservices: At last, Some Boundaries By Eric Evans 9. GOTO 2016 – What I wish I had known before Scaling Uber to 1000 Services. By Matt Ranney 10. DDD Europe – Tackling Complexity in the Heart of Software By Eric Evans, April 11, 2016 11. AWS re:Invent 2016 – From Monolithic to Microservices: Evolving Architecture Patterns. By Emerson L, Gilt D. Chiles 12. AWS 2017 – An overview of designing Microservices based Applications on AWS. By Peter Dalbhanjan 13. GOTO Jun, 2017 – Effective Microservices in a Data Centric World. By Randy Shoup. 14. GOTO July, 2017 – The Seven (more) Deadly Sins of Microservices. By Daniel Bryant 15. Sept, 2017 – Airbnb, From Monolith to Microservices: How to scale your Architecture. By Melanie Cubula 16. GOTO Sept, 2017 – Rethinking Microservices with Stateful Streams. By Ben Stopford. 17. GOTO 2017 – Microservices without Servers. By Glynn Bird.

Slide 148

Slide 148 text

@arafkarsh arafkarsh References 148 Domain Driven Design 1. Oct 27, 2012 What I have learned about DDD Since the book. By Eric Evans 2. Mar 19, 2013 Domain Driven Design By Eric Evans 3. Jun 02, 2015 Applied DDD in Java EE 7 and Open Source World 4. Aug 23, 2016 Domain Driven Design the Good Parts By Jimmy Bogard 5. Sep 22, 2016 GOTO 2015 – DDD & REST Domain Driven API’s for the Web. By Oliver Gierke 6. Jan 24, 2017 Spring Developer – Developing Micro Services with Aggregates. By Chris Richardson 7. May 17. 2017 DEVOXX – The Art of Discovering Bounded Contexts. By Nick Tune 8. Dec 21, 2019 What is DDD - Eric Evans - DDD Europe 2019. By Eric Evans 9. Oct 2, 2020 - Bounded Contexts - Eric Evans - DDD Europe 2020. By. Eric Evans 10. Oct 2, 2020 - DDD By Example - Paul Rayner - DDD Europe 2020. By Paul Rayner

Slide 149

Slide 149 text

@arafkarsh arafkarsh References 149 Event Sourcing and CQRS 1. IBM: Event Driven Architecture – Mar 21, 2021 2. Martin Fowler: Event Driven Architecture – GOTO 2017 3. Greg Young: A Decade of DDD, Event Sourcing & CQRS – April 11, 2016 4. Nov 13, 2014 GOTO 2014 – Event Sourcing. By Greg Young 5. Mar 22, 2016 Building Micro Services with Event Sourcing and CQRS 6. Apr 15, 2016 YOW! Nights – Event Sourcing. By Martin Fowler 7. May 08, 2017 When Micro Services Meet Event Sourcing. By Vinicius Gomes

Slide 150

Slide 150 text

@arafkarsh arafkarsh References 150 Kafka 1. Understanding Kafka 2. Understanding RabbitMQ 3. IBM: Apache Kafka – Sept 18, 2020 4. Confluent: Apache Kafka Fundamentals – April 25, 2020 5. Confluent: How Kafka Works – Aug 25, 2020 6. Confluent: How to integrate Kafka into your environment – Aug 25, 2020 7. Kafka Streams – Sept 4, 2021 8. Kafka: Processing Streaming Data with KSQL – Jul 16, 2018 9. Kafka: Processing Streaming Data with KSQL – Nov 28, 2019

Slide 151

Slide 151 text

@arafkarsh arafkarsh References 151 Databases: Big Data / Cloud Databases 1. Google: How to Choose the right database? 2. AWS: Choosing the right Database 3. IBM: NoSQL Vs. SQL 4. A Guide to NoSQL Databases 5. How does NoSQL Databases Work? 6. What is Better? SQL or NoSQL? 7. What is DBaaS? 8. NoSQL Concepts 9. Key Value Databases 10. Document Databases 11. Jun 29, 2012 – Google I/O 2012 - SQL vs NoSQL: Battle of the Backends 12. Feb 19, 2013 - Introduction to NoSQL • Martin Fowler • GOTO 2012 13. Jul 25, 2018 - SQL vs NoSQL or MySQL vs MongoDB 14. Oct 30, 2020 - Column vs Row Oriented Databases Explained 15. Dec 9, 2020 - How do NoSQL databases work? Simply Explained! 1. Graph Databases 2. Column Databases 3. Row Vs. Column Oriented Databases 4. Database Indexing Explained 5. MongoDB Indexing 6. AWS: DynamoDB Global Indexing 7. AWS: DynamoDB Local Indexing 8. Google Cloud Spanner 9. AWS: DynamoDB Design Patterns 10. Cloud Provider Database Comparisons 11. CockroachDB: When to use a Cloud DB?

Slide 152

Slide 152 text

@arafkarsh arafkarsh References 152 Docker / Kubernetes / Istio 1. IBM: Virtual Machines and Containers 2. IBM: What is a Hypervisor? 3. IBM: Docker Vs. Kubernetes 4. IBM: Containerization Explained 5. IBM: Kubernetes Explained 6. IBM: Kubernetes Ingress in 5 Minutes 7. Microsoft: How Service Mesh works in Kubernetes 8. IBM: Istio Service Mesh Explained 9. IBM: Kubernetes and OpenShift 10. IBM: Kubernetes Operators 11. 10 Consideration for Kubernetes Deployments Istio – Metrics 1. Istio – Metrics 2. Monitoring Istio Mesh with Grafana 3. Visualize your Istio Service Mesh 4. Security and Monitoring with Istio 5. Observing Services using Prometheus, Grafana, Kiali 6. Istio Cookbook: Kiali Recipe 7. Kubernetes: Open Telemetry 8. Open Telemetry 9. How Prometheus works 10. IBM: Observability vs. Monitoring

Slide 153

Slide 153 text

@arafkarsh arafkarsh References 153 1. Feb 6, 2020 – An introduction to TDD 2. Aug 14, 2019 – Component Software Testing 3. May 30, 2020 – What is Component Testing? 4. Apr 23, 2013 – Component Test By Martin Fowler 5. Jan 12, 2011 – Contract Testing By Martin Fowler 6. Jan 16, 2018 – Integration Testing By Martin Fowler 7. Testing Strategies in Microservices Architecture 8. Practical Test Pyramid By Ham Vocke Testing – TDD / BDD

Slide 154

Slide 154 text

@arafkarsh arafkarsh 154 1. Simoorg : LinkedIn’s own failure inducer framework. It was designed to be easy to extend and most of the important components are plug‐ gable. 2. Pumba : A chaos testing and network emulation tool for Docker. 3. Chaos Lemur : Self-hostable application to randomly destroy virtual machines in a BOSH- managed environment, as an aid to resilience testing of high-availability systems. 4. Chaos Lambda : Randomly terminate AWS ASG instances during business hours. 5. Blockade : Docker-based utility for testing network failures and partitions in distributed applications. 6. Chaos-http-proxy : Introduces failures into HTTP requests via a proxy server. 7. Monkey-ops : Monkey-Ops is a simple service implemented in Go, which is deployed into an OpenShift V3.X and generates some chaos within it. Monkey-Ops seeks some OpenShift components like Pods or Deployment Configs and randomly terminates them. 8. Chaos Dingo : Chaos Dingo currently supports performing operations on Azure VMs and VMSS deployed to an Azure Resource Manager-based resource group. 9. Tugbot : Testing in Production (TiP) framework for Docker. Testing tools

Slide 155

Slide 155 text

@arafkarsh arafkarsh References 155 CI / CD 1. What is Continuous Integration? 2. What is Continuous Delivery? 3. CI / CD Pipeline 4. What is CI / CD Pipeline? 5. CI / CD Explained 6. CI / CD Pipeline using Java Example Part 1 7. CI / CD Pipeline using Ansible Part 2 8. Declarative Pipeline vs Scripted Pipeline 9. Complete Jenkins Pipeline Tutorial 10. Common Pipeline Mistakes 11. CI / CD for a Docker Application

Slide 156

Slide 156 text

@arafkarsh arafkarsh References 156 DevOps 1. IBM: What is DevOps? 2. IBM: Cloud Native DevOps Explained 3. IBM: Application Transformation 4. IBM: Virtualization Explained 5. What is DevOps? Easy Way 6. DevOps?! How to become a DevOps Engineer??? 7. Amazon: https://www.youtube.com/watch?v=mBU3AJ3j1rg 8. NetFlix: https://www.youtube.com/watch?v=UTKIT6STSVM 9. DevOps and SRE: https://www.youtube.com/watch?v=uTEL8Ff1Zvk 10. SLI, SLO, SLA : https://www.youtube.com/watch?v=tEylFyxbDLE 11. DevOps and SRE : Risks and Budgets : https://www.youtube.com/watch?v=y2ILKr8kCJU 12. SRE @ Google: https://www.youtube.com/watch?v=d2wn_E1jxn4

Slide 157

Slide 157 text

@arafkarsh arafkarsh References 157 1. Lewis, James, and Martin Fowler. “Microservices: A Definition of This New Architectural Term”, March 25, 2014. 2. Miller, Matt. “Innovate or Die: The Rise of Microservices”. e Wall Street Journal, October 5, 2015. 3. Newman, Sam. Building Microservices. O’Reilly Media, 2015. 4. Alagarasan, Vijay. “Seven Microservices Anti-patterns”, August 24, 2015. 5. Cockcroft, Adrian. “State of the Art in Microservices”, December 4, 2014. 6. Fowler, Martin. “Microservice Prerequisites”, August 28, 2014. 7. Fowler, Martin. “Microservice Tradeoffs”, July 1, 2015. 8. Humble, Jez. “Four Principles of Low-Risk Software Release”, February 16, 2012. 9. Zuul Edge Server, Ketan Gote, May 22, 2017 10. Ribbon, Hysterix using Spring Feign, Ketan Gote, May 22, 2017 11. Eureka Server with Spring Cloud, Ketan Gote, May 22, 2017 12. Apache Kafka, A Distributed Streaming Platform, Ketan Gote, May 20, 2017 13. Functional Reactive Programming, Araf Karsh Hamid, August 7, 2016 14. Enterprise Software Architectures, Araf Karsh Hamid, July 30, 2016 15. Docker and Linux Containers, Araf Karsh Hamid, April 28, 2015

Slide 158

Slide 158 text

@arafkarsh arafkarsh References 158 16. MSDN – Microsoft https://msdn.microsoft.com/en-us/library/dn568103.aspx 17. Martin Fowler : CQRS – http://martinfowler.com/bliki/CQRS.html 18. Udi Dahan : CQRS – http://www.udidahan.com/2009/12/09/clarified-cqrs/ 19. Greg Young : CQRS - https://www.youtube.com/watch?v=JHGkaShoyNs 20. Bertrand Meyer – CQS - http://en.wikipedia.org/wiki/Bertrand_Meyer 21. CQS : http://en.wikipedia.org/wiki/Command–query_separation 22. CAP Theorem : http://en.wikipedia.org/wiki/CAP_theorem 23. CAP Theorem : http://www.julianbrowne.com/article/viewer/brewers-cap-theorem 24. CAP 12 years how the rules have changed 25. EBay Scalability Best Practices : http://www.infoq.com/articles/ebay-scalability-best-practices 26. Pat Helland (Amazon) : Life beyond distributed transactions 27. Stanford University: Rx https://www.youtube.com/watch?v=y9xudo3C1Cw 28. Princeton University: SAGAS (1987) Hector Garcia Molina / Kenneth Salem 29. Rx Observable : https://dzone.com/articles/using-rx-java-observable