Hero Background

Power Your Software Testing with AI Agents and Cloud

The Native AI-Agentic Cloud Platform to Supercharge Quality Engineering. Test Intelligently and Ship Faster.

Kane CLIPortfolio

Test holdings profit and loss against its inputs

Quantity times the price delta, checked on a winning position and a losing one, including the sign.

Published on:

Profit and loss is the number that decides whether a customer trusts a broker. It is computed from an average cost and a live price, and both of those can be right while the result is wrong.

This use case checks the arithmetic on the Zerodhaa Kyte holdings page, on a position that is up and one that is down.

The contract this flow keeps

The test asserts the inputs and the output separately, which is the only way to tell a stale price from a broken calculation.

  • The inputs - twelve shares, an average cost of 1,705.50 and a last traded price of 1,842.15.
  • The derived values - invested of 20,466.00 and current of 22,105.80.
  • The result - a profit of 1,639.80, which is twelve times the difference between the two prices.
  • The losing position - a negative figure with a matching negative percentage badge.

Including a losing position is not padding. Sign handling is a real source of defects, and a P and L display that renders a loss as a gain is worse than one that fails to render at all.

Note

Note: Asserting the inputs, the derived values and the result in separate steps is what distinguishes a stale price from a broken calculation. Try it on TestMu AI. Try free!

The objective in plain English

The file states the arithmetic explicitly in its third step, quantity times the price delta, so anyone reading it can check the expected figure without recomputing it themselves.

---
mode: testing
url: https://my-testing-repo-main.vercel.app/zerodha-clone-app/holdings?reset=true
max_steps: 40
tags: [zerodha, fintech, portfolio]
---

# Zerodhaa Kyte 17.3: Holdings P&L

Catalog objective: open the holdings and verify the P&L maths on one position.
Key assertion: P&L equals quantity times the price delta.

## Verify the summary
Verify "Total investment" reads "₹54,711.00", "Current value" reads "₹55,483.80" and "P&L" reads "+₹772.80".

## Verify the INFY position inputs
Verify the INFY row shows a quantity of 12, an average cost of "₹1,705.50" and an LTP of "₹1,842.15".

## Verify the INFY P&L arithmetic
Verify the INFY row shows invested of "₹20,466.00", current of "₹22,105.80" and P&L of "+₹1,639.80", which is 12 × (1,842.15 − 1,705.50).

## Verify a losing position is shown as a loss
Verify the HDFCBANK row shows P&L of "₹-867.00" with a net change badge of "-2.53%".

The percentage badge on the losing position is asserted alongside the absolute figure, since a correct amount with a wrong percentage is a common formatting defect.

Assertion by assertion

From the summary down to a single position and its sign.

StepWhat it proves
Verify the summaryTotal investment, current value and overall P and L
Verify the INFY position inputsQuantity, average cost and last traded price
Verify the INFY P and L arithmeticInvested, current and profit all follow from those inputs
Verify a losing position is shown as a lossNegative values and percentages render with the correct sign

Checking the summary first and a position last means a discrepancy points at either the aggregation or the row, rather than leaving both suspect.

Next-generation test execution with TestMu AI

Putting it in CI

kane-cli testmd run tests/zerodha/holdings-pnl_test.md

Against live prices, capture the last traded price as a variable during the run and assert the P and L against that captured value.

Calculated financial displays are worth pinning to their source. The test.md format covers storing values as variables, and calling an API in the same run covers checking the price the calculation used.

Author

...

Bhawana

Blogs: 75

  • Twitter
  • Linkedin

Bhawana is a Community Evangelist at TestMu AI with over 3 years of experience creating technically accurate, strategy-driven content in software testing. She has authored 50+ blogs on test automation, cross-browser testing, mobile testing, and real device testing. She also serves as Product Marketing Manager for Kane CLI, the command-line tool that runs browser automation from the terminal using natural-language flows in a real Chrome browser. Bhawana is certified in KaneAI, Selenium, Appium, Playwright, and Cypress, reflecting her hands-on knowledge of modern automation practices. On LinkedIn, she is followed by 6000+ QA engineers, testers, AI automation testers, and tech leaders.

Add to Google preferred sources

Summarise with AI

Copied to Clipboard!
...

3000+ Browsers. One Platform.

See exactly how your site performs everywhere.

Try it free
...

Write Tests in Plain English with KaneAI

Create, debug, and evolve tests using natural language.

Try for free

Holdings P and L FAQs

Did you find this page helpful?

TestMu AI forEnterprise

Get access to solutions built on Enterprise
grade security, privacy, & compliance

  • Advanced access controls
  • Advanced data retention rules
  • Advanced Local Testing
  • Premium Support options
  • Early access to beta features
  • Private Slack Channel
  • Unlimited Manual Accessibility DevTools Tests