This paper employs the methodology of Wilson (1997) on Hungarian data to conduct a macro stress test in relation to banks' corporate loan portfolio. First, sector specific models of bankruptcy are estimated, where the bankruptcy frequency is linked to the general health of the economy. Data on bankruptcy filings in Hungary between 1995 and 2005 are used. Then, after identifying relevant shocks, the estimated models are employed in Monte Carlo simulation to conduct a stress test on the Hungarian banking sector. Various loss measures are defined to quantify the impact of shocks and evaluate the resilience of the Hungarian banking sector. The sensitivity of the stress test results to the endogeneity of LGD and the prevailing macro environment are also examined.