Joint stress testing of net interest income, interest rate risk, and profit and loss (P&L) related to behavioral risks on a multi-horizon scenario path poses great challenges in stress testing the business and the attribution of risk to profit. We propose a framework for calculating stressed net interest income at a granular level and allocating profit and loss risk. The proposed framework can take into account the impact of interest rate risk on net interest income and the impact of behavioral risks on profit and loss, for example, prepayments and credit defaults , as well as any drawdowns on facilities and deposits at each horizon in a given scenario. path. Our net interest income framework uses the concept of maturities-matched assets and liabilities to synthetically separate lending risks from strategic treasury funding risks. It greatly simplifies joint stress testing of market risk and credit risk by focusing, on the asset side, on the net interest income of assets relative to maturing liabilities and, on the of cash, on the cash flows of assets with maturities matching the actual liabilities. In this framework, it is not necessary to generate exact cash flows on the asset side. The resulting net interest income process can be applied to both loan-level models and homogeneous loan pools. We illustrate the framework with conditional default and prepayment rate models as well as loan-level state transition models.