SShortSingh.
Back to feed

Why Dart Developers Are Ditching Mockito for Faster, Cleaner Unit Testing

0
·61 views

A software engineer argues that Mockito, once the standard mocking library for Dart, has become a liability in modern Flutter development due to its reliance on build_runner for code generation. When Dart introduced sound null safety in version 2.12, Mockito lost its runtime magic and was forced to generate boilerplate code at compile time, adding significant delays to the development cycle. This code generation can take anywhere from 15 seconds to two minutes on large codebases, breaking the tight feedback loops essential to Test-Driven Development. The approach also produces thousands of lines of machine-generated files that clutter repositories, complicate pull request reviews, and cause difficult merge conflicts. The author contends that better alternatives now exist and that continuing to use Mockito imposes unnecessary engineering overhead on modern Dart projects.

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 ·

RupayaTools Offers Free, Sign-Up-Free Calculators Built for Indian Students and Job Seekers

A developer built RupayaTools, a free website of online tools designed for users in India. The site offers no-account, no-download utilities such as CGPA, SGPA, and percentage calculators aligned with CBSE and university grading. It also includes salary, EMI, and income-tax calculators, along with age calculators and unit converters. All tools run in the browser, so user data stays on the device, and the creator says the site is free with no paywall.

0
ProgrammingDEV Community ·

Stock Scorer Shows Negative Predictive Power in A-Share Backtest

A developer built a three-pillar scoring model for Chinese A-shares, combining technical, volume/price, and valuation signals to rank stocks and select the top 50. When audited against 70 rebalance dates and 587 stocks, the composite score showed a significantly negative rank information coefficient, meaning higher scores tended to precede lower returns. Two of the three pillars had negative IC values, and the only positive one came from the component labeled fundamental, which the author suspects is mislabeled. Decile analysis reinforced the finding, as the highest-scoring stocks underperformed the lowest-scoring ones over the five-day horizon. The author used the same shipped code in the audit rather than a rewritten version, and noted that the results are not perfectly monotonic and occurred during a falling market window.

0
ProgrammingDEV Community ·

Maruti Suzuki's quarterly margin figures differ by measure, not by error

Maruti Suzuki's July–September 2026 results drew different margin figures from different outlets, including 5.9%, 5.5%, and 8.9%. The variation comes from measuring profit at different levels: EBITDA counts only running costs, EBIT also deducts depreciation, and pre-tax margin further adjusts for interest and other income. Maruti's large cash holdings lift its other income, which is why its pre-tax margin sits above its EBIT margin. The author notes that Indian filings are not uniformly labelled, so the platform standardised on pre-tax profit divided by sales for all Indian stocks. The piece argues that data should always be shown alongside the name of the measure used.

0
ProgrammingDEV Community ·

Hosting a three-repo security platform on free tiers: the bugs that surfaced

A developer built Sentinel, a self-hostable security monitoring platform split into an API, a dashboard, and a Python scanner, and documented the problems that emerged when moving it from local Docker Compose to free hosting services. Storing the refresh token in a SameSite=Strict cookie caused logouts on every reload across different hosted domains, and the developer avoided the tempting SameSite=None fix by routing requests through a same-origin proxy in the dashboard. A sign-in error was then traced to a relative-URL bug in the proxy mode that made every API call throw before being sent. The account also covers how a seed script's upsert design prevented admin password resets, leading to a one-off reset script.