<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Alex Shamrai on Medium]]></title>
        <description><![CDATA[Stories by Alex Shamrai on Medium]]></description>
        <link>https://medium.com/@alexshamrai?source=rss-b07565ff1bd3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Pzriv6bdro6vKmFsxsVVpg.jpeg</url>
            <title>Stories by Alex Shamrai on Medium</title>
            <link>https://medium.com/@alexshamrai?source=rss-b07565ff1bd3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 02:19:29 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alexshamrai/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Book Review: Clean Code. Lessons Learned for Test Engineers]]></title>
            <link>https://medium.com/@alexshamrai/book-review-clean-code-lessons-learned-for-test-engineers-bd9ec1d498a5?source=rss-b07565ff1bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd9ec1d498a5</guid>
            <category><![CDATA[sdet]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[quality-assurance]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[clean-code]]></category>
            <dc:creator><![CDATA[Alex Shamrai]]></dc:creator>
            <pubDate>Sat, 07 Mar 2026 13:43:30 GMT</pubDate>
            <atom:updated>2026-03-07T13:43:30.606Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://www.amazon.com/Clean-Code-Handbook-Software-Craftsmanship/dp/0132350882">Clean Code: A Handbook of Agile Software Craftsmanship</a><br>Author: Robert C. Martin (“Uncle Bob”)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EwvASVSk2n9CWxaaDkIyhQ.jpeg" /></figure><h3>Why Test Engineers Must Read Technical Books</h3><p>Test automation is software development. When you write test scripts, you are writing code. But many Test Engineers rely only on Google searching, Stack Overflow, short tutorials, or even readymade AI solutions to solve their problems. This approach gives you quick fixes, but not deep understanding.</p><p>I believe that technical books provide something that blog posts cannot: proven patterns provided by experienced engineers. It gives you a wider context. When you understand the principles, you can apply them to any testing framework or programming language.</p><p>This doesn’t mean that without books you can’t be effective. Plenty of talented engineers are self-taught through practice and online resources. But books speed up the journey from “writing scripts that work” to “building maintainable test solution that grows with the product.” They compress years of someone else’s experience into a few hundred pages.</p><p>Clean Code is one of the best starting points for this journey.</p><h3>Why This Book Matters for Test Engineers</h3><p>Clean Code was highly influential when it was published in 2008, and its core principles remain relevant today. While Uncle Bob wrote this book for developers, for modern Test Engineers coding is a primary skill, not a secondary one.</p><p>If you have ever struggled with a flaky test scenario that breaks every time someone changes a code, this book offers you a thought-provoking guide how you can avoid it via writing maintainable test code.</p><p>We often write automation scripts in a hurry, thinking, “It just needs to click the button.” Martin argues that this “quick and dirty” approach is a false economy. Dirty code slows you down because you spend more time fixing old tests than writing new ones.</p><p><strong>Core message of the book:</strong> Clean code is code that is easy to read, easy to change, and easy to maintain. Code quality matters more than just “working code.”</p><h3>Before You Start: What You Should Know</h3><p><strong>Prerequisites:</strong> This book assumes you have basic programming knowledge. You should be comfortable reading code and understand fundamental concepts like variables, functions, and classes. If you’re completely new to programming, start with a beginner’s course first.</p><p><strong>Language Context:</strong> Clean Code uses Java for most examples. Don’t let this discourage you if you work in Python, JavaScript, C#, or other languages. The principles are universal and translate directly. The code examples are readable even if you’ve never written Java.</p><p><strong>Time Investment:</strong> This is a 400+ page technical book. Reading it cover-to-cover will take 15–25 hours. However, you don’t need to read it all at once. Chapters 2 (Meaningful Names) and 9 (Unit Tests) alone will significantly improve your automation code and can be read in 2–3 hours.</p><p><strong>Difficulty Level:</strong> Intermediate. The book is accessible, but works best when you already have some automation code to reflect on and improve.</p><h3>Structure</h3><p>The book is divided into three main parts, guiding the reader from theory to practice:</p><p><strong>Principles, Patterns, and Practices:</strong> This section covers the foundational habits of writing clean code, including naming, comments, functions, objects, and data structures, with each chapter dedicated to a single topic. While the key takeaways below focus on the chapters most relevant to test automation, don’t skip Chapters 5 (Formatting), 6 (Objects and Data Structures), and 10 (Classes). Chapter 10’s class design principles apply to Objects structure and test utility classes that grow out of control.</p><p><strong>Case Studies in Cleaning Code:</strong> This is where the theory is applied through hands-on refactoring. Martin walks through the refactoring of three real-world examples:</p><ul><li><strong>Args (Chapter 14):</strong> A command-line argument parser that shows how to refactor a working but messy class into clean code. This chapter is particularly relevant for test engineers building test utilities and frameworks.</li><li><strong>JUnit Internals (Chapter 15):</strong> A deep dive into JUnit’s ComparisonCompactor class. If you use JUnit for testing, seeing how the testing framework itself is built and refactored is enlightening.</li><li><strong>SerialDate (Chapter 16):</strong> Refactoring a date manipulation class from JCommon library. This demonstrates how to approach legacy code you inherit.</li></ul><p>Each case study shows the before and after code side-by-side, with Martin’s commentary on why each change improves the design. For test engineers, these chapters teach you how to approach refactoring your own test utilities, page objects, and helper classes. You see the actual thought process, not just the final result.</p><p><strong>Smells and Heuristics:</strong> The final section lists the “code smells” encountered during the case studies. Many are inspired by Martin Fowler’s <em>Refactoring</em>. It serves as a knowledge base for code reviews, highlighting issues like negative conditionals, misplaced responsibility, and inconsistency.</p><h3>Key Takeaways for the Test Engineer</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LVv23V2fIEBCNMpN" /><figcaption>Photo by <a href="https://unsplash.com/@purzlbaum?utm_source=medium&amp;utm_medium=referral">Claudio Schwarz</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>1. Meaningful Names: The First Line of Documentation</h3><p>Martin’s rule on Meaningful Names is a critical starting point. In automation, it is common to see names like btn1, temp_data, or test_001.</p><p><strong>The Principle:</strong> Names should reveal intent. You shouldn’t have to read the code to know what a variable holds.</p><p><strong>QA Application:</strong> Instead of List&lt;String&gt; l, use List&lt;String&gt; activeUsernames. Instead of check(), use verifyUserCanLoginWithValidCredentials(). This makes the test self-documenting.</p><p>When a test fails in the CI/CD pipeline, a clear name tells you exactly what business requirement failed without needing to open the IDE.</p><p>For instance, a test named test_1() with a variable d = get_data() tells you nothing. But test_user_can_login_with_valid_credentials() with user_is_authenticated = authenticate_user(valid_username, valid_password) makes the intent crystal clear.</p><h3>2. Functions: Do One Thing</h3><p>Chapter 3 advises that functions should be small and do only one thing.</p><p><strong>The Problem in QA:</strong> We often see “God Methods” in Test Classes or functions that log in, navigate, scrape data, and assert results all in one block.</p><p><strong>The Clean Code Fix:</strong> Break these down. A test should read like a story.</p><p>Bad: runFullOrderProcess()</p><p>Good: login(); addProductToCart(); proceedToCheckout(); confirmOrder();</p><p>This modularity (following to the Single Responsibility Principle) ensures that if the “Cart” logic changes, you only update one function, not fifty different tests.</p><h3>3. Comments: Write Code That Explains Itself</h3><p>One of the most controversial points in the book is Martin’s stance on comments. He argues that comments explaining <em>what</em> code does are failures-if you need a comment to explain what the code does, the code itself is unclear.</p><p><strong>Important note:</strong> Martin does acknowledge some legitimate uses of comments:</p><ul><li>Legal notices (copyright, licensing)</li><li>Warning comments about consequences</li><li>TODO comments for future improvements</li><li>Public API documentation</li></ul><p><strong>The Key Principle:</strong> Don’t use comments as a crutch for bad code. If you’re writing a comment to explain <em>what</em> the code does, refactor the code to be self-explanatory instead.</p><p><strong>QA Application:</strong> Stop writing comments like // wait for the modal to close. Instead, write a function named waitForModalToClose(). The code becomes the documentation, and unlike comments, outdated code is more likely to produce visible failures, while outdated comments silently mislead.</p><p>Comments explaining <em>why</em> a decision was made (when it’s not obvious) can still be valuable: // Using 5-second timeout because the payment gateway is slow on staging environment</p><p>For instance, instead of writing // check that user is redirected after login above three lines of URL assertions, extract those lines into a function named verifyUserIsRedirectedToDashboard(). The comment becomes unnecessary because the function name says it all.</p><h3>4. Test Code is a reflection of Production Code</h3><p>Chapter 9 is the most directly relevant chapter for automation engineers. Martin explicitly states: “Test code is just as important as production code.”</p><p><strong>The Reality:</strong> Automation code often rots because it is treated as “second-class.” It isn’t refactored, it isn’t reviewed, and it accumulates technical debt faster than application code.</p><p><strong>The Consequence:</strong> When tests are hard to read and modify, developers stop trusting and running them. The safety net vanishes. QA must treat their repository with the same engineering rigor as the application code.</p><p><strong>Note:</strong> Chapter 9 is only about 15 pages. It establishes the right mindset, but don’t expect a comprehensive guide to test design.</p><h3>5. The F.I.R.S.T. Principles of Clean Tests</h3><p>For any Test Engineer, the F.I.R.S.T. acronym from Chapter 9 is one of the most actionable frameworks in the book:</p><p><strong>F — Fast:</strong> Tests must run quickly. If they are slow, developers won’t run them. (QA Hint: Use API tests instead of UI tests where possible).</p><p><strong>I — Independent:</strong> Tests should not depend on each other. Test B should not fail just because Test A didn’t clean up the database.</p><p><strong>R — Repeatable:</strong> Tests must work in any environment (QA, Staging, Local) without manual tweaking.</p><p><strong>S — Self-Validating:</strong> A test should produce a clear pass or fail result. You shouldn’t need to read a log file to determine if it worked.</p><p><strong>T — Timely:</strong> Martin frames this as writing tests just before production code (TDD). For Test Engineers, the practical interpretation is different: write tests as close to the feature development as possible, not weeks later when context is lost. You may not practice TDD in the strict sense, but writing tests while the requirements are fresh produces better results than backfilling tests months later.</p><h3>6. One Assert Per Test?</h3><p>Martin presents this as a goal in Chapter 9, not a strict law. The better interpretation for QA is “Test One Concept Per Test.” Because if you have an E2E test it may be reasonable to have multiple asserts in a particular scenario.</p><p><strong>Example:</strong> Don’t have a single test that checks the Login, the Dashboard, adding a Friend, and the Logout. If it fails, you don’t know which feature is broken. Split them into three specific tests. This improves defect localization.</p><h3>7. Error Handling: Fail Fast and Clear (Chapter 7)</h3><p>Martin dedicates an entire chapter to error handling. For Test Engineers, this means: don’t hide failures, and when you do handle errors, provide meaningful context.</p><p><strong>The Problem:</strong> Many test engineers catch all exceptions, print a vague “Test failed” message, and then swallow the actual error details. This makes debugging nearly impossible.</p><p><strong>The Solution:</strong> Let tests fail with clear, actionable error messages. When you catch an exception, either handle it meaningfully or re-raise it with additional context. For example, if a submit button isn’t found, the error should say “Submit button not found within 10 seconds. Check if the form loaded correctly” rather than just timing out silently.</p><p><strong>Key Principle:</strong> When tests fail, they should fail clearly and immediately with actionable error messages. Don’t catch exceptions just to print a message-either handle the error meaningfully or let it propagate with context. The test framework should handle reporting.</p><h3>8. Don’t Repeat Yourself (DRY) — but with nuances</h3><p>Test Engineers are guilty of copy-pasting code constantly. Martin emphasizes throughout the book that duplication is the enemy of clean code.</p><p><strong>The Problem:</strong> If you have the same login code duplicated across 50 tests, any change to the login process (new field, different selectors, changed flow) means updating 50 places. This is maintenance hell.</p><p><strong>The Solution:</strong> Extract shared setup and common actions into reusable functions. When the login process changes, you update one function, and all 50 tests benefit automatically.</p><p><strong>Note:</strong> DRY in test code requires balance. Over-abstracting tests-hiding everything behind helper methods and shared utilities-can make individual tests impossible to understand without jumping through five layers of abstraction. The testing community often prefers the DAMP principle (Descriptive And Meaningful Phrases): some repetition is acceptable if it makes each test self-contained and readable from top to bottom. Extract shared infrastructure (login flows, API clients, test data builders), but keep the test logic itself explicit and visible within the test method.</p><h3>9. The Boy Scout Rule</h3><p>Martin introduces this rule: “Leave the code cleaner than you found it.”</p><p><strong>For Test Engineers:</strong> When you touch a test to fix it, improve it slightly. Rename a bad variable. Extract a duplicated block. Fix a hard-coded value.</p><p>You don’t need to refactor everything. Just make one small improvement each time you visit the code. Over time, the entire test suite gets better.</p><h3>Where the Book’s Advice Needs Adaptation for Testing</h3><p>Clean Code was written for application developers, and not all of its principles translate directly to test code. Here are the key areas where you should adapt rather than blindly follow:</p><p><strong>Function size:</strong> Martin advocates for very small functions (ideally 5–10 lines). In application code, this improves modularity. In test code, it can backfire. A test should be readable top-to-bottom without jumping through ten helper methods. The Arrange-Act-Assert pattern benefits from being visible in one place. If understanding a test requires tracing through multiple layers of abstraction, you’ve optimized for the wrong metric.</p><p><strong>DRY vs. readability:</strong> As covered in the DRY section above, prefer the DAMP principle in tests — each test should tell a clear story without requiring the reader to trace through layers of helpers.</p><p><strong>The refactoring style:</strong> The book’s case studies show Martin refactoring code into many small classes and methods with heavy indirection. This style is controversial-some experienced developers find the “after” code harder to follow than the “before.” Approach the case studies as one perspective on refactoring, not the definitive answer.</p><p><strong>Modern async patterns:</strong> The book predates modern async/await patterns, reactive programming, and the event-driven architectures common in today’s test frameworks (Playwright, Cypress). Its synchronous Java examples don’t address the complexity of managing asynchronous test flows, flaky waits, or parallel test execution.</p><h3>What This Book Doesn’t Cover</h3><p>It’s important to set realistic expectations about the book’s scope and limitations:</p><p><strong>Not a testing book:</strong> While Chapter 9 is excellent for test code, this is not a book about testing strategy, test design, or QA methodologies. It won’t teach you what to test or how to design test cases. It teaches you how to write the code once you know what to test.</p><p><strong>Some dated examples:</strong> The book references tools and practices from 2008 (CVS, SVN, older build tools). The principles remain timeless, but specific tool references may feel antiquated.</p><p><strong>Controversial opinions:</strong> Uncle Bob has strong opinions, and the software community doesn’t agree with everything. The “one assert per test” rule and absolutist stance on comments are debated. Take principles as guidelines, not religious doctrine.</p><p><strong>Not comprehensive:</strong> While the book excels at detailing clean code at the function and class level, it isn’t a comprehensive architectural guide. Some examples feel more theoretical than practical for day-to-day engineering.</p><h3>Who Should Read This Book?</h3><p>You should read Clean Code if you:</p><ul><li>Write test automation (Selenium, Playwright, REST Assured, Cypress, etc.)</li><li>Review other people’s test code</li><li>Feel frustrated when your tests break all the time</li><li>Spend more time fixing old tests than writing new ones</li><li>Want your developers to respect your test code</li><li>Lead a test automation team</li></ul><p>This book is lower priority if you:</p><ul><li>Only do manual testing with no automation (though understanding code quality still helps when reviewing developer work or writing test specifications)</li><li>Are completely new to programming (start with beginner programming fundamentals first, then return to this book)</li><li>Work exclusively with no-code/low-code test tools and have no plans to write custom code</li></ul><h3>Practical Tips for Applying This Book</h3><p><strong>Start small:</strong> Don’t try to refactor all your tests at once. That path leads to burnout and broken test suites. Attempting a “big bang” refactoring of existing tests often creates more problems than it solves.</p><p><strong>Focus on new tests first:</strong> Apply clean code principles to new tests you write. Let the old tests improve gradually. This provides immediate value without the risk of breaking existing coverage.</p><p><strong>Apply the Boy Scout Rule to legacy tests:</strong> Each time you touch an old test, make one small improvement. Over months, the suite improves organically without dedicated refactoring sprints.</p><p><strong>Know when to rewrite vs. refactor:</strong> If a test is severely broken and has low coverage value, rewriting it cleanly might be faster than refactoring. If it provides valuable coverage and mostly works, refactor incrementally.</p><p><strong>Use the book as a reference:</strong> Keep it on your desk during code reviews. When you see confusing code, check if the book has a chapter about it.</p><p><strong>Share with team:</strong> Have your team read Chapter 9 (Tests) together. Discuss how to apply it to your framework.</p><p><strong>Pair with developers:</strong> Ask developers to review your test code using book principles. They have probably already read this book.</p><p><strong>Create team standards:</strong> Use the book to create your team’s test code style guide. Reference specific chapters and page numbers.</p><p><strong>Read one chapter, apply it:</strong> Don’t read the whole book at once. Read one chapter, apply it for a week, then move to the next.</p><p><strong>Framework-agnostic principles:</strong> Whether you use Selenium with Python, Playwright with TypeScript, Cypress, REST Assured, or any other framework, these principles apply. Don’t get distracted by Java syntax-focus on the underlying concepts.</p><h3>Conclusion: Your Next Step</h3><p>Clean Code is a valuable book a Test Engineer can read-not because every page applies directly, but because it establishes the right mindset: your test automation solution is also a software, and it deserves the same care as production code.</p><p>The book is not perfect. Some advice needs adaptation for testing contexts, the examples are dated, and some recommendations are controversial even among developers. But the core principles-Meaningful Names, Single Responsibility, Clean Tests, and the Boy Scout Rule-are genuinely universal and will improve your automation code.</p><p><strong>Book Rating:</strong> 5/5</p><p><strong>Verdict:</strong> Strongly recommended for any Test Engineer who writes or reviews test code. Read it with a critical eye, adapt it to testing, and your automation will be better for it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd9ec1d498a5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Build a Test Metrics Dashboard with Elasticsearch and Kibana]]></title>
            <link>https://medium.com/@alexshamrai/build-a-test-metrics-dashboard-with-elasticsearch-and-kibaa-11a064d56493?source=rss-b07565ff1bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/11a064d56493</guid>
            <category><![CDATA[elasticsearch]]></category>
            <category><![CDATA[test-reporting]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[metrics]]></category>
            <category><![CDATA[kibana]]></category>
            <dc:creator><![CDATA[Alex Shamrai]]></dc:creator>
            <pubDate>Wed, 24 Dec 2025 11:58:07 GMT</pubDate>
            <atom:updated>2025-12-29T13:11:29.793Z</atom:updated>
            <content:encoded><![CDATA[<p>Your CI pipeline runs hundreds of tests every day. But what happens to all that data after the build finishes? Too often, it simply vanishes — lost in build logs that nobody reads.</p><p><strong>Critical questions remain unanswered:</strong> Which tests are slowing down your pipeline? Which ones are flaky and waste hours of debugging time? Is your test suite getting healthier or slowly degrading?</p><blockquote>This guide shows you how to capture test results in Elasticsearch and visualize them in Kibana. You’ll build a dashboard that tracks test duration trends, identifies flaky tests, and gives you historical insights into your test suite health.</blockquote><p><strong>What you’ll build:</strong></p><ul><li>A tool that sends test results to Elasticsearch after every run</li><li>Index templates optimized for test metrics querying</li><li>A Kibana dashboard with pass rates, duration trends, and per-test statistics</li><li>CI/CD integration for automated metrics collection</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K74WjE2Yfb1Jf7yB7Qc5fQ.png" /></figure><h3>Prerequisites</h3><ul><li>A Java Gradle project with CTRF reporting enabled (check <a href="https://medium.com/@alexshamrai/common-test-report-format-and-junit5-cfb113d9eaa0">Common Test Report Format and JUnit5</a> if you don’t know how to set it up)</li><li>Access to an Elasticsearch cluster (we will run it locally for learning purposes)</li><li>Access to Kibana (we will run it locally for learning purposes)</li><li>Basic knowledge of Gradle, Docker, Elasticsearch, and Kibana</li></ul><p>The approach uses CTRF (Common Test Report Format) — a standardized JSON format for test results. The idea is straightforward: generate a CTRF report from your tests and send it to Elasticsearch. While this guide uses Java/Gradle, the same approach works with any language and testing framework that supports CTRF.</p><p>A complete working example is available in the <a href="https://github.com/alexshamrai/dummy-tests-junit">dummy-tests-junit</a> repository.</p><h3>Understanding CTRF Format</h3><p>Before diving into the implementation, let’s understand the CTRF JSON structure. Here’s an example of what a CTRF report looks like:</p><pre>{<br>  &quot;reportFormat&quot;: &quot;CTRF&quot;,<br>  &quot;specVersion&quot;: &quot;0.0.0&quot;,<br>  &quot;results&quot;: {<br>    &quot;tool&quot;: {<br>      &quot;name&quot;: &quot;JUnit&quot;<br>    },<br>    &quot;summary&quot;: {<br>      &quot;tests&quot;: 2,<br>      &quot;passed&quot;: 2,<br>      &quot;failed&quot;: 0,<br>      &quot;pending&quot;: 0,<br>      &quot;skipped&quot;: 0,<br>      &quot;other&quot;: 0,<br>      &quot;start&quot;: 1747404401536,<br>      &quot;stop&quot;: 1747404481347<br>    },<br>    &quot;tests&quot;: [<br>      {<br>        &quot;name&quot;: &quot;firstTejstOne()&quot;,<br>        &quot;status&quot;: &quot;passed&quot;,<br>        &quot;duration&quot;: 3,<br>        &quot;start&quot;: 1747404407658,<br>        &quot;stop&quot;: 1747404411299,<br>        &quot;tags&quot;: [&quot;fake&quot;, &quot;first&quot;, &quot;success&quot;],<br>        &quot;filepath&quot;: &quot;io.github.alexshamrai.FirstTest&quot;,<br>        &quot;threadId&quot;: &quot;Test worker&quot;<br>      }<br>    ],<br>    &quot;environment&quot;: {<br>      &quot;buildName&quot;: &quot;Regression&quot;,<br>      &quot;buildNumber&quot;: &quot;752&quot;,<br>      &quot;buildUrl&quot;: &quot;https://github.com/example/project/actions/runs/123&quot;,<br>      &quot;commit&quot;: &quot;0a692f1c05f3bd8e65a31d43e8d7a1594158ada7&quot;,<br>      &quot;branchName&quot;: &quot;master&quot;<br>    }<br>  }<br>}</pre><p>Key fields:</p><ul><li><strong>summary</strong>: Aggregated test results (counts, timestamps)</li><li><strong>tests</strong>: Array of individual test results with name, status, duration, and metadata</li><li><strong>environment</strong>: CI/CD context (build info, commit, branch)</li></ul><h3>Setting Up Elasticsearch and Kibana Locally</h3><p>For a real project, you would configure Elasticsearch and Kibana in your infrastructure. For learning purposes, we’ll use Docker Compose to run them locally.</p><p>Create a docker-compose.yml file in the root of your project:</p><pre>services:<br>  elasticsearch:<br>    image: docker.elastic.co/elasticsearch/elasticsearch:9.0.1<br>    environment:<br>      - discovery.type=single-node<br>      - xpack.security.enabled=false<br>      - xpack.security.http.ssl.enabled=false<br>    ports:<br>      - 9200:9200<br><br>  kibana:<br>    image: docker.elastic.co/kibana/kibana:9.0.1<br>    ports:<br>      - 5601:5601<br>    environment:<br>      - ELASTICSEARCH_URL=http://elasticsearch:9200<br>    depends_on:<br>      - elasticsearch</pre><h3>Docker Compose Configuration Explained</h3><p><strong>Elasticsearch service:</strong></p><ul><li>discovery.type=single-node: Configures Elasticsearch to run as a single-node cluster (no clustering overhead for local development)</li><li>xpack.security.enabled=false: Disables authentication for simplicity (not recommended for production!)</li><li>xpack.security.http.ssl.enabled=false: Disables SSL/TLS (not recommended for production!)</li><li>Port 9200: The Elasticsearch HTTP API port</li></ul><p><strong>Kibana service:</strong></p><ul><li>ELASTICSEARCH_URL: Points Kibana to the Elasticsearch container</li><li>depends_on: Ensures Elasticsearch starts before Kibana</li><li>Port 5601: The Kibana web UI port</li></ul><h3>Starting the Services</h3><p>Make sure you have Docker and Docker Compose installed, then run:</p><pre>docker-compose up -d</pre><p>After the services start (may take 1–2 minutes), you can access:</p><ul><li>Elasticsearch at <a href="http://localhost:9200/">http://localhost:9200</a></li><li>Kibana at <a href="http://localhost:5601/">http://localhost:5601</a></li></ul><h3>1. Setting Up Elasticsearch Index Templates</h3><p>Elasticsearch needs to be configured with proper index templates to correctly store and query the test metrics data. Index templates define mappings (field types) and settings that are automatically applied to new indices matching a pattern.</p><p><strong>Important:</strong> Index templates must be created before sending any data. If data is sent first, Elasticsearch will auto-detect field types incorrectly, and date fields like results.summary.stop won&#39;t work properly in Kibana.</p><h3>Why Index Templates Matter</h3><p>Without proper mappings:</p><ul><li>Dates might be stored as strings instead of timestamps</li><li>Numeric fields might be stored as text</li><li>Nested objects won’t be queryable correctly</li><li>Aggregations and visualizations may not work as expected</li></ul><h3>Step 1: Create Index Templates</h3><p>Create a script with mapping based on ctrf JSON schema elastic/create_index_template.sh:</p><pre>#!/bin/bash<br><br># Configuration - can be overridden via environment variables<br>API_KEY=&quot;${ELASTIC_API_KEY:-}&quot;<br>ELASTICSEARCH_URL=&quot;${ELASTIC_URL:-http://localhost:9200}&quot;<br>INDEX_NAME=&quot;${ELASTIC_INDEX_NAME:-dummy-test-junit}&quot;<br><br>echo &quot;Setting up Elasticsearch templates for ${INDEX_NAME}...&quot;<br><br># Step 1: Create Component Template for Settings<br>echo &quot;Step 1: Creating component template for settings...&quot;<br>curl -X PUT &quot;${ELASTICSEARCH_URL}/_component_template/${INDEX_NAME}-settings&quot; \<br>  -H &quot;Content-Type: application/json&quot; \<br>  ${API_KEY:+-H &quot;Authorization: ApiKey ${API_KEY}&quot;} \<br>  -d &#39;{<br>  &quot;template&quot;: {<br>    &quot;settings&quot;: {<br>      &quot;number_of_shards&quot;: 1,<br>      &quot;number_of_replicas&quot;: 0,<br>      &quot;mapping.nested_objects.limit&quot;: 100,<br>      &quot;index.mapping.total_fields.limit&quot;: 2000<br>    }<br>  }<br>}&#39;<br><br>echo -e &quot;\n&quot;<br><br># Step 2: Create Component Template for Mappings<br>echo &quot;Step 2: Creating component template for mappings...&quot;<br>curl -X PUT &quot;${ELASTICSEARCH_URL}/_component_template/${INDEX_NAME}-mappings&quot; \<br>  -H &quot;Content-Type: application/json&quot; \<br>  ${API_KEY:+-H &quot;Authorization: ApiKey ${API_KEY}&quot;} \<br>  -d &#39;{<br>  &quot;template&quot;: {<br>    &quot;mappings&quot;: {<br>      &quot;dynamic&quot;: true,<br>      &quot;date_detection&quot;: false,<br>      &quot;properties&quot;: {<br>        &quot;reportFormat&quot;: {&quot;type&quot;: &quot;keyword&quot;},<br>        &quot;specVersion&quot;: {&quot;type&quot;: &quot;keyword&quot;},<br>        &quot;results&quot;: {<br>          &quot;type&quot;: &quot;object&quot;,<br>          &quot;properties&quot;: {<br>            &quot;tool&quot;: {<br>              &quot;type&quot;: &quot;object&quot;,<br>              &quot;properties&quot;: {<br>                &quot;name&quot;: {&quot;type&quot;: &quot;keyword&quot;},<br>                &quot;version&quot;: {&quot;type&quot;: &quot;keyword&quot;}<br>              }<br>            },<br>            &quot;summary&quot;: {<br>              &quot;type&quot;: &quot;object&quot;,<br>              &quot;properties&quot;: {<br>                &quot;tests&quot;: {&quot;type&quot;: &quot;integer&quot;},<br>                &quot;passed&quot;: {&quot;type&quot;: &quot;integer&quot;},<br>                &quot;failed&quot;: {&quot;type&quot;: &quot;integer&quot;},<br>                &quot;pending&quot;: {&quot;type&quot;: &quot;integer&quot;},<br>                &quot;skipped&quot;: {&quot;type&quot;: &quot;integer&quot;},<br>                &quot;other&quot;: {&quot;type&quot;: &quot;integer&quot;},<br>                &quot;start&quot;: {<br>                  &quot;type&quot;: &quot;date&quot;,<br>                  &quot;format&quot;: &quot;epoch_millis&quot;<br>                },<br>                &quot;stop&quot;: {<br>                  &quot;type&quot;: &quot;date&quot;,<br>                  &quot;format&quot;: &quot;epoch_millis&quot;<br>                }<br>              }<br>            },<br>            &quot;tests&quot;: {<br>              &quot;type&quot;: &quot;nested&quot;,<br>              &quot;include_in_parent&quot;: true,<br>              &quot;properties&quot;: {<br>                &quot;name&quot;: {&quot;type&quot;: &quot;keyword&quot;},<br>                &quot;status&quot;: {&quot;type&quot;: &quot;keyword&quot;},<br>                &quot;duration&quot;: {&quot;type&quot;: &quot;integer&quot;},<br>                &quot;start&quot;: {&quot;type&quot;: &quot;date&quot;, &quot;format&quot;: &quot;epoch_millis&quot;},<br>                &quot;stop&quot;: {&quot;type&quot;: &quot;date&quot;, &quot;format&quot;: &quot;epoch_millis&quot;},<br>                &quot;message&quot;: {&quot;type&quot;: &quot;text&quot;},<br>                &quot;trace&quot;: {&quot;type&quot;: &quot;text&quot;},<br>                &quot;tags&quot;: {&quot;type&quot;: &quot;keyword&quot;},<br>                &quot;filepath&quot;: {&quot;type&quot;: &quot;keyword&quot;},<br>                &quot;threadId&quot;: {&quot;type&quot;: &quot;keyword&quot;},<br>                &quot;retries&quot;: {&quot;type&quot;: &quot;integer&quot;},<br>                &quot;flaky&quot;: {&quot;type&quot;: &quot;boolean&quot;}<br>              }<br>            },<br>            &quot;environment&quot;: {<br>              &quot;type&quot;: &quot;object&quot;,<br>              &quot;properties&quot;: {<br>                &quot;buildName&quot;: {&quot;type&quot;: &quot;keyword&quot;},<br>                &quot;buildNumber&quot;: {&quot;type&quot;: &quot;keyword&quot;},<br>                &quot;buildUrl&quot;: {&quot;type&quot;: &quot;keyword&quot;},<br>                &quot;commit&quot;: {&quot;type&quot;: &quot;keyword&quot;},<br>                &quot;branchName&quot;: {&quot;type&quot;: &quot;keyword&quot;}<br>              }<br>            }<br>          }<br>        }<br>      },<br>      &quot;runtime&quot;: {<br>        &quot;results.summary.duration&quot;: {<br>          &quot;type&quot;: &quot;long&quot;,<br>          &quot;script&quot;: {<br>            &quot;source&quot;: &quot;emit(doc[\&quot;results.summary.stop\&quot;].value.toInstant().toEpochMilli() - doc[\&quot;results.summary.start\&quot;].value.toInstant().toEpochMilli());&quot;<br>          }<br>        }<br>      }<br>    }<br>  }<br>}&#39;<br><br>echo -e &quot;\n&quot;<br><br># Step 3: Create Composable Index Template<br>echo &quot;Step 3: Creating composable index template...&quot;<br>curl -X PUT &quot;${ELASTICSEARCH_URL}/_index_template/${INDEX_NAME}-template&quot; \<br>  -H &quot;Content-Type: application/json&quot; \<br>  ${API_KEY:+-H &quot;Authorization: ApiKey ${API_KEY}&quot;} \<br>  -d &quot;{<br>  \&quot;index_patterns\&quot;: [\&quot;${INDEX_NAME}*\&quot;],<br>  \&quot;priority\&quot;: 100,<br>  \&quot;composed_of\&quot;: [<br>    \&quot;${INDEX_NAME}-settings\&quot;,<br>    \&quot;${INDEX_NAME}-mappings\&quot;<br>  ]<br>}&quot;<br><br>echo -e &quot;\n&quot;<br>echo &quot;Elasticsearch templates setup completed!&quot;</pre><p>Make it executable and run:</p><pre>./elastic/create_index_template.sh</pre><h3>Template Configuration Explained</h3><p><strong>Settings template:</strong></p><ul><li>number_of_shards: 1: Single shard for small datasets (adjust for large-scale deployments)</li><li>number_of_replicas: 0: No replicas for local development (increase for production)</li><li>mapping.nested_objects.limit: 100: Maximum number of nested objects (in our case, it&#39;s max tests array length)</li></ul><p><strong>Mappings template:</strong></p><ul><li>date_detection: false: Prevents auto-detection of date strings (we explicitly define date fields)</li><li>type: keyword: Used for exact-match fields (status, tags, names)</li><li>type: date with format: epoch_millis: For timestamp fields stored as milliseconds</li><li>type: nested with include_in_parent: true: Allows querying individual tests while keeping them grouped</li><li>runtime field: Calculates test duration on-the-fly from start/stop timestamps</li></ul><p><strong>Index template:</strong></p><ul><li>index_patterns: Matches all indices starting with the configured name</li><li>composed_of: Combines settings and mappings templates</li><li>priority: 100: Higher priority templates override lower ones</li></ul><h3>Step 2: Verify the Templates</h3><p>Create a verification script elastic/verify_index_template.sh:</p><pre>#!/bin/bash<br><br>ELASTICSEARCH_URL=&quot;${ELASTIC_URL:-http://localhost:9200}&quot;<br>INDEX_NAME=&quot;${ELASTIC_INDEX_NAME:-dummy-test-junit}&quot;<br><br>echo &quot;Verifying Elasticsearch templates for ${INDEX_NAME}...&quot;<br><br>echo &quot;Checking component template for settings...&quot;<br>curl -s -X GET &quot;${ELASTICSEARCH_URL}/_component_template/${INDEX_NAME}-settings&quot; | python3 -m json.tool<br><br>echo -e &quot;\n&quot;<br><br>echo &quot;Checking component template for mappings...&quot;<br>curl -s -X GET &quot;${ELASTICSEARCH_URL}/_component_template/${INDEX_NAME}-mappings&quot; | python3 -m json.tool<br><br>echo -e &quot;\n&quot;<br><br>echo &quot;Checking index template...&quot;<br>curl -s -X GET &quot;${ELASTICSEARCH_URL}/_index_template/${INDEX_NAME}-template&quot; | python3 -m json.tool<br><br>echo &quot;Template verification completed!&quot;</pre><p>Verify created template:</p><pre>./elastic/verify_index_template.sh</pre><h3>2. Sending CTRF Reports to Elasticsearch</h3><p>Once you have Elasticsearch running and a CTRF report JSON file, you can send it to Elasticsearch using a simple curl command:</p><pre>curl -X POST &quot;http://localhost:9200/dummy-test-junit-$(date +%Y-%m-%d)/_doc&quot; \<br>  -H &quot;Content-Type: application/json; charset=UTF-8&quot; \<br>  -d @path/to/ctrf-report.json</pre><p>If your Elasticsearch instance requires authentication, add the API key header:</p><pre>curl -X POST &quot;http://localhost:9200/dummy-test-junit-$(date +%Y-%m-%d)/_doc&quot; \<br>  -H &quot;Authorization: ApiKey YOUR_API_KEY&quot; \<br>  -H &quot;Content-Type: application/json; charset=UTF-8&quot; \<br>  -d @path/to/ctrf-report.json</pre><p>The index name includes the current date (e.g. dummy-test-junit-2025-01-15) to create daily indices, which helps with data retention and query performance.</p><p>For Java/Gradle projects, it’s better to integrate report sending into the build lifecycle, so let’s do that.</p><h3>Step 1: Create the Gradle Task</h3><p>Create a file named send-metrics-to-elastic.gradle in your project&#39;s gradle directory:</p><pre>import java.net.http.HttpClient<br>import java.net.http.HttpRequest<br>import java.net.http.HttpResponse<br>import java.time.Duration<br>import java.time.LocalDate<br>import java.time.format.DateTimeFormatter<br>import java.nio.charset.StandardCharsets<br><br>tasks.register(&#39;sendMetricsToElastic&#39;) {<br>    description = &#39;Sends test metrics to Elasticsearch&#39;<br>    ext.reportPath = project.findProperty(&#39;reportPath&#39;) ?: &#39;build/test-results/test/ctrf-report.json&#39;<br><br>    doLast {<br>        final int CONNECTION_TIMEOUT_SECONDS = 10<br><br>        try {<br>            def reportFile = validateReportFile(reportPath)<br>            def config = getElasticSearchConfig()<br>            def requestData = prepareRequestData(reportFile, config)<br>            sendDataToElasticsearch(requestData, CONNECTION_TIMEOUT_SECONDS)<br><br>        } catch (Exception e) {<br>            handleException(&quot;Failed to send metrics to Elasticsearch&quot;, e)<br>        }<br>    }<br>}<br><br>private File validateReportFile(String reportFilePath) {<br>    def reportFile = file(reportFilePath)<br>    if (!reportFile.exists()) {<br>        def errorMsg = &quot;CTRF report file not found at: ${reportFile.absolutePath}&quot;<br>        println errorMsg<br>        throw new GradleException(errorMsg)<br>    }<br>    return reportFile<br>}<br><br>private Map getElasticSearchConfig() {<br>    return [<br>            elasticUrl: System.getenv(&#39;ELASTIC_URL&#39;) ?: &#39;http://localhost:9200&#39;,<br>            apiKey    : System.getenv(&#39;ELASTIC_API_KEY&#39;) ?: &#39;&#39;,<br>            indexName : System.getenv(&#39;ELASTIC_INDEX_NAME&#39;) ?: &#39;dummy-test-junit&#39;<br>    ]<br>}<br><br>private Map prepareRequestData(File reportFile, Map config) {<br>    def formattedDate = LocalDate.now().format(DateTimeFormatter.ofPattern(&quot;yyyy-MM-dd&quot;))<br>    def fullUrl = &quot;${config.elasticUrl}/${config.indexName}-${formattedDate}/_doc&quot;<br>    def jsonPayload = reportFile.text<br><br>    return [<br>            url: fullUrl,<br>            payload: jsonPayload,<br>            apiKey: config.apiKey<br>    ]<br>}<br><br>private void sendDataToElasticsearch(Map requestData, int timeoutSeconds) {<br>    def client = HttpClient.newBuilder()<br>            .connectTimeout(Duration.ofSeconds(timeoutSeconds))<br>            .build()<br><br>    def requestBuilder = HttpRequest.newBuilder()<br>            .uri(URI.create(requestData.url))<br>            .header(&quot;Content-Type&quot;, &quot;application/json; charset=UTF-8&quot;)<br>            .POST(HttpRequest.BodyPublishers.ofString(requestData.payload, StandardCharsets.UTF_8))<br><br>    if (requestData.apiKey) {<br>        requestBuilder.header(&quot;Authorization&quot;, &quot;ApiKey ${requestData.apiKey}&quot;)<br>    }<br><br>    def request = requestBuilder.build()<br>    def response = client.send(request, HttpResponse.BodyHandlers.ofString())<br><br>    handleResponse(response, requestData.url)<br>}<br><br>private void handleResponse(HttpResponse&lt;String&gt; response, String url) {<br>    def statusCode = response.statusCode()<br>    if (statusCode == 200 || statusCode == 201) {<br>        println &quot;Successfully sent test metrics to Elasticsearch at ${url}&quot;<br>    } else {<br>        def errorMsg = &quot;Failed to send metrics to Elasticsearch, HTTP error code: ${statusCode}. Response: ${response.body()}&quot;<br>        println errorMsg<br>        throw new GradleException(errorMsg)<br>    }<br>}<br><br>private void handleException(String message, Exception exception) {<br>    def errorMsg = &quot;${message}: ${exception.message}&quot;<br>    println errorMsg<br>    exception.printStackTrace()<br>    throw new GradleException(errorMsg)<br>}</pre><h3>Gradle Task Explained</h3><p>The task performs the following steps:</p><ol><li>The task performs the following steps:</li><li>Validates the CTRF report file exists at the specified path</li><li>Reads configuration from environment variables with sensible defaults:</li></ol><ul><li>ELASTIC_URL (default: <a href="http://localhost:9200)">http://localhost:9200)</a></li><li>ELASTIC_API_KEY (optional, for authenticated clusters)</li><li>ELASTIC_INDEX_NAME (default: dummy-test-junit)</li></ul><p>4. Constructs the URL with date-based indexing: {url}/{index}-{YYYY-MM-dd}/_doc</p><p>5. Sends an HTTP POST request with the JSON payload</p><p>6. Handles responses (success: 200/201, error: throws exception)</p><p><strong>Note:</strong> If you don’t use java/gradle, you can use any HTTP client to send identical request.</p><h3>Step 2: Apply the Script in build.gradle</h3><p>Add the following to your main build.gradle file:</p><pre>apply from: &#39;gradle/send-metrics-to-elastic.gradle&#39;</pre><p>For using CTRF properties in your tests, you should add the following enhancement:</p><pre>test {<br>    // Forward all CTRF properties to the test JVM<br>    systemProperties += System.properties.findAll { k, v -&gt; k.toString().startsWith(&quot;ctrf&quot;) }<br>}</pre><p><strong>Important:</strong> The build.name and build.number properties are essential metadata for the dashboards we&#39;ll build later. They allow you to filter and group test results by test suite (e.g., &quot;Regression&quot;, &quot;Acceptance&quot;) and track individual runs. Make sure to always provide these when running tests.</p><h3>Step 3: Run the Task</h3><pre>./gradlew clean test \<br>  -Dctrf.build.name=Local \<br>  -Dctrf.build.number=$((RANDOM % 9000 + 1000))<br>./gradlew sendMetricsToElastic</pre><p>This sets:</p><ul><li>build.name: Identifies the test suite (e.g., &quot;Local&quot;, &quot;Regression&quot;, &quot;Acceptance&quot;)</li><li>build.number: Unique identifier for each run. On ci it should be a real run identifier, like github.run_number But for local runs use random 4-digit number.</li></ul><p>You can also configure it to run automatically after tests by adding this to your build.gradle:</p><pre>test.finalizedBy(sendMetricsToElastic)</pre><p>However, I prefer running them explicitly as separate steps, especially in CI/CD pipelines. Keep in mind that tests in dummy-test-junit project will fail, by design. But after running the command above, you should see in console output something like this:</p><pre>BUILD FAILED in 12s<br>5 actionable tasks: 4 executed, 1 up-to-date<br><br>&gt; Task :sendMetricsToElastic<br>Successfully sent test metrics to Elasticsearch at http://localhost:9200/dummy-test-junit-2025-12-23/_doc</pre><h3>3. Setting Up Kibana</h3><h3>Step 1: Create a Data View</h3><p>A data view (formerly called index pattern) tells Kibana which Elasticsearch indices to query and which field to use for time-based filtering.</p><p>Create a file elastic/data_view_export.ndjson:</p><pre>{&quot;attributes&quot;:{&quot;allowHidden&quot;:false,&quot;fieldAttrs&quot;:&quot;{}&quot;,&quot;fieldFormatMap&quot;:&quot;{}&quot;,&quot;fields&quot;:&quot;[]&quot;,&quot;name&quot;:&quot;dummy-test-junit&quot;,&quot;runtimeFieldMap&quot;:&quot;{}&quot;,&quot;sourceFilters&quot;:&quot;[]&quot;,&quot;timeFieldName&quot;:&quot;results.summary.stop&quot;,&quot;title&quot;:&quot;dummy-test-junit*&quot;},&quot;coreMigrationVersion&quot;:&quot;8.8.0&quot;,&quot;created_at&quot;:&quot;2025-05-26T08:47:44.161Z&quot;,&quot;id&quot;:&quot;dummy-test-junit-data-view&quot;,&quot;managed&quot;:false,&quot;references&quot;:[],&quot;type&quot;:&quot;index-pattern&quot;,&quot;typeMigrationVersion&quot;:&quot;8.0.0&quot;,&quot;updated_at&quot;:&quot;2025-05-27T19:46:44.630Z&quot;,&quot;version&quot;:&quot;WzEsMV0=&quot;}</pre><p><strong>Important:</strong> The file must be a single line (NDJSON format). Do not format/prettify it.</p><p>Key configuration:</p><ul><li>title: &quot;dummy-test-junit*&quot;: Matches all daily indices</li><li>timeFieldName: &quot;results.summary.stop&quot;: Uses test run end time for time filtering</li></ul><p>Create an import script elastic/create_data_view.sh:</p><pre>#!/bin/bash<br><br>API_KEY=&quot;${ELASTIC_API_KEY:-}&quot;<br>KIBANA_URL=&quot;${KIBANA_URL:-http://localhost:5601}&quot;<br>DATA_VIEW_FILE=&quot;${1:-data_view_export.ndjson}&quot;<br><br>if [ ! -f &quot;$DATA_VIEW_FILE&quot; ]; then<br>    echo &quot;Error: Data view file &#39;$DATA_VIEW_FILE&#39; not found!&quot;<br>    exit 1<br>fi<br><br>echo &quot;Importing data view to Kibana...&quot;<br><br>curl -X POST &quot;${KIBANA_URL}/api/saved_objects/_import?overwrite=true&quot; \<br>  ${API_KEY:+-H &quot;Authorization: ApiKey ${API_KEY}&quot;} \<br>  -H &quot;kbn-xsrf: true&quot; \<br>  -F &quot;file=@${DATA_VIEW_FILE};type=application/ndjson&quot;<br><br>echo -e &quot;\n&quot;<br>echo &quot;Data view import completed!&quot;</pre><p>Run it:</p><pre>./elastic/create_data_view.sh</pre><p>After the script completes, you should see a new data view in Kibana. Go to Discover &gt; Select the data view:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*TRI3eXn8AHC8ja1T-wuKag.png" /></figure><p>Previously sent document should appear in the Discover tab under the selected data view:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gw-agj2AXQY6kEQwpZw8jA.png" /></figure><h3>Option A: Create a Dashboard Manually</h3><p><strong>Note</strong>: You can skip manual dashboard creation and import a pre-configured dashboard instead (see option B below).</p><p>After importing the data view, you can create dashboards in Kibana UI. Navigate to <a href="http://localhost:5601/">http://localhost:5601</a> and go to <strong>Analytics &gt; Dashboard &gt; Create dashboard</strong>. To learn how to create dashboard refer to <a href="https://www.elastic.co/docs/explore-analyze/dashboards">Kibana documentation</a>.</p><p>Recommended visualizations for test metrics:</p><p><strong>Build Success Rate:</strong></p><ol><li>Go to Analytics &gt; Visualize Library &gt; Create &gt; Lens</li><li>Select Metric visualization</li><li>Add metric → Formula: (1 — (count(kql=’results.summary.failed &gt; 0&#39;) / count())) * 100</li><li>Add secondary metric → Count with KQL filter: results.summary.failed &gt; 0</li><li>Add breakdown → Top values of results.environment.buildName</li><li>Configure color palette with custom stops at 75% and 90%</li></ol><p><strong>Test Statistics:</strong></p><ol><li>Go to Analytics &gt; Visualize Library &gt; Create &gt; Lens</li><li>Select Bar vertical stacked</li><li>X-axis: Drag results.environment.buildNumber → set to Top values</li><li>Add Y-axis metrics:</li></ol><ul><li>Sum of results.summary.passed</li><li>Sum of results.summary.failed</li><li>Sum of results.summary.skipped</li><li>Sum of results.summary.pending</li></ul><p>5. Set custom colors in series settings</p><p>To export a dashboard for sharing or version control:</p><ol><li>Go to <strong>Stack Management &gt; Saved Objects</strong></li><li>Select your dashboard and related visualizations</li><li>Click <strong>Export</strong> and save the NDJSON file</li></ol><h3>Option B: Import Pre-configured Dashboard</h3><p>Instead of creating visualizations manually, you can import a pre-configured dashboard with all visualizations. This is especially useful for:</p><ul><li>Quickly setting up monitoring on new environments</li><li>Sharing dashboard configurations across teams</li><li>Version controlling your dashboard definitions (if you store them separately on GitHub)</li></ul><h4>Dashboard Export Format</h4><p>Kibana uses NDJSON (Newline Delimited JSON) format for importing/exporting saved objects. Each line in the file is a separate JSON object. Our dashboard export contains:</p><ol><li><strong>Index pattern</strong> — The data view definition</li><li><strong>Dashboard</strong> — The dashboard with all embedded visualizations</li></ol><p>Create a file elastic/visualizations/dashboard_export.ndjson:</p><pre>{&quot;attributes&quot;:{&quot;allowHidden&quot;:false,&quot;fieldAttrs&quot;:&quot;{}&quot;,&quot;fieldFormatMap&quot;:&quot;{}&quot;,&quot;fields&quot;:&quot;[]&quot;,&quot;name&quot;:&quot;dummy-test-junit&quot;,&quot;runtimeFieldMap&quot;:&quot;{}&quot;,&quot;sourceFilters&quot;:&quot;[]&quot;,&quot;timeFieldName&quot;:&quot;results.summary.stop&quot;,&quot;title&quot;:&quot;dummy-test-junit-*&quot;},&quot;coreMigrationVersion&quot;:&quot;8.8.0&quot;,&quot;created_at&quot;:&quot;2025-05-26T08:47:44.161Z&quot;,&quot;id&quot;:&quot;dummy-test-junit-index-pattern&quot;,&quot;managed&quot;:false,&quot;references&quot;:[],&quot;type&quot;:&quot;index-pattern&quot;,&quot;typeMigrationVersion&quot;:&quot;8.0.0&quot;,&quot;updated_at&quot;:&quot;2025-12-21T10:00:00.000Z&quot;,&quot;version&quot;:&quot;WzEsMV0=&quot;}</pre><p>The second line contains the full dashboard definition with embedded visualizations. Due to its size, here’s the structure explanation:</p><p><strong>Dashboard structure:</strong></p><ul><li>controlGroupInput: Filter controls (Build Name selector)</li><li>panelsJSON: Array of visualization panels</li><li>references: Links to the index pattern</li></ul><p><strong>Included visualizations:</strong></p><ol><li><strong>Average Suite Duration</strong> (Lens line chart) — Test suite duration over time, split by build name</li><li><strong>Build Success Rate</strong> (Lens metric) — Percentage of builds with no failures, color-coded (red &lt; 75%, yellow &lt; 90%, green &gt;= 90%)</li><li><strong>Test Statistics</strong> (Lens stacked bar) — Passed/Failed/Skipped counts per build</li><li><strong>Run Duration</strong> (Lens bar chart) — Total run duration per build</li><li><strong>Test Duration</strong> (Vega table) — Individual test duration stats (avg/min/max)</li><li><strong>Tests Success Rate</strong> (Vega table) — Per-test success rates with color coding</li></ol><p>The full NDJSON file is available in the <a href="https://github.com/alexshamrai/dummy-tests-junit/tree/master/elastic">dummy-tests-junit</a> repository.</p><h4>Vega Visualizations</h4><p>Two panels use Vega for advanced table-style visualizations. Here’s the Test Duration Vega spec structure:</p><pre>{<br>  &quot;$schema&quot;: &quot;https://vega.github.io/schema/vega/v4.json&quot;,<br>  &quot;title&quot;: &quot;Test Duration Table View&quot;,<br>  &quot;data&quot;: [{<br>    &quot;name&quot;: &quot;test_stats&quot;,<br>    &quot;url&quot;: {<br>      &quot;%context%&quot;: true,<br>      &quot;%timefield%&quot;: &quot;results.summary.stop&quot;,<br>      &quot;index&quot;: &quot;dummy-test-junit-*&quot;,<br>      &quot;body&quot;: {<br>        &quot;size&quot;: 0,<br>        &quot;aggs&quot;: {<br>          &quot;tests_nested&quot;: {<br>            &quot;nested&quot;: { &quot;path&quot;: &quot;results.tests&quot; },<br>            &quot;aggs&quot;: {<br>              &quot;by_test_name&quot;: {<br>                &quot;terms&quot;: { &quot;field&quot;: &quot;results.tests.name&quot;, &quot;size&quot;: 200 },<br>                &quot;aggs&quot;: {<br>                  &quot;avg_duration&quot;: { &quot;avg&quot;: { &quot;field&quot;: &quot;results.tests.duration&quot; } },<br>                  &quot;min_duration&quot;: { &quot;min&quot;: { &quot;field&quot;: &quot;results.tests.duration&quot; } },<br>                  &quot;max_duration&quot;: { &quot;max&quot;: { &quot;field&quot;: &quot;results.tests.duration&quot; } }<br>                }<br>              }<br>            }<br>          }<br>        }<br>      }<br>    }<br>  }],<br>  &quot;marks&quot;: [/* Table header and row rendering */]<br>}</pre><p>Key Vega concepts:</p><ul><li>%context%: Inherits dashboard time range and filters</li><li>%timefield%: Specifies the time field for filtering</li><li>Nested aggregations query individual tests within reports</li><li>Transform formulas convert milliseconds to readable format</li></ul><h4>Import Script</h4><p>Create an import script elastic/import_visualizations.sh:</p><pre>#!/bin/bash<br><br># Get the directory where this script is located<br>SCRIPT_DIR=&quot;$(cd &quot;$(dirname &quot;${BASH_SOURCE[0]}&quot;)&quot; &amp;&amp; pwd)&quot;<br><br># Configuration<br>API_KEY=&quot;${ELASTIC_API_KEY:-}&quot;<br>KIBANA_URL=&quot;${KIBANA_URL:-http://localhost:5601}&quot;<br><br># Colors for output<br>GREEN=&#39;\033[0;32m&#39;<br>RED=&#39;\033[0;31m&#39;<br>YELLOW=&#39;\033[1;33m&#39;<br>NC=&#39;\033[0m&#39;<br><br>import_file() {<br>    local file=&quot;$1&quot;<br>    local description=&quot;$2&quot;<br><br>    if [ ! -f &quot;$file&quot; ]; then<br>        echo -e &quot;${RED}[SKIP]${NC} File not found: $file&quot;<br>        return 1<br>    fi<br><br>    echo -e &quot;${YELLOW}Importing:${NC} $description&quot;<br><br>    local response=$(curl -s -X POST &quot;${KIBANA_URL}/api/saved_objects/_import?overwrite=true&quot; \<br>        ${API_KEY:+-H &quot;Authorization: ApiKey ${API_KEY}&quot;} \<br>        -H &quot;kbn-xsrf: true&quot; \<br>        -F &quot;file=@${file};type=application/ndjson&quot;)<br><br>    if echo &quot;$response&quot; | grep -q &#39;&quot;success&quot;:true&#39;; then<br>        echo -e &quot;${GREEN}[OK]${NC} Successfully imported $description&quot;<br>        return 0<br>    else<br>        echo -e &quot;${RED}[FAIL]${NC} Failed to import $description&quot;<br>        echo &quot;Response: $response&quot;<br>        return 1<br>    fi<br>}<br><br>echo &quot;==============================================&quot;<br>echo &quot;  Importing Kibana Visualizations&quot;<br>echo &quot;==============================================&quot;<br>echo &quot;&quot;<br>echo &quot;Kibana URL: ${KIBANA_URL}&quot;<br>echo &quot;&quot;<br><br># Check if Kibana is reachable<br>echo &quot;Checking Kibana connection...&quot;<br>if ! curl -s &quot;${KIBANA_URL}/api/status&quot; &gt; /dev/null 2&gt;&amp;1; then<br>    echo -e &quot;${RED}Error: Cannot connect to Kibana at ${KIBANA_URL}${NC}&quot;<br>    echo &quot;Make sure Kibana is running (docker-compose up -d)&quot;<br>    exit 1<br>fi<br>echo -e &quot;${GREEN}Kibana is reachable${NC}&quot;<br>echo &quot;&quot;<br><br># Import comprehensive dashboard with all visualizations<br>if import_file &quot;${SCRIPT_DIR}/visualizations/dashboard_export.ndjson&quot; &quot;Test Automation Metrics Dashboard&quot;; then<br>    echo &quot;&quot;<br>    echo -e &quot;${GREEN}Dashboard imported successfully!${NC}&quot;<br>    echo &quot;&quot;<br>    echo &quot;View your dashboard:&quot;<br>    echo &quot;  1. Open ${KIBANA_URL}&quot;<br>    echo &quot;  2. Go to Analytics &gt; Dashboard&quot;<br>    echo &quot;  3. Open &#39;Test Automation Metrics&#39;&quot;<br>else<br>    echo -e &quot;${RED}Import failed. Check the errors above.${NC}&quot;<br>    exit 1<br>fi</pre><p>Make it executable and run:</p><pre>./elastic/import_visualizations.sh</pre><p>The script:</p><ol><li>Checks Kibana connectivity</li><li>Imports the dashboard NDJSON file using Kibana’s saved objects API</li><li>Uses overwrite=true to update existing objects</li><li>Reports success/failure with colored output</li></ol><p>After successful import, navigate to <strong>Analytics &gt; Dashboard</strong> in Kibana and open “Test Automation Metrics” to view your dashboard. Since we do not have a lot of historical data, the dashboard won’t be super informative and useful:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Eq4oCvebjOlx5CUjqXRDag.png" /></figure><h3>Populating Sample Data</h3><p>To test your dashboard with sample data from dummy-test-junit project resources/sampleData, use a script elastic/populate_sample_data.sh:</p><pre>./elastic/populate_sample_data.sh</pre><p>The sample data folder contains pre-generated CTRF reports named ctrf-rep1.json, ctrf-rep2.json, etc. The script iterates through all ctrf-rep*.json files in acceptance/ and regression/ subfolders and sends each one to Elasticsearch as a separate document, spreading them across the 10-day period to simulate historical test runs.</p><p><strong>Note:</strong> As you may remember, we use results.summary.stop field as a time marker. The sample data contains hardcoded timestamps from December 2025. To see the data in Kibana, adjust the time range picker in the top-right corner to include that period (e.g., select &quot;Last 1 year&quot; or set a custom range to December 14-23, 2025).</p><p>Use the following <a href="http://localhost:5601/app/dashboards#/view/test-automation-dashboard?_g=(filters:!(),refreshInterval:(pause:!t,value:60000),time:(from:&#39;2025-12-14T07:00:00.000Z&#39;,to:&#39;2025-12-23T21:00:00.000Z&#39;))">link</a> to view the dashboard with sample data:</p><p>It shows the data for the required time range, and can be filtered by build name(e.g. <em>“Regression”</em>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-O021YSGd2LKvWDIDHoWbw.png" /></figure><h3>4. CI/CD Integration</h3><p>For production use, you’ll want to integrate metrics sending into your CI/CD pipeline. Here’s how to do it with GitHub Actions.</p><h3>GitHub Actions Example</h3><p>Add a step to your workflow file (e.g., .github/workflows/ci.yml):</p><pre>name: Build and Test<br><br>on:<br>  push:<br>    branches: [master, main]<br>  pull_request:<br>    branches: [master, main]<br><br>jobs:<br>  test:<br>    runs-on: ubuntu-latest<br><br>    steps:<br>      - uses: actions/checkout@v5<br>        <br>      - name: Set up JDK 25<br>        uses: actions/setup-java@v5<br>        with:<br>           java-version: 25<br>           distribution: &#39;temurin&#39;<br><br>      - name: Setup Gradle<br>        uses: gradle/actions/setup-gradle@v5<br><br>      - name: Run Tests<br>        run: |<br>          ./gradlew clean test \<br>            -Dctrf.build.name=${{ github.workflow }} \<br>            -Dctrf.build.number=${{ github.run_number }} \<br>            -Dctrf.build.url=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} \<br>            -Dctrf.branch.name=${{ github.ref_name }} \<br>            -Dctrf.commit=${{ github.sha }}<br><br>      - name: Send Metrics to Elasticsearch<br>        if: always()<br>        env:<br>          ELASTIC_URL: ${{ secrets.ELASTIC_URL }}<br>          ELASTIC_API_KEY: ${{ secrets.ELASTIC_API_KEY }}<br>          ELASTIC_INDEX_NAME: my-project-tests<br>        run: ./gradlew sendMetricsToElastic</pre><h3>Required Secrets</h3><p>Configure these secrets in your GitHub repository (Settings &gt; Secrets and variables &gt; Actions):</p><ul><li>ELASTIC_URL: Your Elasticsearch cluster URL (e.g., <a href="https://my-cluster.elastic.cloud:9243)">https://my-cluster.elastic.cloud:9243)</a></li><li>ELASTIC_API_KEY: API key for authentication</li></ul><h3>Important Notes</h3><ul><li>Use if: always() to send metrics even when tests fail</li><li>CTRF system properties (-Dctrf.*) populate the environment section of the report</li><li>For self-hosted Elasticsearch, ensure your CI runner can reach the cluster</li></ul><h3>Conclusion</h3><p>By following these steps, you’ve set up a complete test automation metrics pipeline:</p><ol><li><strong>CTRF Extension</strong> generates standardized JSON reports from JUnit tests</li><li><strong>Gradle Task</strong> sends reports to Elasticsearch with date-based indexing</li><li><strong>Index Templates</strong> ensure proper field types for querying and aggregation</li><li><strong>Kibana Data Views</strong> enable visualization and analysis</li><li><strong>Pre-configured Dashboard</strong> provides wide possibilities for visualizations with Lens and Vega charts</li></ol><p>This setup allows you to have:</p><ul><li>Long-term storage of test results</li><li>Historical test execution tracking</li><li>Visualization of test metrics and trends</li><li>Ability to identify flaky tests and performance regressions</li><li>CI/CD integration for automated metrics collection</li><li>Importable dashboard definitions for quick setup</li></ul><h3>Quick Local Setup Summary</h3><pre># 1. Start Elasticsearch and Kibana<br>docker-compose up -d<br><br># 2. Create index templates<br>./elastic/create_index_template.sh<br><br># 3. Create data view in Kibana<br>./elastic/create_data_view.sh<br><br># 4. Import the dashboard<br>./elastic/import_visualizations.sh<br><br># 5. Populate sample data (optional - for testing without running actual tests)<br>./elastic/populate_sample_data.sh<br><br># 6. Or run your own tests and send metrics<br>./gradlew clean test \<br>  -Dctrf.build.name=local \<br>  -Dctrf.build.number=$((RANDOM % 9000 + 1000))<br>./gradlew sendMetricsToElastic<br><br># 7. Open Kibana and view your dashboard<br>open http://localhost:5601</pre><p>The configuration is flexible and can be adapted to different project needs by modifying the index templates, data views, and dashboards. Check the <a href="https://github.com/alexshamrai/dummy-tests-junit">dummy-tests-junit</a> repository for a complete working example with all scripts and NDJSON files.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11a064d56493" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Common Test Report Format and Junit5]]></title>
            <link>https://medium.com/@alexshamrai/common-test-report-format-and-junit5-cfb113d9eaa0?source=rss-b07565ff1bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/cfb113d9eaa0</guid>
            <category><![CDATA[testing]]></category>
            <category><![CDATA[test-report]]></category>
            <category><![CDATA[test-reporting]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[testing-tools]]></category>
            <dc:creator><![CDATA[Alex Shamrai]]></dc:creator>
            <pubDate>Wed, 23 Apr 2025 14:28:38 GMT</pubDate>
            <atom:updated>2025-04-24T13:21:02.758Z</atom:updated>
            <content:encoded><![CDATA[<p>In the world of software testing, effective reporting is crucial for understanding test results, identifying issues, and making informed decisions. However, the lack of standardization in test reporting formats has long been a challenge for teams working with multiple testing frameworks and tools. This is where the Common Test Report Format (CTRF) comes in, offering a universal JSON schema for test reports. In this article, we’ll explore a JUnit 5 extension for CTRF and why it might be a better choice for you than the official converter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VFl5MeQRwAq3OShK2FMbMw.png" /></figure><h3>Understanding CTRF: The Universal Test Reporting Format</h3><p><a href="https://ctrf.io/">CTRF (Common Test Report Format)</a> is an open standard that addresses the fragmentation in test reporting formats. Each testing tool and framework produced reports in its own unique format, making it difficult to aggregate and analyze results across different platforms.</p><p>CTRF solves this problem by providing:</p><ul><li><strong>A standardized JSON schema</strong> for test reports that works with the majority of testing frameworks</li><li><strong>Consistency across tools</strong>, making it easier to understand and compare reports</li><li><strong>Language and framework-agnostic</strong> reporting that works with any programming language</li><li><strong>Better analysis capabilities</strong> through a uniform structure for programmatic processing</li></ul><p>With CTRF, you can have a single, consistent format for all their test reports, regardless of the testing tools they use.</p><blockquote><em>Why personally, I noticed CTRF, is that it easily allows showing test results as a part of the GitHub Action summary, and has a lot of customization capabilities. And it comes very handy when you have different tests written in different languages, but want to process the data the same way.</em></blockquote><p>Here is an example of a possible summary produced by GitHub CTRF test reporter:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lDF2C6tF9QWVfJ-22bPoig.png" /></figure><h3>Introducing the JUnit CTRF Extension</h3><p>Even though there is an <a href="https://github.com/ctrf-io/junit-to-ctrf">official converter</a> for Junit tests, I decided to create my own lib based on Junit Extension to provide test results in JSON format. The <a href="https://github.com/alexshamrai/junit-ctrf-extension">JUnit CTRF Extension</a> is a powerful tool that integrates directly with JUnit. Unlike converters that process reports after tests have run, this extension works as a native part of the JUnit 5 ecosystem. From a logic perspective, it seems more correct and allows me to have more customization, like adding more information about the test run to an existing official JSON scheme.</p><h3>Key Features</h3><ul><li><strong>Native JUnit 5 integration</strong> through the Extension API</li><li><strong>Real-time test result capture</strong> during test execution</li><li><strong>Comprehensive metadata collection</strong> including test status, duration, and failure details</li><li><strong>Highly configurable</strong> through a simple properties file</li><li><strong>Support for parallel test execution</strong> with thread-safe implementation</li></ul><h3>Why Use an Extension Instead of the Official Converter?</h3><p>The official <a href="https://github.com/ctrf-io/junit-to-ctrf">junit-to-ctrf converter</a> from the CTRF team is a valuable tool, but the JUnit CTRF Extension offers several advantages that make it a compelling alternative:</p><h3>1. Real-Time Data Capture vs. Post-Processing</h3><p>The extension captures test data <strong>during execution</strong>, ensuring that all relevant information is collected in its original context. In contrast, converters work after tests have completed, potentially missing valuable runtime information.</p><pre>// The extension captures data at the exact moment it happens <br>@Override<br>public void testFailed(ExtensionContext context, Throwable cause) {<br>    findTestByContext(context).ifPresent(test -&gt; {<br>        test.setStatus(FAILED);<br>        testProcessor.setFailureDetails(test, cause);<br>    });<br>}</pre><h3>2. Richer Metadata Collection</h3><p>By hooking directly into JUnit’s lifecycle, the extension can collect richer metadata that might not be available in the native XML reports that converters typically process, for example:</p><ul><li>Thread information for parallel execution analysis</li><li>Detailed context about the test environment</li></ul><h3>3. Simplified Workflow</h3><p>Using the extension eliminates an entire step in your CI/CD pipeline:</p><p><strong>With Converter:</strong></p><ol><li>Run tests (it generates JUnit XML reports)</li><li>Run converter to transform XML to CTRF</li><li>Process CTRF reports</li></ol><p><strong>With Extension:</strong></p><ol><li>Run tests (CTRF reports generated automatically)</li><li>Process CTRF reports</li></ol><h3>4. No XML Limitations</h3><p>JUnit XML reports have inherent limitations in what they can represent. By bypassing XML entirely, the extension avoids these limitations and can produce more accurate and complete CTRF reports.</p><h3>5. Configuration Flexibility</h3><p>The extension offers extensive configuration options through a simple properties file:</p><pre>ctrf.report.path=build/test-results/test/ctrf-report.json<br>ctrf.max.message.length=300<br>ctrf.app.name=My Application<br>ctrf.app.version=1.0.0<br>ctrf.test.environment=staging</pre><h3>How to Use the JUnit CTRF Extension</h3><p>Getting started with the extension is straightforward:</p><h3>1. Add the Dependency</h3><p>For Gradle:</p><pre>dependencies {<br>    implementation &#39;io.github.alexshamrai:junit-ctrf-extension:0.3.1&#39;<br>}</pre><p>For Maven:</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;io.github.alexshamrai&lt;/groupId&gt;<br>    &lt;artifactId&gt;junit-ctrf-extension&lt;/artifactId&gt;<br>    &lt;version&gt;0.3.1&lt;/version&gt;<br>&lt;/dependency&gt;</pre><h3>2. Register the Extension</h3><p>Simply add the @ExtendWith annotation to your test classes:</p><pre>import io.github.alexshamrai.jupiter.CtrfExtension;<br>import org.junit.jupiter.api.Test;<br>import org.junit.jupiter.api.extension.ExtendWith;<br><br>@ExtendWith(CtrfExtension.class)<br>public class MyTest {<br>    @Test<br>    void testExample() {        // Your test code    }}</pre><p>As an alternative, you can use <strong>Automatic Extension Registration</strong>, by adding the fully qualified name to the /META-INF/services/org.junit.jupiter.api.extension.Extension file:</p><pre>io.github.alexshamrai.jupiter.CtrfExtension</pre><h3>3. Optional Config</h3><p>Create a ctrf.properties file in your src/test/resources directory to customize the report:</p><pre>ctrf.report.path=build/test-results/test/ctrf-report.json<br>ctrf.app.name=My Application<br>ctrf.app.version=1.0.0<br>ctrf.test.environment=staging</pre><p>In case of absence, default values will be used. That’s it! When you run your tests, CTRF reports will be automatically generated.</p><h3>Real-World Use Cases</h3><h3>Unified Reporting Across Multiple Test Types</h3><p>Teams often use different testing approaches (unit, integration, UI) with different frameworks. The JUnit CTRF Extension allows JUnit tests to produce reports in the same format as other CTRF-compatible tools, enabling unified dashboards and analysis.</p><h3>CI/CD Pipeline Integration</h3><p>The extension simplifies CI/CD pipelines by eliminating the conversion step. CTRF reports can be directly consumed by downstream tools for test result visualization, trend analysis, or failure notifications.</p><h3>Under the Hood: How It Works</h3><p>The JUnit CTRF Extension leverages JUnit 5’s powerful extension model to hook into the test lifecycle:</p><ol><li><strong>Before tests run</strong>: The extension initializes and prepares to capture results</li><li><strong>During test execution</strong>: It captures test status, timing, and failure details</li><li><strong>After tests complete</strong>: It composes the CTRF JSON structure and writes it to a file</li></ol><h3>Conclusion</h3><p>While the official junit-to-ctrf converter is a valuable tool, the JUnit CTRF Extension offers a more integrated, efficient, and feature-rich approach to generating CTRF reports from JUnit tests. For teams using JUnit 5, the extension represents the most direct path to standardized CTRF reporting, with all the benefits that bring for cross-tool compatibility and unified test analysis.</p><blockquote><strong>Important note:</strong> My intention is not to criticize or diminish the value of the Official converter. I’m sincerely grateful to <a href="https://medium.com/u/aae22191cede">Matthew Thomas</a> for creating it. The Official converter made it incredibly easy for me to start using CTRF right away. It was only after I encountered the need for some additional features that I began exploring the idea of creating my own library.</blockquote><h3>Resources</h3><ul><li><a href="https://ctrf.io/">CTRF Official Website</a></li><li><a href="https://github.com/alexshamrai/junit-ctrf-extension">JUnit CTRF Extension on GitHub</a></li><li><a href="https://junit.org/junit5/docs/current/user-guide/">JUnit 5 User Guide</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cfb113d9eaa0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[gRPC Testing intro. Writing the first test.]]></title>
            <link>https://medium.com/@alexshamrai/grpc-testing-intro-writing-the-first-test-ac816fbae19d?source=rss-b07565ff1bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac816fbae19d</guid>
            <category><![CDATA[grpc]]></category>
            <category><![CDATA[qa-automation]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Alex Shamrai]]></dc:creator>
            <pubDate>Wed, 02 Apr 2025 08:01:00 GMT</pubDate>
            <atom:updated>2025-04-02T08:01:00.566Z</atom:updated>
            <content:encoded><![CDATA[<p>This article covers more practical examples of testing gRPC api. We will create a gRPC server using SpringBoot and write a test for it in a separate module. This is the second part of the “gRPC Testing intro” series. Please check <a href="https://medium.com/@alexshamrai/grpc-testing-intro-grpc-basics-7e25c3a7987a">the first article</a> if you need to cover some gRPC basics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aU9jndpA2jJgAMzotYP7Zw.png" /></figure><h3>Create Employee service</h3><p>Let’s create a simple backend service using Java, Gradle, and SpringBoot. Just keep in mind that we will create a multi-module project. Where one module will be for the employee-service and another one is for tests - e2e-tests</p><h3>Gradle Configuration</h3><p>We should add the following dependencies for the service build.gradle Since we are going to implement a Spring Boot service, we need to add the Spring Boot plugin and dependency management, a plugin that works with Protocol Buffers files for code generation.</p><pre>plugins {<br>    id &#39;org.springframework.boot&#39; version &#39;3.4.0&#39;<br>    id &#39;io.spring.dependency-management&#39; version &#39;1.1.7&#39;<br>    id &#39;com.google.protobuf&#39; version &#39;0.9.4&#39;<br>}</pre><p>Add necessary libraries</p><pre>dependencies {<br>    implementation &#39;io.grpc:grpc-protobuf:1.63.0&#39;<br>    implementation &#39;io.grpc:grpc-stub:1.63.0&#39;<br>    implementation &#39;com.google.protobuf:protobuf-java:4.29.1&#39;<br><br>    implementation &#39;net.devh:grpc-server-spring-boot-starter:3.1.0.RELEASE&#39;<br>    annotationProcessor &#39;org.projectlombok:lombok:1.18.36&#39;<br>    compileOnly &#39;org.projectlombok:lombok:1.18.36&#39;<br>    testImplementation &#39;org.springframework.boot:spring-boot-starter-test&#39;<br>    implementation &#39;javax.annotation:javax.annotation-api:1.3.2&#39;<br>}</pre><p>Customize protobuf compilation</p><pre>protobuf {<br>    protoc {<br>        artifact = &#39;com.google.protobuf:protoc:4.29.1&#39;<br>    }<br><br>    plugins {<br>        grpc {<br>            artifact =&#39;io.grpc:protoc-gen-grpc-java:1.63.0&#39;<br>        }<br>    }<br>    generateProtoTasks {<br>        all()*.plugins {<br>            grpc {}<br>        }<br>    }<br>}</pre><p>The resulting build.gradle will look like:</p><pre>plugins {<br>    id &#39;org.springframework.boot&#39; version &#39;3.4.0&#39;<br>    id &#39;io.spring.dependency-management&#39; version &#39;1.1.7&#39;<br>    id &#39;com.google.protobuf&#39; version &#39;0.9.4&#39;<br>}<br><br>group = &#39;io.github.alexshamrai&#39;<br>version = &#39;1.0-SNAPSHOT&#39;<br><br>repositories {<br>    mavenCentral()<br>}<br><br>dependencies {<br>    implementation &#39;io.grpc:grpc-protobuf:1.63.0&#39;<br>    implementation &#39;io.grpc:grpc-stub:1.63.0&#39;<br>    implementation &#39;com.google.protobuf:protobuf-java:4.29.1&#39;<br><br>    implementation &#39;net.devh:grpc-server-spring-boot-starter:3.1.0.RELEASE&#39;<br>    annotationProcessor &#39;org.projectlombok:lombok:1.18.36&#39;<br>    compileOnly &#39;org.projectlombok:lombok:1.18.36&#39;<br>    testImplementation &#39;org.springframework.boot:spring-boot-starter-test&#39;<br>    implementation &#39;javax.annotation:javax.annotation-api:1.3.2&#39;<br>}<br><br>protobuf {<br>    protoc {<br>        artifact = &#39;com.google.protobuf:protoc:4.29.1&#39;<br>    }<br>    plugins {<br>        grpc {<br>            artifact = &#39;io.grpc:protoc-gen-grpc-java:1.63.0&#39;<br>        }<br>    }    generateProtoTasks {<br>        all()*.plugins {<br>            grpc {}<br>        }    }}<br><br>test {<br>    useJUnitPlatform()<br>}</pre><h3>Create proto file and generate code</h3><p>Let’s put employee.proto file to employee-service/src/main/proto/ It will have the following info:</p><pre>syntax = &quot;proto3&quot;;<br><br>import &quot;google/protobuf/empty.proto&quot;;<br><br>option java_multiple_files = true;<br>package io.github.alexshamrai.grpc;<br><br>service EmployeeService {<br>  rpc GetAllEmployees (google.protobuf.Empty) returns (GetAllEmployeesResponse) {}<br>  rpc AddEmployee (AddEmployeeRequest) returns (AddEmployeeResponse) {}<br>  rpc GetEmployee (GetEmployeeRequest) returns (GetEmployeeResponse) {}<br>  rpc FilterEmployees (EmployeeFilterRequest) returns (EmployeeListResponse) {}<br>  rpc GetDepartments (google.protobuf.Empty) returns (GetDepartmentsResponse) {}<br>}<br><br>message EmployeeFilterRequest {<br>  optional int32 hiring_year = 1;<br>  optional string department = 2;<br>  optional int32 min_age = 3;<br>  optional int32 max_age = 4;<br>  optional string position = 5;<br>  optional double min_salary = 6;<br>  optional double max_salary = 7;<br>}<br><br>message EmployeeListResponse {<br>  repeated Employee employees = 1;<br>}<br><br>message GetDepartmentsResponse {<br>  repeated Department departments = 1;<br>}<br><br>message Department {<br>  string department_name = 1;<br>}<br><br>message GetAllEmployeesResponse {<br>  repeated Employee employees = 1;<br>}<br><br>message GetEmployeeRequest {<br>  int32 employee_id = 1;<br>}<br><br>message GetEmployeeResponse {<br>  Employee employee = 1;<br>}<br><br>message AddEmployeeRequest {<br>  string name = 1;<br>  int32 age = 2;<br>  string department = 3;<br>  string position = 4;<br>  int32 hiring_year = 5;<br>  double salary = 6;<br>}<br><br>message AddEmployeeResponse {<br>  int32 employee_id = 1;<br>}<br><br>message Employee {<br>  int32 id = 1;<br>  string name = 2;<br>  int32 age = 3;<br>  string department = 4;<br>  string position = 5;<br>  int32 hiring_year = 6;<br>  double salary = 7;<br>}</pre><p>The EmployeeService includes multiple RPC methods:</p><ul><li>GetAllEmployees: Returns a list of all employees.</li><li>AddEmployee: Adds a new employee and returns the assigned ID.</li><li>GetEmployee: Retrieves details of a specific employee by their ID.</li><li>FilterEmployees: Fetches employees filtering by given logic</li><li>GetDepartments: Returns a list of departments. Messages and Types:</li><li>Employee: Represents an employee with fields such as id, name, age, department, position, hiring_year, and salary.</li><li>Department: Contains a department’s name and the year it was established (hiring_year).</li></ul><p><strong>Request and Response Messages</strong>:</p><ul><li>AddEmployeeRequest: Contains fields required to add an employee (e.g., name, age, department, etc.).</li><li>AddEmployeeResponse: Returns the ID of the newly added employee.</li><li>GetEmployeeRequest &amp; GetEmployeeResponse: Handle fetching details for a specific employee.</li><li>EmployeeFilterRequest &amp; EmployeeListResponse: Facilitate querying employees by filtering logic.</li><li>GetDepartmentsResponse: Provides a list of available departments.</li><li>GetAllEmployeesResponse: Returns a list of all employees.</li></ul><p>The google.protobuf.Empty message is imported for use in methods that don’t require specific request data, such as GetAllEmployees and GetDepartments.</p><p>This .proto file is the blueprint for our gRPC service. It defines the contract between the client and the server, ensuring type safety and seamless communication. The generated code will handle serialization, deserialization, and boilerplate code, allowing developers to focus on business logic.</p><p>To generate files, you can run</p><pre>./gradlew generateProto</pre><p>Generated java classes will be available here: employee-service/build/generated/source/proto/main</p><h3>Service implementation</h3><p>Let’s create EmployeeService that will extend EmployeeServiceGrpc.EmployeeServiceImplBase and implement all the methods described in .proto file. It will have injected EmployeeRepository - in our case it is not a DB, it&#39;s just an in-memory data storage and management layer for employees. It provides methods to perform CRUD-like operations on the employee data. Since there&#39;s no actual database here, all data is stored in memory during the runtime of the application. It is pre-populated with four sample employees during application startup using a static block.</p><p>The EmployeeService class is a gRPC service implementation in Java, which provides several methods to manage employee data. It extends the EmployeeServiceGrpc.EmployeeServiceImplBase class, which is generated from the employee.proto file. This class uses Spring Boot and integrates with a repository to perform CRUD operations on employee data.</p><p>Key Components:</p><p><strong>1.Annotations</strong>:</p><ul><li>@GrpcService: Marks the class as a gRPC service. Instead of @Controller for the REST services</li></ul><p><strong>2.Methods</strong>:</p><ul><li>getAllEmployees: Retrieves all employees from the repository and sends them to the client.</li><li>addEmployee: Adds a new employee to the repository after validating the request.</li><li>getEmployee: Retrieves a specific employee by ID.</li><li>getEmployeesByHiringYear: Retrieves employees hired in a specific year.</li><li>getDepartments: Retrieves all departments.</li></ul><p>This method demonstrates how gRPC methods are implemented in Java:</p><pre>@Override<br>public void getAllEmployees(Empty request, StreamObserver&lt;GetAllEmployeesResponse&gt; responseObserver) {<br>    GetAllEmployeesResponse response = GetAllEmployeesResponse.newBuilder()<br>        .addAllEmployees(employeeRepository.getAllEmployees().stream()<br>            .map(employee -&gt; io.github.alexshamrai.grpc.Employee.newBuilder()<br>                .setId(employee.getId())<br>                .setName(employee.getName())<br>                .setAge(employee.getAge())<br>                .setDepartment(employee.getDepartment())<br>                .setPosition(employee.getPosition())<br>                .setHiringYear(employee.getHiringYear())<br>                .setSalary(employee.getSalary())<br>                .build())<br>            .toList())<br>        .build();<br><br>    responseObserver.onNext(response);<br>    responseObserver.onCompleted();<br>}</pre><h4>Explanation:</h4><ul><li><strong>Request and Response</strong>: The method takes a request of type Empty and a StreamObserver to send the response.</li><li><strong>Building the Response</strong>: It fetches all employees from the repository, maps them to the gRPC Employee message format, and builds the GetAllEmployeesResponse(which is required by described contract in proto file). It is transformed via builder and setters according to described data in proto file</li><li><strong>Sending the Response</strong>: The response is sent to the client using responseObserver.onNext(response) and the call is completed with responseObserver.onCompleted().</li></ul><p>This pattern is repeated for other methods, with specific logic for each operation. Inside the method addEmployee we have an example of the validation with error handling. The method performs validation checks on the incoming request data. When validation fails, it sends an error response using gRPC&#39;s Status codes.</p><pre>@Override<br>public void addEmployee(AddEmployeeRequest request, StreamObserver&lt;AddEmployeeResponse&gt; responseObserver) {<br>    if (request.getAge() &lt; 18 || request.getAge() &gt; 60) {<br>        responseObserver.onError(Status.INVALID_ARGUMENT<br>            .withDescription(&quot;Employee age must be between 18 and 60&quot;)<br>            .asRuntimeException());<br>        return;<br>    }<br><br>    if (request.getSalary() &lt;= 0) {<br>        responseObserver.onError(Status.INVALID_ARGUMENT<br>            .withDescription(&quot;Employee salary must be greater than 0&quot;)<br>            .asRuntimeException());<br>        return;<br>    }<br>}</pre><p>Full code example you can find <a href="https://github.com/alexshamrai/grpc-employee-service">here</a> on gitHub.</p><h3>Application Config</h3><p>In the application.yml you can find typical Spring configuration.</p><pre>server:<br>  port: 8091<br><br>grpc:<br>  server:<br>    port: 6565<br><br>spring:<br>  application:<br>    name: employee-service</pre><p>The server starts on 8091 port. Grpc port is 6565. Now we can build service using appropriate gradle command and run it.</p><p>After running the service. You can check its availability via grpcui</p><pre>grpcui -plaintext localhost:6565</pre><h3>gRPC Autotests approach</h3><p>The approach of implementing test automation could be different. You could put them into the backend service repository, or put in a separate repo. Each approach has its benefits and drawbacks.</p><h4>Tests in the Same Repository</h4><p><strong>Pros:</strong></p><ul><li><strong>Simplicity:</strong> Tests stay close to the code they’re testing, making it easier to maintain alignment between tests and implementation.</li><li><strong>Shared infrastructure:</strong> Tests can reuse project infrastructure, dependencies, and configuration.</li><li><strong>Integrated CI/CD:</strong> Tests naturally become part of the same build pipeline.</li><li><strong>Lower setup overhead:</strong> Developers don’t need to clone or set up a separate repository.</li><li><strong>Version synchronization:</strong> Tests automatically stay in sync with the code they’re testing. <strong>Cons:</strong></li><li><strong>Repository bloat:</strong> The repository can grow large and complex if tests include extensive test data and scenarios.</li><li><strong>Implementation dependency risk:</strong> Tests may inadvertently become tied to specific implementation details instead of focusing on the service’s public interface and behavior.</li><li><strong>Release constraints:</strong> Test code follows the same release cycle as production code, which might not always be ideal.</li></ul><h4>Tests in a Separate Repository</h4><p><strong>Pros:</strong></p><ul><li><strong>Clean separation:</strong> Clearer boundary between implementation and test code.</li><li><strong>Consumer-focused testing:</strong> Tests better represent real client usage patterns.</li><li><strong>Integration focus:</strong> Better suited for end-to-end and cross-service integration testing.</li><li><strong>Cross-team collaboration:</strong> Separate test repositories can be maintained by dedicated QA teams.</li></ul><p><strong>Cons:</strong></p><ul><li><strong>Version synchronization challenges:</strong> Extra effort is needed to keep tests in sync with service versions.</li><li><strong>Additional setup:</strong> Developers need to clone and configure multiple repositories.</li><li><strong>Communication issue:</strong> Changes to service contracts require explicit communication to test maintainers. Developers might be less inclined to update tests in a separate repository.</li></ul><h3>gRPC-Specific Testing Details</h3><h3>Interface-Driven Development</h3><p>gRPC’s strong contract definition through Protocol Buffers creates unique opportunities for testing:</p><ol><li><strong>Contract-first testing:</strong> Tests can be written against the Proto definitions before implementation.</li><li><strong>Stub generation:</strong> Both server and client stubs can be generated from the same Proto files.</li><li><strong>Mock services:</strong> gRPC makes it relatively easy to create mock implementations for testing.</li></ol><h3>Testing Strategy for gRPC</h3><p>Regardless of repository structure, consider these testing approaches:</p><ol><li><strong>Unit tests:</strong> Testing individual service methods with mocked dependencies.</li><li><strong>Integration tests:</strong> Testing the complete service with real or stubbed dependencies.</li><li><strong>Contract tests:</strong> Ensuring the service adheres to its Proto definition.</li><li><strong>Performance tests:</strong> Testing throughput and latency of gRPC endpoints.</li></ol><h3>Hybrid Approaches</h3><p>Some dev teams prefer hybrid approaches:</p><ol><li><strong>Core tests in-repo, integration tests separate:</strong> Keep unit and simple integration tests with the service code, but have broader system tests in a separate repository.</li><li><strong>Shared test libraries:</strong> Create shared libraries for common test functionality that can be used across repositories.</li><li><strong>Test as a consumer:</strong> Have a separate testing project that consumes the service as a dependency, treating it as a real client would.</li></ol><h3>Practical Recommendations</h3><p>For most teams working with gRPC services:</p><ol><li>Start with tests in the same repository for simplicity.</li><li>Focus on testing the service interface (contract) rather than implementation details.</li><li>Consider extracting integration tests to a separate repository as your system grows more complex.</li><li>Use the strong typing and contract definition of gRPC to drive your test development.</li></ol><h3>gRPC Autotests implementation</h3><p>For our implementation we will choose to have e2e tests in the same repository(but in a separate module). This approach is also known as monorepository. We can just copy the proto file to our repository with tests(a very straightforward solution). Or add our microservice code as a dependency, to have already generated code, which obviously, is a better option. To do it, add the following dependency to the tests build.gradle file:</p><pre>implementation project(&#39;:employee-service&#39;)</pre><p>And also, we will add grpc-stub dependency, in order to use client stubs for calling our service</p><pre>implementation &#39;io.grpc:grpc-stub:1.63.0&#39;</pre><p>Add protobuf-java-util for converting between Protobuf objects and JSON.</p><pre>implementation &#39;com.google.protobuf:protobuf-java-util:4.30.2&#39;</pre><p>Let’s create a BaseTest class where we will initialize our gRPC client. In gRPC, different types of stubs that determine how clients interact with the server - <strong>Blocking Stub:</strong></p><ul><li>Synchronous execution: Calls block until the server responds or times out</li><li>Sequential processing: Each operation completes before the next begins</li><li>Simple programming model: Functions like regular method calls</li><li>Ideal for tests: Makes assertions and test flow easier to follow</li><li>Usage: blockingStub.getAllEmployees(Empty.getDefaultInstance()) <strong>Async Stub:</strong></li><li>Asynchronous execution: Non-blocking calls that continue immediately</li><li>Uses callbacks: Responses are handled through StreamObserver callbacks</li><li>Concurrent processing: Multiple operations can be in flight simultaneously</li><li>More complex: Requires callback management</li><li>Usage: asyncStub.getAllEmployees(request, responseObserver)</li></ul><p>Then we will use blocking stub because it simplifies testing by providing a sequential, predictable flow that waits for each RPC call to complete before continuing with assertions.</p><pre>public abstract class BaseTest {<br><br>    protected static EmployeeServiceGrpc.EmployeeServiceBlockingStub blockingStub;<br>    protected static Channel channel;<br><br>    @BeforeAll<br>    public static void init(){<br>        channel = ManagedChannelBuilder<br>            .forAddress(&quot;localhost&quot;, 6565)<br>            .usePlaintext()<br>            .build();<br><br>        blockingStub = EmployeeServiceGrpc.newBlockingStub(channel);<br>    }<br>}</pre><p>We have just created a communication channel to connect with the gRPC server running on localhost:6565, using plaintext communication with .usePlaintext() The channel represents the network connection that the blocking stub will use to send requests and receive responses. In gRPC, the channel:</p><ul><li>Manages connection pooling</li><li>Handles reconnection logic</li><li>Provides load balancing (when connecting to multiple servers)</li><li>Controls communication properties like timeouts and retries</li></ul><h4>First positive test</h4><p>Let’s create a test for the scenario when we can create an employee via AddEmployee and check that we can successfully get it by id via GetEmployee. Let&#39;s create EmployeeTest, which will inherit BaseTest and use its blockingStub.</p><p>At first, we will create a request with Employee data:</p><pre>AddEmployeeRequest request = AddEmployeeRequest.newBuilder()<br>    .setName(&quot;Aaron Lennon&quot;)<br>    .setAge(32)<br>    .setDepartment(&quot;IT&quot;)<br>    .setPosition(&quot;Support&quot;)<br>    .setHiringYear(2020)<br>    .setSalary(1500.0)<br>    .build();</pre><p>And send it to the service via blockingStub AddEmployeeResponse addEmployeeResponse = blockingStub.addEmployee(request);</p><p>After it, let’s get created Employee by id</p><pre>GetEmployeeResponse employeeResponse = blockingStub<br>        .getEmployee(GetEmployeeRequest.newBuilder()<br>            .setEmployeeId(addEmployeeResponse.getEmployeeId())<br>            .build());</pre><p>At last, let’s assert that our data is exactly the same as we expect</p><pre>assertEquals(&quot;Aaron Lennon&quot;, employeeResponse.getEmployee().getName());<br>assertEquals(32, employeeResponse.getEmployee().getAge());<br>assertEquals(&quot;IT&quot;, employeeResponse.getEmployee().getDepartment());<br>assertEquals(&quot;Support&quot;, employeeResponse.getEmployee().getPosition());<br>assertEquals(2020, employeeResponse.getEmployee().getHiringYear());<br>assertEquals(1500.0, employeeResponse.getEmployee().getSalary());</pre><p>This is a very straightforward solution on how to do it. Let’s extract the Employee creation to reuse it and get rid of repeatable code. The result will be:</p><pre>import io.github.alexshamrai.data.Employee;<br>import io.github.alexshamrai.grpc.AddEmployeeRequest;<br>import io.github.alexshamrai.grpc.AddEmployeeResponse;<br>import io.github.alexshamrai.grpc.GetEmployeeRequest;<br>import io.github.alexshamrai.grpc.GetEmployeeResponse;<br>import org.junit.jupiter.api.DisplayName;<br>import org.junit.jupiter.api.Test;<br><br>import static org.junit.jupiter.api.Assertions.assertEquals;<br><br>public class EmployeeTest extends BaseTest {<br><br>    @Test<br>    @DisplayName(&quot;Add new employee&quot;)<br>    public void addEmployeeTest() {<br>        Employee testEmployee = Employee.builder()<br>            .name(&quot;Aaron Lennon&quot;)<br>            .age(32)<br>            .department(&quot;IT&quot;)<br>            .position(&quot;Support&quot;)<br>            .hiringYear(2020)<br>            .salary(1500.0)<br>            .build();<br><br>        AddEmployeeRequest request = AddEmployeeRequest.newBuilder()<br>            .setName(testEmployee.getName())<br>            .setAge(testEmployee.getAge())<br>            .setDepartment(testEmployee.getDepartment())<br>            .setPosition(testEmployee.getPosition())<br>            .setHiringYear(testEmployee.getHiringYear())<br>            .setSalary(testEmployee.getSalary())<br>            .build();<br>        AddEmployeeResponse addEmployeeResponse = blockingStub.addEmployee(request);<br><br>        GetEmployeeRequest getRequest = GetEmployeeRequest.newBuilder()<br>            .setEmployeeId(addEmployeeResponse.getEmployeeId())<br>            .build();<br>        GetEmployeeResponse getResponse = blockingStub.getEmployee(getRequest);<br><br>        assertEquals(testEmployee.getName(), getResponse.getEmployee().getName());<br>        assertEquals(testEmployee.getAge(), getResponse.getEmployee().getAge());<br>        assertEquals(testEmployee.getDepartment(), getResponse.getEmployee().getDepartment());<br>        assertEquals(testEmployee.getPosition(), getResponse.getEmployee().getPosition());<br>        assertEquals(testEmployee.getHiringYear(), getResponse.getEmployee().getHiringYear());<br>        assertEquals(testEmployee.getSalary(), getResponse.getEmployee().getSalary());<br>    }<br>}</pre><h4>Negative test</h4><p>Let’s add a negative scenario: trying to add an employee with a negative salary. According to the implementation of EmployeeService, this action should not be allowed</p><pre>Employee testEmployee = Employee.builder()<br>    .name(&quot;Theo Black&quot;)<br>    .age(45)<br>    .department(&quot;Finance&quot;)<br>    .position(&quot;Accounting&quot;)<br>    .hiringYear(2022)<br>    .salary(-500.0)<br>    .build();<br><br>AddEmployeeRequest request = AddEmployeeRequest.newBuilder()<br>    .setName(testEmployee.getName())<br>    .setAge(testEmployee.getAge())<br>    .setDepartment(testEmployee.getDepartment())<br>    .setPosition(testEmployee.getPosition())<br>    .setHiringYear(testEmployee.getHiringYear())<br>    .setSalary(testEmployee.getSalary())<br>    .build();<br>AddEmployeeResponse addEmployeeResponse = blockingStub.addEmployee(request);</pre><p>After running this code in the test, we will get a StatusRuntimeException with an appropriate message:</p><pre>INVALID_ARGUMENT: Employee salary must be greater than 0<br>io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Employee salary must be greater than 0<br>    at io.grpc.stub.ClientCalls.toStatusRuntimeException(ClientCalls.java:268)<br>    at io.grpc.stub.ClientCalls.getUnchecked(ClientCalls.java:249)<br>    at io.grpc.stub.ClientCalls.blockingUnaryCall(ClientCalls.java:167)<br>    at io.github.alexshamrai.grpc.EmployeeServiceGrpc$EmployeeServiceBlockingStub.addEmployee(EmployeeServiceGrpc.java:351)<br>    at EmployeeTest.addEmployeeWithNegativeSalaryTest(EmployeeTest.java:68)</pre><p>So if we want to check it, we can use assertThrows in our test, to be sure that this case is handled by the server as expected. The resulting test will look like:</p><pre>@Test<br>@DisplayName(&quot;Add new employee with negative salary&quot;)<br>public void addEmployeeWithNegativeSalaryTest() {<br>    Employee testEmployee = Employee.builder()<br>        .name(&quot;Theo Black&quot;)<br>        .age(45)<br>        .department(&quot;Finance&quot;)<br>        .position(&quot;Accounting&quot;)<br>        .hiringYear(2022)<br>        .salary(-500.0)<br>        .build();<br><br>    AddEmployeeRequest request = AddEmployeeRequest.newBuilder()<br>        .setName(testEmployee.getName())<br>        .setAge(testEmployee.getAge())<br>        .setDepartment(testEmployee.getDepartment())<br>        .setPosition(testEmployee.getPosition())<br>        .setHiringYear(testEmployee.getHiringYear())<br>        .setSalary(testEmployee.getSalary())<br>        .build();<br>    StatusRuntimeException exception = assertThrows(StatusRuntimeException.class, ()-&gt; blockingStub.addEmployee(request));<br>    assertEquals(&quot;INVALID_ARGUMENT: Employee salary must be greater than 0&quot;, exception.getMessage());<br>}</pre><h3>Logging gRPC</h3><p>We currently have two small test scenarios for our service. Since they are simple and test only one service, their passing isn’t surprising. However, what about logging and investigation? Right now, there are no logs in the console, and no reporter is enabled. If something doesn’t work as expected, it would be difficult to pinpoint the exact issue or identify what might be missing.</p><h3>Console logs</h3><p>To be able to see logs, we need to add slf4j-api dependency</p><pre>testImplementation &#39;org.slf4j:slf4j-api:2.0.16&#39;</pre><p>Logback will be used as the default SLF4J implementation</p><p><strong>Note:</strong> In our case, Logback is a transitive dependency from employee-service module. If you are trying to do something similar but in a separate repository, you should add logging implementation explicitly, like:</p><pre>implementation &#39;ch.qos.logback:logback-classic:1.5.18&#39;</pre><p>After it, we need to write a simple interceptor class that should implement io.grpc.ClientInterceptor and add it to our blocking stub initialization. Here is a straightforward implementation of an Interceptor</p><pre>package io.github.alexshamrai.common;<br><br>import io.grpc.CallOptions;<br>import io.grpc.Channel;<br>import io.grpc.ClientCall;<br>import io.grpc.ClientInterceptor;<br>import io.grpc.ForwardingClientCall;<br>import io.grpc.ForwardingClientCallListener;<br>import io.grpc.Metadata;<br>import io.grpc.MethodDescriptor;<br>import io.grpc.Status;<br>import org.slf4j.Logger;<br>import org.slf4j.LoggerFactory;<br><br>public class GrpcLoggingInterceptor implements ClientInterceptor {<br><br>    private static final Logger logger = LoggerFactory.getLogger(GrpcLoggingInterceptor.class);<br><br>    @Override<br>    public &lt;ReqT, RespT&gt; ClientCall&lt;ReqT, RespT&gt; interceptCall(<br>        MethodDescriptor&lt;ReqT, RespT&gt; method,<br>        CallOptions callOptions,<br>        Channel next) {<br><br>        return new ForwardingClientCall.SimpleForwardingClientCall&lt;&gt;(next.newCall(method, callOptions)) {<br>            @Override<br>            public void start(Listener&lt;RespT&gt; responseListener, Metadata headers) {<br>                logger.info(&quot;Request: Method - {}, Headers - {}&quot;, method.getFullMethodName(), headers);<br>                super.start(new ForwardingClientCallListener.SimpleForwardingClientCallListener&lt;&gt;(responseListener) {<br>                    @Override<br>                    public void onMessage(RespT message) {<br>                        logger.info(&quot;Response: {}&quot;, message);<br>                        super.onMessage(message);<br>                    }<br><br>                    @Override<br>                    public void onClose(Status status, Metadata trailers) {<br>                        if (!status.isOk()) {<br>                            logger.error(&quot;Status - {}, Description - {}, Trailers - {}&quot;, status, status.getDescription(), trailers);<br>                        }<br>                        super.onClose(status, trailers);<br>                    }<br>                }, headers);<br>            }<br><br>            @Override<br>            public void sendMessage(ReqT message) {<br>                if (!message.toString().isEmpty()) {<br>                    logger.info(&quot;Request message: {}&quot;, message);<br>                }<br>                super.sendMessage(message);<br>            }<br>        };<br>    }<br>}</pre><p>The interceptor logs key information at each stage of a request-response cycle. It will provide visibility into the complete lifecycle of gRPC client calls by capturing and logging:</p><ol><li>Call initiation details (method and headers)</li><li>Outgoing request data</li><li>Incoming response data</li><li>Call completion status and errors</li></ol><ul><li>interceptCall Creates a wrapper around gRPC calls to inject logging functionality without changing the actual call behavior.</li><li>start Logs when a gRPC call begins, capturing the method name and headers. Also sets up listeners to monitor the responses.</li><li>sendMessage Logs the content of request messages being sent to the server, helping developers see exactly what data is being transmitted.</li><li>onMessage Logs response data coming back from the server, showing what information was received.</li><li>onClose Logs call completion details, with special attention to errors. For failed calls, it logs the status code, description, and trailer metadata.</li></ul><p>After interceptor implementation we only need to add it to channel builder when initializing our blockingStub via intercept(new GrpcLoggingInterceptor()) method:</p><pre>@BeforeAll<br>public static void init(){<br>    channel = ManagedChannelBuilder<br>        .forAddress(&quot;localhost&quot;, 6565)<br>        .intercept(new GrpcLoggingInterceptor())<br>        .usePlaintext()<br>        .build();<br><br>    blockingStub = EmployeeServiceGrpc.newBlockingStub(channel);<br>}</pre><p>After it, while running tests, you’ll see the following info in the console:</p><pre>12:24:29.193 [Test worker] INFO io.github.alexshamrai.common.GrpcLoggingInterceptor -- Request: Method - io.github.alexshamrai.grpc.EmployeeService/AddEmployee, Headers - Metadata()<br>12:24:29.250 [Test worker] INFO io.github.alexshamrai.common.GrpcLoggingInterceptor -- Request message: name: &quot;Theo Black&quot;<br>age: 45<br>department: &quot;Finance&quot;<br>position: &quot;Accounting&quot;<br>hiring_year: 2022<br>salary: -500.0<br><br>12:24:29.359 [Test worker] ERROR io.github.alexshamrai.common.GrpcLoggingInterceptor -- Status - Status{code=INVALID_ARGUMENT, description=Employee salary must be greater than 0, cause=null}, Description - Employee salary must be greater than 0, Trailers - Metadata(content-type=application/grpc)</pre><p>In some cases, console logging is enough. In our implementation, logs are available in the Gradle report HTML file. Since the scenario is short and straightforward, understanding the flow is easy. However, for more complex cases with sophisticated scenarios and multithreaded tests, using external tools to log gRPC calls becomes essential.</p><h3>Allure Report Logs</h3><p>If you want to use more robust logging, you can use <a href="https://github.com/allure-framework/allure-java?tab=readme-ov-file#grpc">allure-grpc</a> interceptor with Allure report</p><p>Add allure plugins in build.gradle for tests</p><pre>id &#39;io.qameta.allure&#39; version &#39;2.12.0&#39;<br>id &#39;io.qameta.allure-adapter&#39; version &#39;2.12.0&#39;</pre><p>add required dependencies:</p><pre>testImplementation &#39;io.qameta.allure:allure-junit5:2.29.1&#39;<br>testImplementation &#39;io.qameta.allure:allure-grpc:2.29.1&#39;</pre><p>Add AllureGrpc interceptor to the intercept method</p><pre>@BeforeAll<br>public static void init(){<br>    channel = ManagedChannelBuilder<br>        .forAddress(&quot;localhost&quot;, 6565)<br>        .intercept(List.of(new GrpcLoggingInterceptor(), new AllureGrpc()))<br>        .usePlaintext()<br>        .build();<br><br>    blockingStub = EmployeeServiceGrpc.newBlockingStub(channel);<br>}</pre><p>Now you can run tests, and after the run is finished, build the report</p><pre>./gradlew allureServe</pre><p>The basic report will look like the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/1*xT1iPOs8FoAEH3oRSROmWA.png" /></figure><p>Here we can see the request and response details attached to each call. Allure reporter allows adjusting the report in a more fancy way using @Steps annotation, but we will stop it as it is. It will be enough for current needs.</p><p>All other tests we will not discuss here in the article, but you can find <a href="https://github.com/alexshamrai/grpc-employee-service/blob/master/e2e-tests/src/test/java/io/github/alexshamrai/EmployeeTest.java">them</a> in the source code. There are examples with com.google.protobuf.Empty usage for sending an empty request body (according to employee.proto contract), also more examples of negative tests and boundary values checking. The goal was not to show the full coverage, but to show an example of how to test a gRPC service via Java code.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac816fbae19d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[gRPC Testing intro. Grpc basics.]]></title>
            <link>https://medium.com/@alexshamrai/grpc-testing-intro-grpc-basics-7e25c3a7987a?source=rss-b07565ff1bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/7e25c3a7987a</guid>
            <category><![CDATA[grpc-java]]></category>
            <category><![CDATA[grpc-testing]]></category>
            <category><![CDATA[protocol-buffers]]></category>
            <category><![CDATA[grpc]]></category>
            <category><![CDATA[api-testing]]></category>
            <dc:creator><![CDATA[Alex Shamrai]]></dc:creator>
            <pubDate>Sun, 16 Mar 2025 10:26:55 GMT</pubDate>
            <atom:updated>2025-04-02T08:05:42.238Z</atom:updated>
            <content:encoded><![CDATA[<p>As Test Engineers, we often work with REST services while handling general projects. However, I recently encountered the need to interact with a gRPC service. In this article, we’ll create a sample gRPC service using Java and explore it. In the following article, we will dive more into testing itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CwttuDA3sxL8ZnEG1ofaEg.jpeg" /></figure><h3>What is gRPC?</h3><p><a href="https://grpc.io/">gRPC</a> is a high-performance, open-source Remote Procedure Call (RPC) framework initially developed by Google. It is designed to streamline service-to-service communication, enabling seamless connectivity between polyglot services across distributed data centers, plus reducing boilerplate code.</p><p>Unlike traditional HTTP REST APIs, gRPC uses <a href="https://protobuf.dev/">Protocol Buffers</a> (Protobuf) as its interface definition language (IDL) for defining service contracts. This approach enables faster serialization and deserialization, making gRPC an efficient solution for modern, high-performance systems.</p><p>The core concept of gRPC is that you are actually calling a function implemented on a server.</p><h3>Why Testing gRPC is Different</h3><p>Unlike REST, where data is sent in human-readable JSON over HTTP, gRPC transmits data in a binary format using <strong>Protocol Buffers (</strong><a href="https://protobuf.dev/"><strong>Protobuf</strong></a><strong>)</strong>. This efficient serialization method poses obstacles for debugging and testing. For instance:</p><ul><li><strong>Binary Data Transmission</strong>: You can’t inspect requests and responses directly in a browser console, dedicated tools are needed.</li><li><strong>Communication Patterns</strong>: Beyond unary calls (one request, one response), gRPC supports several complex interaction models:</li></ul><h4>Communication Patterns in gRPC</h4><ol><li><strong>Unary RPC</strong>: Unary RPC is the simplest gRPC communication model, where the client sends a single request and receives a single response. The interaction process includes the following steps: invocation, metadata exchange, processing and response, completion</li><li><strong>Server Streaming RPC</strong>: The client sends a single request and receives a stream of responses. Clients can decide to process all responses or stop at a particular condition, such as a timeout or a specific response field.</li><li><strong>Client Streaming RPC</strong>: The client sends a stream of requests to the server, which processes them and sends back a single response.</li><li><strong>Bidirectional Streaming RPC</strong>: Both client and server exchange independent streams of messages concurrently, allowing real-time parallel processing.</li></ol><h3>Creating a sample Hello World service</h3><p>Let’s build a simple “Hello World” service to understand gRPC with a practical yet straightforward example. We’ll use Java with Gradle as our build tool to create this sample application. So create a new Gradle project and follow the steps below.</p><h4>1. Add required dependencies</h4><p>Now update the build.gradle file and add gRPC-related dependencies we’ll need for our project to work on.</p><pre>runtimeOnly &#39;io.grpc:grpc-netty:1.69.0&#39;  <br>implementation &#39;io.grpc:grpc-protobuf:1.69.0&#39;  <br>implementation &#39;io.grpc:grpc-stub:1.69.0&#39;</pre><ul><li><strong>grpc-netty</strong>: Enables gRPC to use Netty as its HTTP/2 transport layer, which is essential for the service runtime.</li><li><strong>grpc-protobuf</strong>: Adds support for Protocol Buffers, the serialization mechanism gRPC uses to define and exchange structured data.</li><li><strong>grpc-stub</strong>: Provides client and server stubs, generated from .proto files, to simplify the implementation of gRPC calls.</li><li><strong>protobuf-java-util</strong>: Offers utilities for working with Protocol Buffers, such as converting between Protobuf objects and JSON.</li><li><strong>javax.annotation-api</strong>: Supplies standard annotations (e.g., @Nullable, @Generated) commonly used during code generation and validation at compile time.</li></ul><p>Also, <a href="https://plugins.gradle.org/plugin/com.google.protobuf">protobuf</a> plugin is needed for integration with protocol buffers</p><pre>id &#39;com.google.protobuf&#39; version &#39;0.9.4&#39;</pre><p>Customize sources directories:</p><pre>sourceSets {  <br>    src {  <br>        main {  <br>            java {  <br>                srcDirs &#39;build/generated/source/proto/main/grpc&#39;  <br>                srcDirs &#39;build/generated/source/proto/main/java&#39;  <br>            }  <br>        }    <br>    }<br>}</pre><p>Customize protobuf compilations:</p><pre>protobuf {  <br>    protoc {  <br>        artifact = &#39;com.google.protobuf:protoc:4.29.1&#39;  <br>    }  <br>  <br>    plugins {  <br>        grpc {  <br>            artifact = &quot;io.grpc:protoc-gen-grpc-java:1.69.0&quot;  <br>        }  <br>    }    <br>    generateProtoTasks {  <br>        all()*.plugins {  <br>            grpc {}  <br>        }    <br>    }<br>}</pre><p>The resulting build.gradle file will look like:</p><pre>plugins {  <br>    id &#39;java&#39;  <br>    id &#39;com.google.protobuf&#39; version &#39;0.9.4&#39;  <br>}  <br>  <br>group = &#39;io.github.alexshamrai&#39;  <br>version = &#39;1.0-SNAPSHOT&#39;  <br>  <br>repositories {  <br>    mavenCentral()  <br>}  <br>  <br>sourceSets {  <br>    src {  <br>        main {  <br>            java {  <br>                srcDirs &#39;build/generated/source/proto/main/grpc&#39;  <br>                srcDirs &#39;build/generated/source/proto/main/java&#39;  <br>            }  <br>        }    <br>    }<br>}  <br>  <br>  <br>dependencies {  <br>    runtimeOnly &#39;io.grpc:grpc-netty:1.69.0&#39;  <br>    implementation &#39;io.grpc:grpc-protobuf:1.69.0&#39;  <br>    implementation &#39;io.grpc:grpc-stub:1.69.0&#39;  <br>    implementation &#39;com.google.protobuf:protobuf-java-util:4.29.1&#39;  <br>    compileOnly &#39;javax.annotation:javax.annotation-api:1.3.2&#39;  <br>  <br>    testImplementation platform(&#39;org.junit:junit-bom:5.10.0&#39;)  <br>    testImplementation &#39;org.junit.jupiter:junit-jupiter&#39;  <br>}  <br>  <br>protobuf {  <br>    protoc {  <br>        artifact = &#39;com.google.protobuf:protoc:4.29.1&#39;  <br>    }  <br>  <br>    plugins {  <br>        grpc {  <br>            artifact = &quot;io.grpc:protoc-gen-grpc-java:1.69.0&quot;  <br>        }  <br>    }    <br>    generateProtoTasks {  <br>        all()*.plugins {  <br>            grpc {}  <br>        }    <br>    }<br>}  <br>  <br>test {  <br>    useJUnitPlatform()  <br>}</pre><p>Now, we are ready to start implementing our service</p><h4>2. Define a service in a .proto file</h4><p>Create HelloService.proto file in src/main/proto</p><pre>syntax = &quot;proto3&quot;;  <br>option java_multiple_files = true;  <br>package io.github.alexshamrai.grpc;  <br>  <br>message HelloRequest {  <br>  string firstName = 1;  <br>  string lastName = 2;  <br>}  <br>  <br>message HelloResponse {  <br>  string greeting = 1;  <br>}  <br>  <br>service HelloService {  <br>  rpc hello(HelloRequest) returns (HelloResponse);  <br>}</pre><ul><li>The first line tells the version of the syntax this file uses.</li><li>The second line forces the code to be generated in individual files. By default, the compiler generates all the Java code in a single Java file.</li><li>The third line specifies the package we want to use for our generated Java classes.</li></ul><p>Request payload is defined in HelloRequest. Each attribute that goes into the message is defined, along with its type. A unique number needs to be assigned to each attribute, called the tag. <strong>The protocol buffer uses this tag to represent the attribute, instead of using the attribute name.</strong></p><p>So unlike JSON, where we’d pass the attribute name <em>firstName</em> every single time, the protocol buffer will use the number 1 to represent <em>firstName</em>. The response payload definition is similar to the request.</p><p>Service contract for our HelloService, will be defined in <em>hello()</em> operation:</p><pre>service HelloService {<br>    rpc hello(HelloRequest) returns (HelloResponse);<br>}</pre><p>Thehello()operation accepts a unary request and returns a unary response.</p><h4>3. Generate server and client code</h4><p>Now it is possible to run generateProto task to create java code. But since we are using plugin, code generation is already implemented in our build cycle, so we just run the following command to build the project:</p><pre>$ ./gradlew build</pre><p>Then, you will see the auto generated code under <strong>build/generated/source/proto</strong> directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*766rI-UMSk7pO49YKjf28Q.png" /></figure><p>The following key files will be generated:</p><ul><li><em>HelloRequest.java</em></li><li><em>HelloResponse.java</em></li><li><em>HelloServiceGrpc.java</em></li></ul><h4>4. Create the server application, implementing the generated service interfaces</h4><p>The <strong>default implementation of the abstract class <em>HelloServiceImplBase</em> is to throw the runtime exception</strong> <em>io.grpc.StatusRuntimeException</em>, which says that the method is unimplemented.</p><p>Let’s fix it by extending this class, and override the hello() method mentioned in our service definition:</p><pre>public class HelloServiceImpl extends HelloServiceGrpc.HelloServiceImplBase {  <br>  <br>    @Override  <br>    public void hello(  <br>        HelloRequest request, StreamObserver&lt;HelloResponse&gt; responseObserver) {  <br>  <br>        String greeting = &quot;Hello, &quot;  <br>                          + request.getFirstName()  <br>                          + &quot; &quot;  <br>                          + request.getLastName();  <br>  <br>        HelloResponse response = HelloResponse.newBuilder()  <br>            .setGreeting(greeting)  <br>            .build();  <br>  <br>        responseObserver.onNext(response);  <br>        responseObserver.onCompleted();  <br>    }  <br>} </pre><p>gRPC’s hello() method, defined in the .proto file, doesn&#39;t directly <em>return</em> a HelloResponse. Instead, it uses a StreamObserver&lt;HelloResponse&gt; as a second argument. This StreamObserver acts as a callback mechanism for the server to send responses back to the client. This way, <strong>the client gets the option to make a blocking call or a non-blocking call</strong>.</p><p>This StreamObserver approach provides flexibility for how the client handles responses:</p><ul><li><strong>Blocking (Synchronous):</strong> The client waits for all responses to arrive before proceeding.</li><li><strong>Non-Blocking (Asynchronous):</strong> The client continues its work and is notified as each response arrives.</li></ul><p>To create a HelloResponse, gRPC uses a builder pattern: HelloResponse.newBuilder(). You set the desired fields (like the greeting text) and then call .build() to create the final object. This object is then sent to the client via the StreamObserver&#39;s onNext() method.</p><p>Finally, the server must call onCompleted() on the StreamObserver after sending all responses. This signals the end of the communication; otherwise, the client would wait for more data.</p><p>Next, we’ll need to run the gRPC server and listen for incoming requests. Create a gRPC server on port 8080, and add the <em>HelloServiceImpl</em> service that we defined. <em>start()</em> will start the server. In our example, we’ll call <em>awaitTermination()</em> to keep the server running in the foreground, blocking the prompt.</p><pre>public class HelloServer {<br><br>    public static void main(String[] args) throws IOException, InterruptedException {<br>        Server server = ServerBuilder<br>            .forPort(6565)<br>            .addService(new HelloServiceImpl()).build();<br><br>        server.start();<br>        server.awaitTermination();<br>    }<br>}</pre><h3>How to check the server manually</h3><p>In order to be able to check our service manually we need to use <a href="https://grpc.io/docs/guides/reflection/">Reflection</a>. Reflection in gRPC lets clients discover a service’s structure at runtime without needing the .proto file. This is useful for:</p><ul><li><strong>Dynamic clients:</strong> Building generic clients that can work with any service supporting reflection.</li><li><strong>Dev/test tools:</strong> Easily creating tools to test and debug gRPC services (e.g., displaying available methods and parameters).</li><li><strong>Service discovery:</strong> Automatically finding available services and their interfaces in dynamic environments.</li></ul><p>A gRPC server with reflection exposes a ServerReflection service. Clients query this service to get information about available services, methods, and message types. This information is returned as a service descriptor, similar to a .proto file. In short, reflection simplifies working with gRPC, especially in dynamic setups, by allowing clients to understand server interfaces without prior knowledge.</p><p>To enable gRPC Reflection support add the following dependency to the build.gradle</p><pre>implementation &#39;io.grpc:grpc-services:1.69.0&#39;</pre><p>And add ProtoReflectionService to the HelloServer</p><pre>public class HelloServer {  <br>  <br>    public static void main(String[] args) throws IOException, InterruptedException {  <br>        Server server = ServerBuilder  <br>            .forPort(6565)  <br>            .addService(new HelloServiceImpl())  <br>            .addService(ProtoReflectionServiceV1.newInstance())  <br>            .build();  <br>  <br>        server.start();  <br>        server.awaitTermination();  <br>    }  <br>}</pre><p>Now we can use gRPCurl, Postman, grpcUI or any other testing tool for checking</p><h3>gRPCurl</h3><p>The easiest way to check the server from command line will be <a href="https://github.com/fullstorydev/grpcurl">gRPCurl</a> grpcurlis a command-line tool that lets you interact with gRPC servers. It&#39;s basicallycurlfor gRPC servers. Before interacting with HelloServer, do not forget to run main method, to run the server on localhost. To see all services exposed by a server, use the list command:</p><pre>grpcurl -plaintext localhost:6565 list</pre><p>And you should see the following response</p><pre>grpc.reflection.v1.ServerReflection<br>io.github.alexshamrai.grpc.HelloService</pre><p>In our case, for testing hello method we need to run</p><pre>grpcurl -plaintext -d &#39;{&quot;firstName&quot;: &quot;Alex&quot;, &quot;lastName&quot;: &quot;Shamrai&quot;}&#39; localhost:6565 io.github.alexshamrai.grpc.HelloService/hello</pre><p>And should see a response:</p><pre>{<br>  &quot;greeting&quot;: &quot;Hello, Alex Shamrai&quot;<br>}</pre><h3>gRPC UI</h3><p>Another option is <a href="https://github.com/fullstorydev/grpcui">gRPC UI</a>- an extension for gRPCurl. grpcuiprovides a web/browser-based GUI. This lets you interactively construct requests to send to a gRPC server.</p><p>To access to your server from browser, run the following command:</p><pre>grpcui -plaintext localhost:6565</pre><p>If everything is configured correctly, you’ll see the following response:</p><pre>gRPC Web UI available at http://127.0.0.1:53162/</pre><p>And browser will open the UI</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n_Jd-dlURGkfBoZOakpnKg.png" /></figure><p>Fill firstName and secondName with appropriate data and click &quot;Invoke&quot; button Appropriate response will be shown in &quot;Response&quot; tab</p><pre>{<br>  &quot;greeting&quot;: &quot;Hello, Alex Shamrai&quot;<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s6keDrdeXbQFe7JX-ZUwhg.png" /></figure><h3>Creating Hello World client</h3><p>Now we are sure that our server is working as expected, and can create a client in our code <strong>gRPC provides a channel construct that abstracts out the underlying details,</strong>like connection, connection pooling, load balancing, etc. We’ll create a channel using <em>ManagedChannelBuilder</em>. Here we’ll specify the server address and port.</p><p>We’ll use plain text without any encryption:</p><pre>public class HelloClient {  <br>  <br>    public static void main(String[] args) {  <br>        ManagedChannel channel = ManagedChannelBuilder.forAddress(&quot;localhost&quot;, 6565)  <br>            .usePlaintext()  <br>            .build();  <br>  <br>        HelloServiceGrpc.HelloServiceBlockingStub stub  <br>            = HelloServiceGrpc.newBlockingStub(channel);  <br>  <br>        HelloResponse helloResponse = stub.hello(HelloRequest.newBuilder()  <br>            .setFirstName(&quot;Alex&quot;)  <br>            .setLastName(&quot;Shamrai&quot;)  <br>            .build());  <br>  <br>        System.out.println(helloResponse.getGreeting());  <br>  <br>        channel.shutdown();  <br>    }  <br>}</pre><p>Then we’ll need to create a stub, which we’ll use to make the actual remote call to <em>hello()</em>. <strong>The stub is the primary way for clients to interact with the server.</strong> When using auto-generated stubs, the stub class will have constructors for wrapping the channel.</p><p>Here we’re using a blocking/synchronous stub so that the RPC call waits for the server to respond, and will either return a response or raise an exception. There are two other types of stubs provided by gRPC that facilitate non-blocking/asynchronous calls.</p><p>Now it’s time to make the <em>hello()</em> RPC call. We’ll pass the <em>HelloRequest</em>. We can use the auto-generated setters to set the <em>firstName</em> and <em>lastName</em> attributes of the <em>HelloRequest</em> object.</p><p>Finally, the server returns the_HelloResponse_object.</p><p>Now we can run main method in HelloServer, and running main method in HelloClient afterward will show us the following message in console.</p><pre>Hello, Alex Shamrai</pre><h3>Summary</h3><p>Implementing elementary service will help you to get some practical skills in order to understand how gRPC works and how can you test it as an engineer.</p><p>You can find all the code snippets in my sample project on <a href="https://github.com/alexshamrai/grpc-intro">GitHub</a>.</p><p>In this article, we explored the fundamentals of gRPC and created a simple “Hello World” service. Ready to dive deeper into practical gRPC testing?</p><p>👉 Check out the next article in the series: <a href="https://medium.com/@alexshamrai/grpc-testing-intro-writing-the-first-test-ac816fbae19d">gRPC Testing: Writing Your First Test</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7e25c3a7987a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GitHub Actions: exact time workaround]]></title>
            <link>https://medium.com/@alexshamrai/github-actions-exact-time-workaround-1b5c99a1baed?source=rss-b07565ff1bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b5c99a1baed</guid>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[github-actions]]></category>
            <dc:creator><![CDATA[Alex Shamrai]]></dc:creator>
            <pubDate>Wed, 29 Jan 2025 15:35:25 GMT</pubDate>
            <atom:updated>2025-01-29T16:43:32.908Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zUWjhmo2jn2TuwM9" /><figcaption>Photo by <a href="https://unsplash.com/@tristangassert?utm_source=medium&amp;utm_medium=referral">Tristan Gassert</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>A common issue with GitHub Actions as a CI tool is that the UI only shows a relative timestamp for test runs, not the exact start time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/1*l1C02zzW3JiMFkK-n0g1Ow.png" /></figure><p>There is even a <a href="https://github.com/orgs/community/discussions/58663">community discussion</a> related to the issue: <br>The GitHub dev team commented that they have no immediate plans to fix this:</p><blockquote>“Thanks for bringing this to our attention, and apologies for the silence. This is a totally understandable request, right now the date/time display is standardized across GitHub and is standard in PRs, Issues, Discussions, Projects. We do not have the power to change it just for our product at this time.”</blockquote><p>Luckily, there is a simple workaround: a <a href="https://github.com/BitSteve/github-full-datetime">Chrome extension</a> that displays the full date/time of a workflow run.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*RP46RlmVmzipMJgucX7bUA.png" /></figure><h3>Installation Instructions</h3><ol><li>Download this repository locally.</li><li>Open chrome://extensions/ in your browser.</li><li>Toggle <strong>Developer mode</strong> on (top right).</li><li>Click <strong>Load unpacked</strong> and select the downloaded folder.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b5c99a1baed" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basic Git commands for QA engineers]]></title>
            <link>https://levelup.gitconnected.com/basic-git-commands-for-qa-engineers-9ecaab92aebb?source=rss-b07565ff1bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/9ecaab92aebb</guid>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[quality-assurance]]></category>
            <dc:creator><![CDATA[Alex Shamrai]]></dc:creator>
            <pubDate>Mon, 17 Oct 2022 00:39:12 GMT</pubDate>
            <atom:updated>2022-10-17T00:39:12.209Z</atom:updated>
            <content:encoded><![CDATA[<p>In the very beginning, every person faced with git has to use only a limited amount of commands. In fact, you don’t need to spend hours reading git documentation or learning some other materials. Let’s consider the most basic flow for a test engineer: <em>Create a branch -&gt; Make and push your changes to the remote repository -&gt; Make Pull Request -&gt; Fix comments received during code review -&gt; Apply changes after code review and update Pull Request</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*poVqhn3nbvTSeNlajRO8yw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@synkevych?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Roman Synkevych 🇺🇦</a> on <a href="https://unsplash.com/s/photos/git?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h4>Basic flow commands</h4><ol><li>Go to develop(or any other main) branch and get the latest changes from a remote repository :</li></ol><pre>git pull origin develop</pre><p>2. Create your branch from the current develop :</p><pre> git checkout -b feature/new-feature-branch</pre><p>3. After making your changes to the code you can check and verify the state of the working directory:</p><pre>git status</pre><p>4. Add all changed files to your commit :</p><pre>git add .</pre><p>5. Create a commit :</p><pre>git commit -m &quot;My informative commit message&quot;</pre><p>6. Check that there are no breaking changes in develop branch</p><pre>git checkout develop<br>git pull origin develop</pre><p>If changes happened — apply them to your branch</p><pre>git checkout feature/new-feature-branch<br>git rebase develop</pre><p>7. Resolve conflicts if rebase process failed (I always resolve conflicts using UI tools in my IDE) and go on rebasing:</p><pre>git rebase --continue</pre><p>8. Push changes to your remote branch :</p><pre>git push origin feature/new-feature-branch</pre><p>9. Create a Pull Request to develop. I prefer to use the web interface for PR creating Pull Requests(keep in mind it requires different steps based on the solution you use: Github, Bitbucket, etc.)</p><p>10. After your PR was reviewed you have to fix some comments. And prepare a fix commit (see items #4 and #5)</p><p>11. Squash your commits into one</p><pre>git rebase -i HEAD~2</pre><p>After it, you have to choose which commit to pick and which commit to squash. By default, it will be <em>vim</em> text editor(be aware, you can configure any editor you need). And you will have a possibility to change commit message after squashing</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/826/1*4CBLXnlkK_mUkxxCjlQIIg.png" /><figcaption>Squash commits example</figcaption></figure><p>12. Push changes to your remote branch :</p><pre>git push -f origin feature/new-feature-branch</pre><p>13. After PR is approved, feel free to merge it</p><h4>Git alias using</h4><p>If you like using command line interface for git operations I highly recommend you start using aliases. Currently, I’m using <a href="https://ohmyz.sh/">oh-my-zsh</a> framework which provides built-in git alias configuration. Here are some alias examples for the git flow above.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/815dfcf85ec456ae19e5ecf1b0fed1cc/href">https://medium.com/media/815dfcf85ec456ae19e5ecf1b0fed1cc/href</a></iframe><p>This article might be useful for anyone just starting his git journey</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9ecaab92aebb" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/basic-git-commands-for-qa-engineers-9ecaab92aebb">Basic Git commands for QA engineers</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linux commands for everyday]]></title>
            <link>https://levelup.gitconnected.com/linux-commands-for-everyday-43581d6e3a03?source=rss-b07565ff1bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/43581d6e3a03</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[terminal]]></category>
            <category><![CDATA[software-testing]]></category>
            <dc:creator><![CDATA[Alex Shamrai]]></dc:creator>
            <pubDate>Wed, 29 Jun 2022 13:06:53 GMT</pubDate>
            <atom:updated>2022-06-29T15:25:37.493Z</atom:updated>
            <content:encoded><![CDATA[<p>Many of us sooner or later face the necessity of using Linux/Unix command line for different needs. It could be just a simple using terminal for configuring a local machine or working with a remote server. Here is a shortlist of commands which will be helpful for complete beginners, frankly saying, this is the list of commands I use on an everyday basis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*euSMvlWzW3aKGIC9d1YMYA.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@markusspiske?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Markus Spiske</a> on <a href="https://unsplash.com/s/photos/matrix?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>Manual</h3><p>The first and the most useful command is man. Every time you need to know how to use any command just type in your command line</p><pre>man &lt;command&gt;</pre><p>This is a manual for grep command (to quit the manual page just type <em>“q”</em>). Usually manual contains all comprehensive information about the command and it is not always handy to read all the pages if you need a quick overview of how to use a command with an appropriate option.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*68IcCsObL-ZCRHjiwMANLg.png" /></figure><p>I often use a <a href="https://tldr.sh/"><strong>tldr pages</strong></a> to learn a new command or refresh my knowledge of usage examples. This is a simplified, community-driven version of manual pages.</p><h3>Basic commands</h3><p>pwd — print the current directory path<br>cd — change the current working directory<br>mkdir &lt;directoryname&gt; — create a new directory in the present working directory or at the specified path<br>rmdir &lt;directoryname&gt; — delete a directory<br>rm &lt;filename&gt; — delete a file<br>mv &lt;file&gt; &lt;new_file_path&gt; — move file to a new location<br>cat &lt;filename&gt;-print file</p><p>ls — display the contents of a directory<br>One of the most popular examples of using ls command is in combination with -al. It shows all files and directories (including hidden ones) in a table format (permissions, ownership, size, and modification date).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xc5ntVvPRl0lxJPx0CILHg.png" /></figure><p>clear — clear the screen of the terminal<br>touch &lt;filename&gt; — create an empty file(if the file already exists, it opens the file in write mode and updates its timestamp)<br>echo — print arguments to the terminal (or to the given file)<br>diff &lt;firstfile&gt; &lt;secondfile&gt;— compare files<br>history — show command line history</p><p>grep — a powerful tool, which can be used for searching in files for an exact string or a regular expression. It also can be combined with pipes to filter the output of another command.<br>grep &lt;exact string&gt; &lt;filename&gt; — search for an exact string in the file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/888/1*wNv2E1-3B7i2TBdszeiNRw.png" /></figure><p>ls -lR | grep \.java$ — show all java files</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nBbBAivwbzEKSHAwTN9AoA.png" /></figure><p>ls -lR | grep --count \.java$ — count java files</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*fydP7pijuuezlSe0Hp68lA.png" /></figure><h3>Network and Process management</h3><p>ps — show the list of processes<br>sudo — run a command as root <br>kill &lt;PID&gt; — terminate the process by PID<br>killal &lt;name_of_program&gt; — terminate a program or process by name<br>ping &lt;host&gt;— sends packets to a network host<br>ssh -i &lt;paht_to_key_file.pem&gt; &lt;user&gt;@&lt;host&gt;— connect to remote server using ssh protocol</p><p>Note: the list was formed based on my personal experience, if you think something important is missed, don’t hesitate to drop a comment here, or just contact me on any social media.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43581d6e3a03" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/linux-commands-for-everyday-43581d6e3a03">Linux commands for everyday</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Builder explained. Design patterns in Java]]></title>
            <link>https://levelup.gitconnected.com/builder-explained-design-patterns-in-java-beadf8b32a51?source=rss-b07565ff1bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/beadf8b32a51</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Alex Shamrai]]></dc:creator>
            <pubDate>Tue, 03 May 2022 11:40:13 GMT</pubDate>
            <atom:updated>2022-05-03T11:40:13.703Z</atom:updated>
            <content:encoded><![CDATA[<h3>Builder explained — Design patterns in Java</h3><p>I’m going to start a series of articles explaining <a href="https://en.wikipedia.org/wiki/Design_Patterns">design patterns</a> on Java code examples. It might be useful for anyone who wants to dive into those common OOP design techniques. The best way to master anything is through <strong>practice</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3eYqoS0LF8QCYEpMMBt38w.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@benjopen?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Benjamin Jopen</a> on <a href="https://unsplash.com/s/photos/bricks?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>Builder</h3><p>Builder is a <a href="https://refactoring.guru/design-patterns/creational-patterns">creational design pattern</a>, which provides an alternative way to construct complex objects. This pattern should be used when we want to build different <a href="https://howtodoinjava.com/java/basics/how-to-make-a-java-class-immutable/">immutable</a> objects using the same object building process.</p><blockquote><em>Builder pattern aims to “Separate the construction of a complex object from its representation so that the same construction process can create multiple different representations.”</em></blockquote><p>Now, let’s assume, we need to create Employee object, which has the following 5 attributes i.e. firstName, secondName, yearOfBirth, employeeId, registrationAddress.</p><p>Now what if only firstName ,secondName, employeeId are mandatory and the rest of the fields are optional? We need more constructors:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/82841c3dcc3b93ef581eba650e3996f9/href">https://medium.com/media/82841c3dcc3b93ef581eba650e3996f9/href</a></iframe><p>This problem is called the <strong>telescoping constructors problem</strong>. Just imagine how many constructors will be required for more attributes.</p><p>The Builder pattern can be described in a class, which has a single creation method and several methods to configure the resulting object. Builder methods often support chaining for example, ObjectBuilder()-&gt;attrubute1(1)-&gt;attribute2(2)-&gt;build()).</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/995abdb6733ca96a9f6501e604a3ea2f/href">https://medium.com/media/995abdb6733ca96a9f6501e604a3ea2f/href</a></iframe><p>Fields validations are omitted for short (if the field value is invalid IllegalArgumentException should be thrown). Keep in mind, that the above created object <strong>does not have any setter method</strong>, so its state can not be changed once it has been built. This provides the desired immutability.</p><p>The usage of the pattern:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c890a840add39d959083f7158423caae/href">https://medium.com/media/c890a840add39d959083f7158423caae/href</a></iframe><h3>Lombok @Builder annotation</h3><p>Project Lombok’s <a href="https://projectlombok.org/features/Builder"><em>@Builder</em></a> is an easy way for using the pattern without writing boilerplate code. Here is an example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ab6ea2bba05e3f83632d8b056d72d744/href">https://medium.com/media/ab6ea2bba05e3f83632d8b056d72d744/href</a></iframe><p>And a usage example in the code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/86e1f4d4e857046846a9e83ae7fe77d9/href">https://medium.com/media/86e1f4d4e857046846a9e83ae7fe77d9/href</a></iframe><h3>Conclusion</h3><h4>Builder pattern pros</h4><ul><li>Design flexibility and much more readable code.</li><li>Parameters to the constructor are reduced and are provided in highly readable chained method calls. This way there is no need to pass in null for optional parameters to the constructor while creating the instance of a class.</li><li>The instance is always instantiated in a complete state.</li><li>We can build immutable objects without much complex logic in the object-building process.</li></ul><h4>Builder pattern cons</h4><ul><li>The pattern requires a lot of code</li></ul><h4>Use the Builder pattern when</h4><ul><li>The algorithm for creating a complex object should be independent of the parts that make up the object and how they’re assembled</li><li>The construction process must allow different representations for the object that’s constructed</li></ul><h4>Builder usage in Java core libraries:</h4><ul><li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/StringBuilder.html">StringBuilder</a></li><li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/StringBuffer.html#append-boolean-">StringBuffer</a></li></ul><p>To see more details about given code examples, please visit my <a href="https://github.com/alexshamrai/design-patterns">design-patterns GitHub repo</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=beadf8b32a51" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/builder-explained-design-patterns-in-java-beadf8b32a51">Builder explained. Design patterns in Java</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Resources to get Software Testing & QA news]]></title>
            <link>https://levelup.gitconnected.com/resources-to-get-software-testing-qa-news-c5d4ece14814?source=rss-b07565ff1bd3------2</link>
            <guid isPermaLink="false">https://medium.com/p/c5d4ece14814</guid>
            <category><![CDATA[quality-assurance]]></category>
            <category><![CDATA[news]]></category>
            <category><![CDATA[software-testing]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[test-automation]]></category>
            <dc:creator><![CDATA[Alex Shamrai]]></dc:creator>
            <pubDate>Fri, 29 Apr 2022 00:38:44 GMT</pubDate>
            <atom:updated>2022-04-29T00:38:44.069Z</atom:updated>
            <content:encoded><![CDATA[<p>Owing to the lack of time we always trying to find appropriate sources to get information. I’ll share the list of influencers, blogs, Twitter accounts, communities, and podcasts to follow to keep yourself on track with software testing news, trends, ideas, and opinions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*biLZNrIF11PISeDdR1bHog.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@xps?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">XPS</a> on <a href="https://unsplash.com/s/photos/pc-reading?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><h3>Testing Blogs</h3><p>Here is a list of some blogs I follow. The reasons are clear, authors have various experiences, ideas to share, and topics to discuss. The content is well written, it’s always a lot of things to think about.</p><ul><li>James Bach <a href="https://www.satisfice.com/blog">Satisfice blog</a></li><li>Michael Bolton<a href="https://www.developsense.com/blog"> DevelopSense blog</a></li><li>Joe Colantonio <a href="https://testguild.com/blog/">TestGuid blog</a></li><li><a href="https://lisacrispin.com/">Lisa Crispin blog</a></li><li><a href="http://janetgregory.ca/">Janet Gregory blog</a></li><li>Bas Dijkstra <a href="https://www.ontestautomation.com/">OnTestAutomation</a></li><li>Paul Grizzaffi <a href="https://responsibleautomation.wordpress.com/">Responsible Automation</a></li><li>Alan Richardson <a href="https://www.eviltester.com/blog/">Evil Tester</a></li></ul><h3>Newsletters</h3><p>A newsletter is the best way to track different blogs from different sources. The variety of authors and topics is fascinating. If you don’t have enough time - following a newsletter is the best option.</p><ul><li><a href="https://softwaretestingweekly.com/">Software Testing Weekly</a></li><li><a href="https://www.ministryoftesting.com/feeds/blogs">Ministry of Testing Blog Feed</a></li><li><a href="https://trendingintesting.com/category/weekly-newsletter/">Trending in Testing</a></li><li><a href="https://softwaretestingnotes.substack.com/">Software Testing Notes</a></li><li><a href="https://angryweasel.com/blog/">Five for Friday</a></li></ul><p>You’ll find the same articles in different news aggregators from time to time, let’s be honest, it’s almost impossible to read all the blogs mentioned. But anyway it’s a good idea to look through the titles and pick several articles to read.</p><h3>Twitter accounts</h3><p>Why do I consider Twitter a useful source? Because it’s not only about articles and stories. There is a lot of info related to different testing events, news, and tools. Short messages do not take too much time to overview.</p><p>Of course, I’m following all the authors from the <strong>Testing Blogs</strong> section, so there is no point to duplicate their names here. But here is a list of some other valuable accounts:</p><ul><li><a href="https://twitter.com/techgirl1908">Angie Jones</a></li><li><a href="https://twitter.com/ilarihenrik">Ilari Henrik Aegerter</a></li><li><a href="https://twitter.com/sof_minsk">Andrey Ladutko</a></li><li><a href="https://twitter.com/testingref">Testing References</a></li><li><a href="https://twitter.com/blakenorrish">Blake Norrish</a></li><li><a href="https://twitter.com/NicolaLindgren">Nicola Lindgren</a></li><li><a href="https://twitter.com/maaretp">Maaret Pyhäjärvi</a></li></ul><h3>Software Testing Communities</h3><p>The community is not only about reading, it’s more about participating, and sharing ideas and impressions.</p><ul><li><a href="https://www.stickyminds.com/">StickMinds </a>is probably the oldest community I know. It has a lot of articles covering different areas, and an awesome Q&amp;A section</li><li><a href="https://www.ministryoftesting.com/">Ministry of Testing</a> is a friendly testing community that has a lot of valuable content and offers even more with member subscription</li></ul><h3>Podcasts</h3><p>The podcast trend continues to grow each year. They are easy to access, multitask-friendly, and provide a lot of information covering different topics. Here is my top podcasts list:</p><ul><li><a href="https://testguild.com/podcast/">TestGuild</a></li><li><a href="https://www.eviltester.com/show/">The Evil Tester Show</a></li><li><a href="https://testingpeers.com/">TestingPeers</a></li><li><a href="https://soundcloud.com/ministryoftesting">Ministry Of Testing</a></li><li><a href="https://theguiltytester.libsyn.com/">The Guilty Tester</a></li><li><a href="https://qualitestgroup.com/insights/podcasts/">Qualitest: The testing show</a></li><li><a href="https://anchor.fm/abtesting">AB Testing</a></li></ul><h3>Corporate Blogs</h3><p>Technology leader companies have corporate blogs where a lot of useful information for Test Engineers could be found. I do not read those blogs all the time, but following them helps to understand Test industry trends. The list of companies who has tech blog could be much longer, but I’ve decided to focus on the top 5 from my point of view</p><ul><li><a href="https://testing.googleblog.com/">Google’s Testing Blog</a></li><li><a href="https://techcommunity.microsoft.com/t5/testingspot-blog/bg-p/TestingSpotBlog">Microsoft’s Testing Blog</a></li><li><a href="https://engineering.linkedin.com/blog/topic/testing">LinkedIn Testing</a></li><li><a href="https://applitools.com/blog/">Applitools</a></li><li><a href="https://www.browserstack.com/blog/">BrowserStack Blog</a></li></ul><h3>Additional</h3><p>Of course, my list of information sources does not cover all possible choices. For example, the are plenty of influencers on <strong>Linkedin</strong>, I just don’t use it often and decided not to put it on my recommendation list. There are plenty of awesome authors on <strong>Medium</strong>: <a href="https://medium.com/u/9694cc5a4fb3">Michael Bright</a>, <a href="https://medium.com/u/372363c767a9">Omar Elgabry</a>, <a href="https://medium.com/u/7a01e12c0530">Blake Norrish</a>, <a href="https://medium.com/u/1884120cfdf5">Alan Richardson — EvilTester.com</a>, <a href="https://medium.com/u/894c09acf299">The Test Lead</a>, <a href="https://medium.com/u/54ea764ff544">Luís Soares</a>, and many others.</p><p>And last, but not least I recommend you to follow blogs that cover not only testing aspects(it could be developers, management, or general IT blog). I strongly recommend these two:</p><ul><li><a href="https://martinfowler.com/">Martin Fowler blog</a></li><li><a href="http://blog.cleancoder.com/">Robert Martin</a></li></ul><h3><strong>Conclusion</strong></h3><p>As you can see, there are plenty of options and various sources of information nowadays. The main challenge is to get the most valuable for you in the current moment and find enough time to consume and work on the information you get. Some of the authors provide more serious content, some of them are easier to read, but anyway you have a lot of options to choose from. If you think I forgot someone valuable to add, please drop a comment.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5d4ece14814" width="1" height="1" alt=""><hr><p><a href="https://levelup.gitconnected.com/resources-to-get-software-testing-qa-news-c5d4ece14814">Resources to get Software Testing &amp; QA news</a> was originally published in <a href="https://levelup.gitconnected.com/">Level Up Coding</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>