<?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 Mayur Patil on Medium]]></title>
        <description><![CDATA[Stories by Mayur Patil on Medium]]></description>
        <link>https://medium.com/@mayurpatil3007?source=rss-2ab52e68142a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*9wjjVwCaveBdpvsTR6_ENw.png</url>
            <title>Stories by Mayur Patil on Medium</title>
            <link>https://medium.com/@mayurpatil3007?source=rss-2ab52e68142a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 20:59:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@mayurpatil3007/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[AI-Assisted Android UI Testing & Intelligent Failure Diagnosis using Firebender]]></title>
            <link>https://medium.com/@mayurpatil3007/ai-assisted-android-ui-testing-intelligent-failure-diagnosis-using-firebender-50729e5bf580?source=rss-2ab52e68142a------2</link>
            <guid isPermaLink="false">https://medium.com/p/50729e5bf580</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[ai-automation]]></category>
            <category><![CDATA[android-ui-testing]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[firebender]]></category>
            <dc:creator><![CDATA[Mayur Patil]]></dc:creator>
            <pubDate>Mon, 13 Apr 2026 12:02:05 GMT</pubDate>
            <atom:updated>2026-04-13T12:02:31.930Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dVSxdCrK4sev9Q0pOUhMUg.png" /></figure><h3>1. Summary</h3><p>This post explores an AI-driven approach to mobile UI testing using Firebender. It covers:</p><ul><li>How tests can be created directly from natural language prompts</li><li>How <strong>“Mobile QA — a feature by Firebender”</strong> executes flows at a high level</li><li>How test flows improve through iterative refinement</li><li>How reusable Maestro YAML-based test artifacts are generated</li><li>How intelligent failure analysis helps identify root causes and suggest fixes</li></ul><h4>Steps</h4><p><strong>1. Enter Prompt</strong><br> Describe the flow in plain English — <strong><em>“Test Login UI flow”</em></strong></p><p><strong>2. YAML Test is Generated</strong><br> System creates a structured, reusable test file</p><p><strong>3. Wrap into Custom Command</strong><br> Map the flow to a command like:<br> /Run Login UI Flow</p><p><strong>4. Execute Anytime (on Emulator/Device)</strong><br> Run the command → test executes on an emulator or real device<br> Firebender directly interacts with the emulator/device to perform actions like tap, input, and navigation</p><p><strong>5. Get Results + Debug Insights</strong><br> If a failure occurs, the system provides:</p><ul><li>Root cause analysis</li><li>Bug classification</li><li>Fix suggestions</li></ul><p><strong>Prompt → YAML → Command → Run (via Firebender on Emulator) → Debug</strong></p><h3>2. Mobile QA — Core Concept</h3><p><strong><em>Mobile QA is the primary interface in Firebender for UI automation.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cGZll58bimKdp-aFt68ZFA.png" /><figcaption><strong>AI-driven interface for building mobile UI tests without code.</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DXSLc_tKR_Ga9kC470J7CA.png" /><figcaption><strong>Execute tests directly on your selected emulator or device.</strong></figcaption></figure><p>It enables:</p><ul><li>Prompt-driven test creation</li><li>Execution on real devices or emulators</li><li>Iterative refinement of test flows</li><li>Automatic generation of reusable test artifacts</li></ul><h3>Execution Model</h3><pre>Prompt → Execute → Analyze → Improve → Finalize</pre><p>This model abstracts traditional scripting and shifts focus to <strong>intent-driven testing</strong>.</p><h3>3. How Mobile QA Works (Practical Execution Flow)</h3><p>Mobile QA operates using a <strong>structured, checklist-driven execution model</strong> based on natural language prompts.<br>It prioritizes clarity, visibility, and reliability over low-level implementation details.</p><h4>3.1 Prompt to Execution Flow</h4><p>When a user provides a prompt <strong>(for example, <em>“Test an end-to-end login flow”</em>),</strong> the system analyzes the request, understands the target flow, and breaks it down into logical sections. It then generates a structured checklist of steps (e.g., navigation, selection, validation) and begins executing them iteratively on the <strong>selected emulator or device</strong>, marking progress as each step is completed.</p><h4>3.2 Key Characteristics</h4><ul><li><strong>Checklist-Driven Execution</strong><br>Structured execution instead of ad-hoc scripting</li><li><strong>Natural Language Interface</strong><br>No need to manually write test scripts</li><li><strong>Incremental Visibility</strong><br>Step-by-step execution tracking</li></ul><h3>4. Output — Generated YAML Flows</h3><p>After successful execution on emulator, Firebender generates <strong>Maestro-compatible YAML test flows</strong>.<br> Sample Generated Flow (Excerpt) — example generated YAML file: login_flow.yaml</p><pre>appId: com.example.app<br>---<br>- launchApp<br><br>- assertVisible: &quot;Login&quot;<br>- tapOn:<br>    id: &quot;emailField&quot;<br>- inputText: &quot;test@example.com&quot;<br><br>- tapOn:<br>    id: &quot;passwordField&quot;<br>- inputText: &quot;password123&quot;<br><br>- tapOn: &quot;Login&quot;<br><br>- assertVisible: &quot;Home&quot;</pre><h4>Characteristics</h4><ul><li>Represents finalized test logic</li><li>Reusable across environments</li><li>Can be version-controlled</li><li>Compatible with execution engines</li></ul><h3>5. Create Once, Run Always (Key Benefit)</h3><p>Once a test flow is generated and finalized as a YAML file, it becomes a <strong>stable and reusable automation asset</strong>.<br>To simplify execution and improve accessibility, these flows are wrapped as <strong>custom Firebender commands</strong>, allowing test execution via natural language triggers.</p><h4>Custom Command Mapping</h4><p>Each test flow is mapped to a Firebender command via firebender.json:</p><pre>{<br>  &quot;name&quot;: &quot;Run Login UI Test Flow&quot;,<br>  &quot;path&quot;: &quot;./prompts/run-login-flow.md&quot;<br>}</pre><p>This defines a user-invokable command that internally executes a specific Maestro test flow.</p><h4>Command Definition (Prompt File)</h4><p>The corresponding <strong>run-login-flow.md</strong> file defines how the test should be executed:</p><pre>Run this exact command from the project root:<br>maestro test .maestro/login_flow.yaml<br>Do not add any extra flags.<br>After execution, generate a structured assertion report based on ONLY assertion-level validations.<br>### Output Requirements<br>1. Include ONLY assertions (explicit or implied from the flow).<br>2. Do NOT include very basic action steps like tap, scroll, inputText, etc. But include the meaningful actions like list selections and text additions or checkbox selections<br>3. Infer meaningful assertions from the flow (not just raw assertVisible).<br>4. Each assertion must clearly state:<br>   * Status: Passed ✅ or Failed ❌ or Skipped (not executed)⏭️<br>   * What is being validated<br>5. If any failure exists:<br>   - Identify the MOST LIKELY root cause by extensively analyzing the source code in depth.<br>   - Classify the bug using this severity &amp; type matrix:<br>      - **Logic Bug** - broken control flow, missing lifecycle calls, incorrect state transitions<br>      - **UI Bug** - cosmetic issues, wrong colors, misaligned layouts<br>      - **Crash Bug** - app crashes, unhandled exceptions, null pointer, fatal errors<br>      - **Data Bug** - state not persisted, stale cache, race conditions<br>      - **Test Script Bug** - wrong selector, timing issue, flaky assertion<br>   - State the **severity**: Critical / High / Medium / Low<br>   - State the **user impact**: What does the end user experience?<br>6. Provide fix suggestions:<br>   - For developers (with exact file, method, and line reference)<br>   - For test script (if applicable)</pre><h4>Design Principle:</h4><p>Each command can be mapped to a single, self-contained and independently executable flow, ensuring consistent execution, standardized output, and easy discoverability.</p><p>This pattern can be extended for multiple flows:</p><pre>/Run Login Flow<br>/Run Create Product Flow<br>/Run Delete Product Flow</pre><p>Each command maps to:</p><ul><li>A dedicated YAML test file</li><li>A dedicated prompt definition</li></ul><h3>6. Intelligent Failure Analysis (AI-Powered Debugging)</h3><p>One of the biggest advantages of using custom commands is that they go beyond simple test failure reporting.</p><p>Instead of just telling you <em>what failed</em>, the system helps you understand <strong>why it failed</strong> — and how to fix it.</p><h4>How Failure Analysis Works</h4><p>When a test fails, the system performs a structured analysis:</p><p><strong>1. Failure Detection</strong><br> Identifies the exact step and assertion where the failure occurred.</p><p><strong>2. Context Mapping</strong><br> Maps the failure to the relevant:</p><ul><li>UI screen</li><li>Feature</li><li>Underlying code (e.g., ViewModel, navigation, API layer)</li></ul><p><strong>3. Root Cause Analysis</strong><br> Evaluates likely reasons such as:</p><ul><li>Incorrect UI state or logic flow</li><li>Missing or delayed data</li><li>Navigation issues</li><li>Selector or timing problems</li></ul><h4>Bug Classification</h4><p>Each issue is categorized for clarity:</p><ul><li><strong>Logic Bug</strong> — incorrect state handling or flow</li><li><strong>UI Bug</strong> — layout or visibility issues</li><li><strong>Crash Bug</strong> — runtime exceptions or app crashes</li><li><strong>Data Bug</strong> — stale, missing, or incorrect data</li><li><strong>Test Script Bug</strong> — selector issues or flaky timing</li></ul><h4>Severity &amp; User Impact</h4><p>Every failure is prioritized with:</p><ul><li><strong>Severity</strong>: Critical / High / Medium / Low</li><li><strong>User Impact</strong>: What the user actually experiences</li></ul><h4>Fix Suggestions</h4><p>The system provides actionable recommendations for:</p><ul><li><strong>Developers</strong> — where to look (file/method) and what to fix</li><li><strong>Test Scripts</strong> — if the issue is due to selectors or timing</li></ul><h4>Example</h4><p>Instead of a vague error like:</p><blockquote><em>“Element not found”</em></blockquote><p>You get a meaningful insight:</p><ul><li><strong>Assertion Failed</strong>: “Search Services” not visible</li><li><strong>Root Caus</strong>e: Navigation state not updated after selection</li><li><strong>Bug Type</strong>: Logic Bug</li><li><strong>Severity</strong>: High</li><li><strong>Suggested Fix</strong>: Update state handling in ProductViewModel.onProductTypeSelected()</li></ul><h3>7. Advantages of Mobile QA Approach</h3><h4>7.1 Simplified Test Creation</h4><ul><li>Reduces the need for manual scripting for common flows</li><li>Enables creation of end-to-end tests using natural language prompts</li></ul><h4>7.2 Reduced Learning Curve</h4><ul><li>Requires limited knowledge of automation frameworks</li><li>Makes it easier for both developers and QA to contribute</li></ul><h4>7.3 Adaptive Execution</h4><ul><li>Can adjust to:</li><li>Minor UI changes</li><li>Timing variations</li><li>Helps improve stability over iterations</li></ul><h4>7.4 Improved Visibility</h4><ul><li>Checklist-based execution provides clear progress tracking</li><li>Easier identification of failure points</li></ul><h4>7.5 Iterative Refinement</h4><ul><li>Supports a loop of:</li><li>Execute → Review → Improve</li><li>Helps stabilize test scenarios gradually</li></ul><h3>8. Conclusion</h3><p>AI-assisted UI testing replaces fragile, hand-written scripts with stable, automatically generated, intent-driven test flows.</p><p>It enables developers to:</p><ul><li>Quickly validate critical user flows</li><li>Reduce flaky tests through adaptive execution</li><li>Generate reusable test artifacts</li><li>Gain clear visibility into test execution</li></ul><p>The real advantage comes from <strong>AI-powered failure diagnosis</strong>, which not only detects issues but also explains root causes and suggests fixes — significantly reducing debugging time.</p><p>Overall, this approach acts as a <strong>lightweight verification layer during development</strong>, helping catch UI and logic issues early, improving stability, and reducing the chances of bugs reaching production.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=50729e5bf580" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[MVI with Clean Architecture in Android — Beyond the Theory]]></title>
            <link>https://medium.com/@mayurpatil3007/mvi-with-clean-architecture-in-android-beyond-the-theory-51754d1c9145?source=rss-2ab52e68142a------2</link>
            <guid isPermaLink="false">https://medium.com/p/51754d1c9145</guid>
            <dc:creator><![CDATA[Mayur Patil]]></dc:creator>
            <pubDate>Fri, 23 Jan 2026 18:57:44 GMT</pubDate>
            <atom:updated>2026-01-23T19:23:59.487Z</atom:updated>
            <content:encoded><![CDATA[<h3>MVI with Clean Architecture in Android — Beyond the Theory</h3><h3>Building scalable, predictable apps beyond textbook patterns</h3><p>Modern Android apps rarely fail because of UI code. They fail because <strong>state, side effects, and business rules get tangled over time</strong>.</p><p>Model-View-Intent (MVI) promises predictability.<br>Clean Architecture promises separation of concerns.</p><p>Used together — <strong>correctly</strong> — they create an architecture that scales with features, teams, and years of maintenance. Used poorly, they create ceremony, boilerplate, and confusion.</p><p>This article explains <strong>how to combine MVI with Clean Architecture in a practical, production-ready way</strong>, inspired by a modular recipe search app architecture.</p><h3>Why Combine MVI and Clean Architecture?</h3><p>MVI and Clean Architecture solve <strong>different problems</strong>, which is why they fit so well together.</p><p>MVI helps with <strong>UI consistency</strong>.<br>When state flows in one direction and every change is explicit, the UI becomes predictable. Screens stop behaving differently after rotations or background kills.</p><p>Clean Architecture helps with <strong>business logic clarity</strong>.<br>It keeps rules and decisions away from UI code. Network calls, database logic, and core rules don’t leak into screens or ViewModels.</p><p>Together, they make code <strong>easy to test</strong>.<br>State changes can be tested without Android. Business logic can be tested without UI. Bugs become easier to find and easier to fix.</p><p>They also make apps <strong>easier to scale</strong>.<br>New features don’t require touching unrelated code. Teams can add screens without fear, because responsibilities are clearly separated.</p><p>In short:</p><ul><li>MVI keeps the UI honest</li><li>Clean Architecture keeps logic clean</li><li>Together, they keep large apps sane</li></ul><p>The key is <strong>clear ownership</strong> of responsibility.</p><h3>High-Level Architecture Overview</h3><p>At a conceptual level, the flow looks like this:</p><pre>User<br> │<br> │ taps / types<br> ▼<br>UI (Compose / XML)<br> │<br> │ sends Intent<br> │   viewModel.process(intent)<br> ▼<br>ViewModel<br> │<br> │ ️⃣1. calls reducer (sync, fast)<br> │    → updates UI state (loading, text, etc.)<br> │<br> │ ️⃣2. decides if async work is needed<br> │<br> ├── if YES ──► call UseCase (Domain)<br> │                 │<br> │                 ▼<br> │              Repository (Data)<br> │                 │<br> │                 ▼<br> │              API / Database<br> │<br> │ ️⃣3. result comes back<br> │    → update state again (data or error)<br> ▼<br>StateFlow emits new state<br> │<br> ▼<br>UI re-renders automatically</pre><p>Each layer knows <strong>less</strong> than the one above it.<br>Dependencies point <strong>inward</strong>, never outward.</p><h3>Clean Architecture Layers (Quick Recap)</h3><h3>1. UI Layer</h3><ul><li>Screens / Composables</li><li>ViewModels</li><li>MVI contracts (Intent, State, Effect)</li></ul><p><strong>Depends on:</strong> Domain<br><strong>Knows nothing about:</strong> Retrofit, Room, APIs</p><h3>2. Domain Layer</h3><ul><li>UseCases (Interactors)</li><li>Entities</li><li>Repository interfaces</li></ul><p><strong>Depends on:</strong> Nothing<br><strong>Knows nothing about:</strong> Android</p><h3>3. Data Layer</h3><ul><li>Repository implementations</li><li>Network / database code</li><li>DTO → Domain mapping</li></ul><p><strong>Depends on:</strong> Domain contracts<br><strong>Knows nothing about:</strong> UI</p><h3>Where MVI Lives</h3><p>MVI belongs <strong>inside the UI layer</strong>, but it <em>coordinates</em> with Domain.</p><p>Think of MVI as the <strong>presentation protocol</strong> for how UI communicates with business logic.</p><p>Let’s break down each MVI component <strong>with Clean Architecture context</strong>.</p><h3>1. Intent — Declaring What Happened</h3><h3>What is an Intent?</h3><p>An <strong>Intent</strong> represents an event:</p><ul><li>A user action</li><li>A lifecycle trigger</li><li>A retry or refresh</li></ul><p>It does <strong>not</strong> contain logic.</p><pre>sealed interface SearchIntent {<br>    data class QueryChanged(val text: String) : SearchIntent<br>    object SearchClicked : SearchIntent<br>    object Refresh : SearchIntent<br>}</pre><h3>Why Intents Matter</h3><p>Without intents:</p><ul><li>UI directly calls ViewModel methods</li><li>State changes become implicit</li><li>Debugging becomes guesswork</li></ul><p>With intents:</p><ul><li>Every state change has a <strong>name</strong></li><li>Behavior is traceable</li><li>Tests become meaningful</li></ul><blockquote><em>Intents are the </em><strong><em>inputs</em></strong><em> to your state machine.</em></blockquote><h3>2. ViewState — Single Source of Truth</h3><h3>What Is ViewState?</h3><p>ViewState is a <strong>complete snapshot</strong> of the UI.</p><p>If it’s visible on screen, it belongs in state.</p><pre>data class SearchViewState(<br>    val query: String = &quot;&quot;,<br>    val isLoading: Boolean = false,<br>    val results: List&lt;Recipe&gt; = emptyList(),<br>    val error: String? = null<br>)</pre><h3>Why This Is Critical</h3><p>Without a single state object:</p><ul><li>UI pulls data from multiple places</li><li>Rotation bugs appear</li><li>Loading/error states desync</li></ul><p>With ViewState:</p><ul><li>UI becomes deterministic</li><li>Compose recomposition is safe</li><li>Debugging is straightforward</li></ul><h3>3. Reducer — Making State Changes Explicit</h3><h3>What Is a Reducer?</h3><p>A <strong>reducer</strong> is a small function whose only job is to <strong>calculate the next UI state</strong>.</p><p>It takes:</p><ul><li>the <strong>current state</strong></li><li>an <strong>event (intent)</strong></li></ul><p>…and returns a <strong>new state</strong>.</p><p>Nothing more.</p><h3>Where Is the Reducer Written?</h3><p>In Android, the reducer is usually written in the <strong>UI / presentation layer</strong>, close to the ViewModel.</p><p>Common places:</p><ul><li>In the same file as the ViewModel</li><li>In a separate Reducer.kt file inside the feature module</li></ul><p>It <strong>does not</strong> belong in:</p><ul><li>Domain layer</li><li>Data layer</li></ul><p>The reducer is purely about <strong>UI state</strong>, so it stays near the UI.</p><h3>Reducer Example</h3><pre>fun reduce(<br>    current: SearchViewState,<br>    intent: SearchIntent<br>): SearchViewState {<br>    return when (intent) {<br>        is SearchIntent.QueryChanged -&gt; {<br>            current.copy(<br>                query = intent.text,<br>                error = null<br>            )<br>        }<br>        SearchIntent.SearchClicked -&gt; {<br>            current.copy(<br>                isLoading = true,<br>                error = null<br>            )<br>        }<br>        SearchIntent.Refresh -&gt; {<br>            current.copy(<br>                isLoading = true,<br>                error = null<br>            )<br>        }<br>    }<br>}</pre><p>Read this like a sentence:</p><ul><li><em>If the query changes → update the query</em></li><li><em>If search is clicked → show loading</em></li><li><em>If refresh is triggered → show loading</em></li></ul><p>That’s it.</p><h3>What a Reducer Is NOT Allowed to Do</h3><p>A reducer must stay <strong>boring and predictable</strong>.</p><p>So it must <strong>not</strong>:</p><ul><li>Call the network</li><li>Read or write the database</li><li>Launch coroutines</li><li>Trigger navigation</li><li>Show toasts or snackbars</li><li>No side effects. Ever.</li></ul><h3>What Problem Does a Reducer Solve?</h3><p>Without a reducer:</p><ul><li>State changes happen in many places</li><li>UI bugs are hard to trace</li><li>Developers don’t know <em>why</em> the UI changed</li></ul><p>With a reducer:</p><ul><li>Every state change goes through <strong>one function</strong></li><li>Every UI update has a <strong>clear reason</strong></li><li>Debugging becomes simple</li></ul><h3>The One Question a Reducer Answers</h3><blockquote><strong><em>“Given this state and this event, what should the UI look like next?”</em></strong></blockquote><p>If the reducer answers only this question, it is correct.</p><h3>Why Reducers Are So Reliable</h3><p>Reducers are:</p><ul><li>Easy to read</li><li>Easy to test</li><li>Hard to break by mistake</li></ul><p>A simple test:</p><pre>val newState = reduce(<br>    SearchViewState(),<br>    SearchIntent.SearchClicked<br>)<br>assertTrue(newState.isLoading)</pre><p>No Android. No mocks. No setup.</p><h3><strong>4. ViewModel — C</strong>oordinator between the UI and the domain layer</h3><p>The ViewModel:</p><ul><li>Receives intents</li><li>Applies reducers</li><li>Triggers side effects</li><li>Exposes state &amp; effects</li></ul><pre>class SearchViewModel(<br>    private val searchUseCase: SearchUseCase<br>) : ViewModel() {<br>    private val _state = MutableStateFlow(SearchViewState())<br>      val state: StateFlow&lt;SearchViewState&gt; = _state<br>      fun process(intent: SearchIntent) {<br>        _state.update { reduce(it, intent) }<br>        when (intent) {<br>            SearchIntent.SearchClicked,<br>            SearchIntent.Refresh -&gt; performSearch()<br>            else -&gt; Unit<br>         }<br>      }<br>}</pre><h3>Why This Works</h3><ul><li>Reducers stay pure</li><li>Domain logic stays outside UI</li><li>ViewModel coordinates, not decides</li></ul><h3>5. <strong>Domain calls </strong>— Crossing the Boundary</h3><p>Side effects are operations that:</p><ul><li>Talk to network</li><li>Read/write disk</li><li>Trigger navigation</li><li>Emit analytics</li></ul><p>They <strong>must not live in reducers</strong>.</p><pre>private fun performSearch() {<br>    viewModelScope.launch {<br>        runCatching {<br>            searchUseCase(state.value.query)<br>        }.onSuccess { result -&gt;<br>            _state.update {<br>                it.copy(<br>                    isLoading = false,<br>                    results = result<br>                )<br>            }<br>        }.onFailure { error -&gt;<br>            _state.update {<br>                it.copy(<br>                    isLoading = false,<br>                    error = error.message<br>                )<br>            }<br>        }<br>    }<br>}</pre><h3>Key Rule</h3><blockquote><em>Reducers update state<br>Domain calls </em>react<em> to intents or state</em></blockquote><h3>Note:</h3><p>runCatching is used to <strong>convert exceptions into an explicit success / failure result</strong>, so:</p><ul><li>errors don’t crash the coroutine</li><li>error handling stays <strong>linear and readable</strong></li><li>state updates remain centralized</li></ul><h3>Domain Layer — Business Logic Done Right</h3><h3>6. UseCases — One Business Action</h3><p>UseCases encapsulate <strong>one business rule</strong>.</p><pre>class SearchUseCase(<br>    private val repository: RecipeRepository<br>) {<br>    suspend operator fun invoke(query: String): List&lt;Recipe&gt; {<br>        return repository.search(query)<br>    }<br>}</pre><h3>Why UseCases Matter</h3><ul><li>UI doesn’t know <em>how</em> data is fetched</li><li>Business logic is reusable</li><li>Tests don’t need Android</li></ul><p>UseCases act as a <strong>stable API</strong> between UI and data.</p><h3>7. Repository Contracts</h3><p>Domain defines the contract:</p><pre>interface RecipeRepository {<br>    suspend fun search(query: String): List&lt;Recipe&gt;<br>}</pre><p>Data implements it:</p><pre>class RecipeRepositoryImpl(<br>    private val api: RecipeApi<br>) : RecipeRepository {<br>    override suspend fun search(query: String): List&lt;Recipe&gt; {<br>        return api.searchRecipes(query)<br>            .map { it.toDomain() }<br>    }<br>}</pre><p>This inversion of dependency is the <strong>core of Clean Architecture</strong>.</p><h3>8. UI Effects — One-Time Actions</h3><p>State is persistent.<br>Some actions should happen <strong>once</strong>.</p><p>Examples:</p><ul><li>Navigation</li><li>Toasts</li><li>Snackbars</li></ul><h3>Solution: Effects</h3><pre>sealed interface SearchEffect {<br>    data class ShowError(val message: String) : SearchEffect<br>    object NavigateToDetails : SearchEffect<br>}</pre><pre>private val _effect = MutableSharedFlow&lt;SearchEffect&gt;()<br>val effect = _effect.asSharedFlow()</pre><p>Effects are:</p><ul><li>Emitted once</li><li>Collected by UI</li><li>Never stored in state</li></ul><h3>UI Layer — Compose + MVI</h3><pre>@Composable<br>fun SearchScreen(viewModel: SearchViewModel) {<br>    val state by viewModel.state.collectAsState()<br>      TextField(<br>        value = state.query,<br>        onValueChange = {<br>            viewModel.process(SearchIntent.QueryChanged(it))<br>          }<br>      )<br>      Button(<br>        onClick = {<br>            viewModel.process(SearchIntent.SearchClicked)<br>          }<br>      )   {<br>            Text(&quot;Search&quot;)<br>    }    <br>    if (state.isLoading) {<br>        CircularProgressIndicator()<br>    }<br>    state.error?.let {<br>        Text(text = it)<br>    }<br>}</pre><p>UI becomes:</p><ul><li>Passive</li><li>Predictable</li><li>Easy to refactor</li></ul><h3>Testing Benefits (Huge Win)</h3><p>With this architecture, you can test:</p><h3>Reducer</h3><pre>@Test<br>fun `query change updates state`() {<br>    val state = SearchViewState()<br>    val result = reduce(state, SearchIntent.QueryChanged(&quot;Pizza&quot;))<br>    assertEquals(&quot;Pizza&quot;, result.query)<br>}</pre><h3>UseCase</h3><pre>@Test<br>fun `search returns data`() = runTest {<br>    val result = useCase(&quot;Pasta&quot;)<br>    assertTrue(result.isNotEmpty())<br>}</pre><p>No Android. No mocks everywhere. No flakiness.</p><h3>When This Architecture Shines</h3><ol><li>Complex screens</li><li>Offline-first apps</li><li>Long-lived ViewModels</li><li>Feature-based modularization</li><li>Large teams</li></ol><h3>When It Might Be Overkill</h3><ol><li>Simple CRUD screens.</li><li>Throwaway prototypes</li><li>Teams new to reactive state</li></ol><p>Architecture should <strong>reduce cognitive load</strong>, not increase it.</p><h3>Final Thoughts</h3><p>MVI gives you <strong>predictable state</strong>.<br>Clean Architecture gives you <strong>clear boundaries</strong>.</p><p>Together, they form a system where:</p><ul><li>State changes are explicit</li><li>Business rules are isolated</li><li>UI bugs are easier to reason about</li><li>Codebases scale without fear</li></ul><p>The goal isn’t perfection. The goal is <strong>trust</strong> — in your state, your logic, and your app.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51754d1c9145" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Android Localization with Firebender’s Custom “Update Translations” Command]]></title>
            <link>https://medium.com/@mayurpatil3007/automating-android-localization-with-firebenders-custom-update-translations-command-7527b7dc8050?source=rss-2ab52e68142a------2</link>
            <guid isPermaLink="false">https://medium.com/p/7527b7dc8050</guid>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[generative-ai-use-cases]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[generative-ai-tools]]></category>
            <dc:creator><![CDATA[Mayur Patil]]></dc:creator>
            <pubDate>Sat, 20 Dec 2025 06:58:47 GMT</pubDate>
            <atom:updated>2025-12-20T07:04:34.026Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tlpEORB6Ms1j_hFmmrLWvA.png" /><figcaption>Image Source: ChatGPT</figcaption></figure><h3>Automating Android Localization with Firebender AI’s Custom “Update Translations” Command</h3><p>Localization starts out easy in Android apps — just a few strings here and there. But as your app grows, it’s easy for localization to spiral into a headache. New strings creep in each sprint, translators fall behind, and the last-minute scramble to find missing or broken translations is stressful and error-prone. Placeholder formats, plurals, and XML tags just add to the mess.</p><p>The problem is addressed using a custom Firebender AI command called <strong>Update Translations</strong>. It ensures localized string files remain in sync with the base English strings.xml without risking existing translations.<br> The following sections explain how the command is designed, wired, and executed.</p><h3>Why Managing Localization in Android Is a Pain</h3><p>If you’ve worked on Android apps, this story sounds familiar:</p><ul><li>The values/strings.xml file serves as your source of truth.</li><li>Localized folders like values-fr or values-es aren’t always complete or up to date.</li><li>Developers often spend hours manually:</li><li>Comparing source and localized files,</li><li>Translating the missing strings,</li><li>Carefully preserving placeholders like %1$s, %d, and XML tags,</li><li>Avoiding accidental edits on existing translations.</li></ul><p>This tedious, last-minute work usually happens right before release, when the pressure is highest and mistakes cost dearly.</p><h3>What the “Update Translations” Command Brings to the Table</h3><p>Update Translations solves one problem really well:</p><p>It <strong>keeps localized strings.xml files synchronized with the base English file — without breaking anything</strong>.</p><p>When you run it, the command:</p><ul><li>Reads the base English strings.xml.</li><li>Finds or creates the folder and file for the target language.</li><li>Translates <strong>only</strong> the missing keys.</li><li>Leaves existing translations untouched.</li><li>Preserves all Android-specific placeholders, XML, plurals, and formatting.</li></ul><h3>Seamless Support for New and Existing Languages</h3><p>This command handles two common cases automatically:</p><ul><li><strong>Existing language folder (e.g., </strong><strong>values-es)</strong><br>It compares the Spanish file to the English base, translates any missing keys, and leaves everything else alone.</li><li><strong>Brand new language (e.g., </strong><strong>values-hi)</strong><br>It creates the folder and strings.xml file from scratch, translates every string, and outputs a fully valid Android localization setup out of the box.</li></ul><p>No manual setup or guesses required — just run the command and trust it.</p><h3>Not Just Another Built-In Feature: Our Custom Firebender Command</h3><p>This isn’t something Firebender ships with by default. We wrote the rules, set the scope, and control exactly what it does.</p><p>All of that logic lives in a <strong>plain-text markdown file</strong> that Firebender follows precisely. No guesswork, no hidden magic.</p><h3>Step 1: Defining “Update Translations” Logic in Markdown</h3><p>The heart of the command is /prompts/update-translations.md. This file tells Firebender exactly:</p><ul><li>Which files it can touch.</li><li>How to detect the language code.</li><li>How to handle missing keys.</li><li>How to protect placeholders, plurals, and XML tags.</li><li>What is off limits and must never change.</li></ul><p>Think of it as a contract between us and the AI — strict and immovable, so Firebender never improvises.</p><h3>Full update-translations.md File</h3><p>Below is the complete markdown file that defines the <strong>Update Translations</strong> command.</p><pre># Update Translations<br><br>You are an Android localization assistant that edits only repository files. DO NOT call external<br>APIs or the internet. Operate in local mode only.<br><br>## Language Code Detection<br><br>**Extract the language code from the user&#39;s command invocation.**<br><br>The user will invoke this command with a language code like:<br><br>- &quot;Update Translations - fr&quot;<br>- &quot;Update Translations - de&quot;<br>- &quot;Update Translations - hi&quot;<br>- Or simply: &quot;- fr&quot; or &quot;fr&quot;<br><br>**Your task:**<br><br>1. Extract the language code from the user&#39;s message (the 2-3 letter code after the dash, or any<br>   code like `pt-rBR`)<br>2. Determine the TARGET_LANGUAGE_CODE and TARGET_LANGUAGE_NAME using the mapping below<br><br>### Language Code Mapping:<br><br>- `es` → Spanish<br>- `fr` → French<br>- `de` → German<br>- `it` → Italian<br>- `pt` → Portuguese<br>- `pt-rBR` → Portuguese (Brazil)<br>- `pt-rPT` → Portuguese (Portugal)<br>- `hi` → Hindi<br>- `ja` → Japanese<br>- `zh` → Chinese<br>- `zh-rCN` → Chinese (Simplified)<br>- `zh-rTW` → Chinese (Traditional)<br>- `ko` → Korean<br>- `ar` → Arabic<br>- `ru` → Russian<br>- `nl` → Dutch<br>- `pl` → Polish<br>- `tr` → Turkish<br>- `vi` → Vietnamese<br>- `th` → Thai<br>- `id` → Indonesian<br>- `he` → Hebrew<br>- `sv` → Swedish<br>- `da` → Danish<br>- `no` → Norwegian<br>- `fi` → Finnish<br>- `cs` → Czech<br>- `hu` → Hungarian<br>- `ro` → Romanian<br>- `uk` → Ukrainian<br>- `el` → Greek<br>- `bn` → Bengali<br>- `ta` → Tamil<br>- `te` → Telugu<br>- `mr` → Marathi<br>- `ur` → Urdu<br>- `en-rGB` → English (UK)<br>- `en-rUS` → English (US)<br>- `es-rMX` → Spanish (Mexico)<br>- `es-rAR` → Spanish (Argentina)<br>- `fr-rCA` → French (Canada)<br><br>**If code not in list:** Use your knowledge to determine the language name.<br><br>## Task<br><br>1. Locate the base file: `app/src/main/res/values/strings.xml` (or `res/values/strings.xml`)<br><br>2. Determine the target localized file path:<br>    - Path: `app/src/main/res/values-{TARGET_LANGUAGE_CODE}/strings.xml` (or<br>      `res/values-{TARGET_LANGUAGE_CODE}/strings.xml`)<br><br>3. **If the target language file does NOT exist:**<br>    - Create the directory `app/src/main/res/values-{TARGET_LANGUAGE_CODE}/` (or<br>      `res/values-{TARGET_LANGUAGE_CODE}/`)<br>    - Create a new `strings.xml` file with proper XML header<br>    - Translate ALL keys from the base `strings.xml` to {TARGET_LANGUAGE_NAME}<br><br>4. **If the target language file exists:**<br>    - Identify keys present in the base `strings.xml` but missing in the target language file<br>    - Translate only the missing keys to {TARGET_LANGUAGE_NAME}<br><br>5. **Translation Rules** - For each key to translate:<br>    - Translate only the **text value** into {TARGET_LANGUAGE_NAME}<br>    - Preserve placeholders verbatim (`%1$s`, `%d`, `%s`, `{0}`, etc.) and do not reorder them<br>    - Preserve HTML-like tags (`&lt;b&gt;`, `&lt;i&gt;`, `&lt;u&gt;`, `&lt;br/&gt;`) and XML entities (`&amp;amp;`, `&amp;quot;`,<br>      `&amp;apos;`, `&amp;lt;`, `&amp;gt;`)<br>    - Translate each `&lt;item&gt;` inside `&lt;plurals&gt;` and `&lt;string-array&gt;` keeping the tag structure<br>      intact<br>    - Leave brand names, product names, model numbers, acronyms, and numeric tokens untranslated<br>    - If translation is ambiguous or context-dependent, append `&lt;!-- NEEDS_REVIEW --&gt;` after that<br>      value<br>    - Maintain cultural appropriateness for the target language and region<br><br>6. **File Formatting:**<br>    - Preserve XML header: `&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;`<br>    - Maintain consistent indentation (typically 4 spaces)<br>    - Keep the `&lt;resources&gt;` root element<br>    - Insert new entries in the same order as they appear in the base file<br><br>7. **Critical Constraint:**<br>    - Only add keys that are missing in the target language file<br>    - Do NOT modify any existing translated values in the target language file<br>    - Do NOT modify any other files<br><br>## Sanity Check after new additions:<br><br>Before finalizing, review all new translations with these questions:<br><br>- ✓ Would this be appropriate in a professional workplace?<br>- ✓ Could this be misinterpreted or offensive to any group?<br>- ✓ Is this suitable for all ages and backgrounds?<br>- ✓ Does it respect cultural norms of the target language region?<br>- ✓ Are placeholders preserved correctly?<br>- ✓ Is the grammar natural for the target language?<br><br>If NO to any question, append `&lt;!-- NEEDS_REVIEW --&gt;` to that string entry.</pre><h3>Step 2: Wiring the Command in firebender.json</h3><p>Next, we formally register the command so Firebender knows it exists:</p><pre>// Inside firebender.json<br>{<br>  &quot;commands&quot;: [<br>    {<br>      &quot;name&quot;: &quot;Update Translations&quot;,<br>      &quot;path&quot;: &quot;./prompts/update-translations.md&quot;<br>    }<br>  ]</pre><p>This simple setup defines the command’s public name and links it directly to our markdown-driven logic.</p><h3>Step 3: Running the Command — What Happens Under the Hood</h3><p>When a developer runs a command like:</p><pre>/Update Translations - fr</pre><p>The AI Agent does following:</p><ol><li>Finds the command in firebender.json.</li><li>Loads our markdown instructions.</li><li>Parses the fr language code.</li><li>Identifies the base values/strings.xml and the target values-fr/strings.xml.</li><li>Translates only missing French keys (or all keys if the folder doesn’t exist).</li><li>Carefully preserves placeholders, XML formatting, and tags.</li><li>Edits only the approved files — nothing else.</li></ol><p>There’s no external internet call, no mysterious black box. Just straightforward, safe file updates.</p><h3>Why This Approach Is Rock-Solid Safe</h3><p>The command adheres to strict safety rules to eliminate risk:</p><ul><li>It modifies only files inside the repo.</li><li>It never reaches out to external APIs or the internet.</li><li>Existing translations stay untouched.</li><li>Placeholders (%1$s, %d), HTML tags, and XML entities remain intact.</li><li>Any ambiguous or uncertain translations get flagged with &lt;!-- NEEDS_REVIEW --&gt;.</li></ul><p>You can run this even days before release without fearing unwanted side effects.</p><h3>Final Thoughts:</h3><p>Localization isn’t about clever hacks or AI wizardry. It’s about being <em>correct</em>, <em>predictable</em>, and <em>safe</em>.</p><p>By defining a custom command in markdown, wiring it explicitly in Firebender’s config, and locking down rules, we turned localization from a headache into a reliable step in our release cycle.</p><p>This workflow lets developers run it whenever they want and trust the results — no sweat, no surprises.</p><p>If your Android app’s localization has felt like a burdensome chore, maybe it’s time to build tools like these and take back control.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7527b7dc8050" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AI-Assisted Unit Testing in Android with Firebender]]></title>
            <link>https://medium.com/@mayurpatil3007/ai-assisted-unit-testing-in-android-with-firebender-71b5ff5ec8f8?source=rss-2ab52e68142a------2</link>
            <guid isPermaLink="false">https://medium.com/p/71b5ff5ec8f8</guid>
            <category><![CDATA[ai-agent]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[unit-testing]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[ai-assisted-coding]]></category>
            <dc:creator><![CDATA[Mayur Patil]]></dc:creator>
            <pubDate>Thu, 21 Aug 2025 10:14:23 GMT</pubDate>
            <atom:updated>2025-08-22T17:32:13.834Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0e_bjJfiseR9djAi5n_9Tw.png" /><figcaption>Image Source: ChatGPT</figcaption></figure><p>How an IDE plugin can draft tests and fixtures for your Android project — while you stay in control.</p><h3>What is Firebender?</h3><p>Firebender is an Android Studio plugin that brings an <strong>AI-powered agent</strong> into our IDE. It analyzes the code we select, reasons about requested changes, and proposes a clear diff for us to review and apply.</p><h3>How to Install</h3><ol><li>Open <strong>Android Studio</strong>.</li><li>Go to <strong>Settings → Plugins → Marketplace</strong>.</li><li>Search for <strong>Firebender</strong>.</li><li>Install and restart your IDE.</li><li>You’ll now see a <strong>Firebender panel</strong> under <em>View → Tool Windows</em>.</li></ol><p>From there, you can configure a firebender.json in your repo and start running commands.</p><h3>Why Firebender?</h3><p>Unit tests are critical, but writing them often feels repetitive. Most of the time, you’re not inventing new logic — you’re scaffolding the same patterns: success vs failure, no-network branches, data parsing, or state updates.</p><p><strong>Firebender</strong> plugin helps with exactly that. It doesn’t replace your judgment — it drafts a test or fixture based on the code you highlight, then shows you a proposed diff. You stay in control: accept, edit, or reject.</p><h3>How Firebender Works</h3><ol><li><strong>Select code</strong> in your IDE (a ViewModel, repository, or model class).</li><li><strong>Firebender analyzes it</strong>, along with any supporting docs you’ve written.</li><li><strong>It proposes a change</strong> — a new unit test, a JSON fixture, or even a quick fix.</li><li><strong>You review the diff</strong>: accept if it matches your style, refine if not.</li></ol><p>It’s not a “chat assistant” bolted on top — it’s wired into your editor and version control workflow.</p><h3>The Secret Sauce: Context Docs</h3><p>What makes Firebender different from generic AI tools is that it can <strong>read the docs you provide as context</strong>.</p><ul><li>Want all tests to use a specific mocking library? Document it.</li><li>Want fixtures to always be small and deterministic? Document it.</li><li>Want debounce tests to use virtual time instead of Thread.sleep? Document it.</li></ul><p>When Firebender runs, it loads these docs first, then drafts tests accordingly.<br>Think of them as your <strong>team’s style guide for tests</strong>.</p><h3>Typical Use Cases</h3><ul><li><strong>Stateful classes</strong> (ViewModels, presenters, reducers):<br> Firebender drafts tests for initial state, success/failure updates, and edge cases.</li><li><strong>IO classes</strong> (repositories, gateways):<br> Firebender generates the familiar trio: success, error, and no-network (if relevant).</li><li><strong>Models and parsing</strong>:<br> It can create a test and propose a matching fixture file alongside.</li></ul><h3>Example Skeletons You Can Adapt</h3><p>Every project is different — different test frameworks, mocking libraries, fixture formats.<br>Below are <strong>skeletons only</strong>. You should <strong>add your own instructions</strong> to match your project’s needs.</p><h3>firebender.json (skeleton example)</h3><p>The `firebender.json` file acts as the central configuration for Firebender. <br>It maps prompts to file patterns and sets the rules for how commands are applied across the codebase.</p><pre>{<br>  &quot;rules&quot;: [<br>    // Global test rules<br>    &quot;Keep tests deterministic and isolated. Avoid real network, filesystem, or random delays.&quot;,<br><br>    // Generic *Test files<br>    {<br>      &quot;filePathMatches&quot;: &quot;**/*Test.*&quot;,<br>      &quot;rules&quot;: [<br>        &quot;Use the project&#39;s preferred test framework (infer from imports).&quot;,<br>        &quot;Follow Arrange / Act / Assert sections.&quot;,<br>        &quot;Prefer stable, minimal fixtures when test data is needed.&quot;<br>      ],<br>      &quot;rulesPaths&quot;: [<br>        &quot;./docs/testing-guidelines.md&quot;,<br>        &quot;./docs/mock-fixtures-guidelines.md&quot;<br>      ]<br>    },<br><br>    // ViewModel tests<br>    {<br>      &quot;filePathMatches&quot;: &quot;**/*ViewModel*Test.*&quot;,<br>      &quot;rules&quot;: [<br>        &quot;// TODO(ViewModel): Add your instructions for ViewModel tests here.&quot;,<br>        &quot;// e.g. Add InstantTaskExecutorRule, observe LiveData with observeForever,&quot;,<br>        &quot;// use Robolectric looper idle/idleFor for debounce, prefer mockito-kotlin helpers, etc.&quot;<br>      ],<br>      &quot;rulesPaths&quot;: [<br>        &quot;./docs/viewmodel-guidelines.md&quot;,<br>      ]<br>    },<br><br>    // Repository tests<br>    {<br>      &quot;filePathMatches&quot;: &quot;**/*Repository*Test.*&quot;,<br>      &quot;rules&quot;: [<br>        &quot;// TODO(Repository): Add your instructions for Repository tests here.&quot;,<br>        &quot;// e.g. No real network or DB; use fakes/in-memory; stub data sources;&quot;,<br>        &quot;// verify query/transform logic; assert error handling and pagination paths.&quot;<br>      ],<br>      &quot;rulesPaths&quot;: [<br>        &quot;./docs/repository-guidelines.md&quot;,<br>      ]<br>    }<br>  ],<br><br>  &quot;ignore&quot;: [<br>    &quot;build/**&quot;,<br>    &quot;.gradle/**&quot;,<br>    &quot;.idea/**&quot;,<br>    &quot;**/.git/**&quot;<br>  ],<br><br>  &quot;commands&quot;: [<br>    { &quot;name&quot;: &quot;Generate ViewModel Tests&quot;, &quot;path&quot;: &quot;./prompts/generate-viewmodel-tests.md&quot; },<br>    { &quot;name&quot;: &quot;Generate Repository Tests&quot;, &quot;path&quot;: &quot;./prompts/generate-repository-tests.md&quot; },<br>    { &quot;name&quot;: &quot;Generate Mock Fixtures&quot;, &quot;path&quot;: &quot;./prompts/generate-mock-fixtures.md&quot; }<br>  ]<br>}</pre><p>This is just a template. Add rules and patterns that make sense for <strong>your</strong> codebase.</p><h3>docs/testing-guidelines.md (example)</h3><p>These guidelines define how tests should be written in this project so AI agent can generate consistent, reliable drafts.</p><pre># Testing Principles (Project-specific)<br>- Use the project’s test framework (JUnit4/JUnit5/Kotest/etc.).<br>- Match the project’s mocking/stubbing library (Mockito, MockK, etc.).<br>- No Thread.sleep or real time → use project’s virtual time utilities.<br>- Assert outcomes at the public contract level (state, events, outputs).<br>- Arrange / Act / Assert format.<br>- Clean up resources in teardown hooks.</pre><h3>docs/mock-fixtures-guidelines.md (example)</h3><p>These rules define how AI agent should generate and update JSON fixtures so they stay minimal, stable, and test-friendly.</p><pre># JSON Fixtures – Generation Rules<br><br>Firebender should CREATE/UPDATE small, deterministic JSON files under `app/src/test/resources/` whenever tests deserialize models.<br><br>## Naming<br>- `mock_&lt;snake_case_model&gt;.json` (e.g., `mock_my_data.json`), unless the test declares a specific file name.<br><br>## Size &amp; Stability<br>- Include only representative, stable fields. Keep arrays tiny (1–3 items).<br>- Prefer short strings, placeholder URLs (https://example.com/...)<br><br>## Type Hints (Kotlin → JSON)<br>- `String` → `&quot;Sample&quot;`<br>- `Int`/`Long` → `123` (timestamps may use `1723000000000`)<br>- `Double`/`Float` → `1.23`<br>- `Boolean` → `true`<br>- `UUID` → `&quot;00000000-0000-0000-0000-000000000000&quot;`<br>- `List&lt;T&gt;` → `[ &lt;minimal T&gt; ]`<br>- Nested objects → include minimal representative subset.<br><br>## Style<br>- 2-space indentation.<br>- No comments in JSON.<br>- Keep keys in stable order; favor top-level fields that tests assert on.</pre><h3>Command Example: prompts/generate-mock-fixtures.md</h3><pre># Generate JSON Fixtures<br>Create minimal, deterministic JSON fixtures for the selected model(s) under<br>`app/src/test/resources/`, following `docs/mock-fixtures-guidelines.md`.<br>**Input you may infer from code:**<br>- Data class fields (names/types), nullability, default values.<br>- Only include representative fields; keep arrays small.<br>**Output:** One or more `mock_&lt;snake_case&gt;.json` files as a proposed diff.</pre><p>This is just one example command. <br>In the same way, you can define other prompt files like<br>/Generate Viewmodel Tests → drafts unit tests for selected viewmodel classes.<br>/Generate Repository Tests → drafts tests for selected repository<br>Clearly state follwoing in your commands:<br>- Purpose of the command <br>- Inputs AI can infer from code<br>- Expected output format<br>Keeping each prompt in its own `.md` file under `prompts/` ensures consistency and makes them easy to reuse.</p><h3>How to Run Custom Prompt Commands</h3><p>Once you’ve set up your firebender.json and docs, here’s how you actually use it inside the IDE:</p><ol><li><strong>Open Firebender panel</strong>:<br> <em>View → Tool Windows → Firebender</em></li><li><strong>Select the code you want to test</strong>:<br> Highlight a class (e.g., a ViewModel, Repository, or Data Model).</li><li><strong>Pick a command from the defined ones in firebender.json</strong>:<br>/Generate MOCK Fixturesor/Generate Viewmodel Tests or<br>/Generate Repository Tests</li><li><strong>Review the diff</strong>:<br> Firebender shows you a git-style diff. Accept what matches, refine the rest.</li><li><strong>Run your tests</strong>:<br> Confirm they compile, pass, and align with your domain logic.</li></ol><p>It feels like working with a code-generator who has read your style guide and gives you a solid first draft.</p><h3>Firebender in Action</h3><p>Highlight a class, choose <em>Generate Tests</em>, and Firebender drafts a suite with clear Arrange / Act / Assert sections. It automatically covers typical cases — like verifying the initial state, handling success, and simulating failures. When the code involves data deserialization, Firebender may also suggest a compact fixture file. The result is a ready-to-review diff that you can accept as-is or fine-tune — fast, consistent, and reliable.</p><h3>Why This Matters</h3><ul><li><strong>Consistency</strong> → Every developer writes tests a bit differently. The AI assistance narrows the gap.</li><li><strong>Speed</strong> → Skip boilerplate, focus on meaningful assertions.</li><li><strong>Quality</strong> → Encoding your rules up front reduces flaky tests.</li><li><strong>Adoption</strong> → Teams write more tests if the barrier is lower.</li></ul><p>Think of the AI agent as <strong>pair-programmer for test scaffolding</strong>: the AI drafts, you verify.</p><h3>Closing Thought</h3><p>The real strength isn’t in “auto-writing tests.” It’s in codifying your testing culture into simple docs that the AI respects every time.</p><p>The skeletons above are just starting points. Fill them with <strong>your own frameworks, libraries, and conventions</strong> — JUnit, Mockito, RxJava, coroutines, etc - whatever your stack is. Once you do, the agent becomes a reliable teammate that speeds you up while keeping quality high.</p><p><strong>It’s not automation, it’s acceleration </strong>— with your team’s judgment firmly in charge.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71b5ff5ec8f8" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>