SShortSingh.
Back to feed

How Component Separation Makes Screenshot Tests and Benchmarks Stable in KMP

0
·1 views

A software architecture post on DEV Community explains why screenshot tests and on-device benchmarks are the most unreliable tiers in mobile test suites, often failing due to non-determinism in the components under test rather than faults in testing tools like Paparazzi or Macrobenchmark. The author argues that instability stems from UI components directly depending on live data sources, real clocks, animations, and async loading, all of which introduce variable inputs that produce inconsistent outputs. The proposed fix is to treat every screen as a pure function of its state, ensuring composables accept only a frozen UiState and never reach for data internally. By routing all side-effectful dependencies such as network calls, location, and clock reads through abstracted ports in a shared CoreLib, tests can inject fully controlled, deterministic inputs. This approach guarantees that a golden screenshot changes only when the UI genuinely changes, and that benchmark numbers are not skewed by I/O jitter or warm-up variance.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

How to Build a Simple CI/CD Pipeline Using GitHub Actions on a VPS

A software developer has detailed how to set up a lightweight CI/CD pipeline using GitHub Actions to automate deployments of a Next.js app to a personal VPS. The pipeline consists of four sequential jobs — lint, security scan, Docker image build, and deployment — where each step must pass before the next begins. Security scanning is handled by Trivy, which checks for critical and high CVEs on every push and blocks the build if a fix is available, using the ignore-unfixed flag to avoid halting deployments over unresolvable vulnerabilities. Once the image passes all checks, it is pushed to GitHub's container registry and deployed to the VPS via SSH using Docker Compose. The author argues this approach delivers the same deployment convenience as managed platforms like Vercel while giving developers full visibility and control over what happens between a git push and a live container.

0
ProgrammingDEV Community ·

Developer Builds GitPulse to Visualize GitHub Activity as Cinematic Animations

A full-stack and AI/ML developer named Rahul Agarwal created GitPulse, a tool that transforms GitHub contribution data into visual, animated experiences rather than static grids. The project uses the GitHub API alongside the Canvas API and GSAP library to render commit history, stars, and pull requests as dynamic visuals. A standout feature called Stellar Duel lets users compare their GitHub activity against a friend's through an interactive, sci-fi-styled side-by-side display. The biggest technical hurdle was performance, which Agarwal addressed by batch-rendering elements on HTML5 Canvas and correctly implementing requestAnimationFrame to pause animations on inactive tabs. GitPulse is available as a live demo, with Agarwal's broader portfolio of AI/ML and computer vision projects hosted at his personal website.

0
ProgrammingDEV Community ·

Developer launches free UAE calculator platform pulling live government data

A UAE-based developer has built Adad, a free online platform offering 15 calculators covering common financial and administrative queries for residents. The tool draws data from official UAE government sources, including GDRFA, ICA, and UAE labour law, and refreshes every 24 hours to stay current. Calculators cover visa fees, zakat, DEWA electricity bills, and end-of-service gratuity, among others. The platform requires no sign-up and is available in eight languages at adad.ae. It was created out of frustration with outdated information typically found through general web searches.

0
ProgrammingDEV Community ·

How to self-host a Next.js app on a VPS and escape Vercel's rising costs

A developer describes migrating Next.js projects from Vercel to a self-managed VPS after finding that costs climbed with traffic and serverless function usage. The approach uses a multi-stage Docker build with Next.js's standalone output mode, shrinking the production image from roughly 1 GB to around 200 MB. The final container runs as a non-root user, and static assets must be manually copied alongside the standalone server.js file or the app will load without CSS or images. Environment variables require careful handling: NEXT_PUBLIC_ values must be baked in at build time as Docker build arguments, while server-side secrets are injected at runtime via an env file. The author maintains a git-push-to-deploy workflow but retains full control over infrastructure costs and configuration.

How Component Separation Makes Screenshot Tests and Benchmarks Stable in KMP · ShortSingh