A test of lepton universality, performed by measuring the ratio of the branching fractions of the $B^{0} rightarrow K^{*0}mu^{+}mu^{-}$ and $B^{0} rightarrow K^{*0}e^{+}e^{-}$ decays, $R_{K^{*0}}$, is presented. The $K^{*0}$ meson is reconstructed in the final state $K^{+}pi^{-}$, which is required to have an invariant mass within 100$mathrm{,MeV}c^2$ of the known $K^{*}(892)^{0}$ mass. The analysis is performed using proton-proton collision data, corresponding to an integrated luminosity of about 3$mathrm{,fb}^{-1}$, collected by the LHCb experiment at centre-of-mass energies of 7 and 8$mathrm{,TeV}$. The ratio is measured in two regions of the dilepton invariant mass squared, $q^{2}$, to be begin{eqnarray*} R_{K^{*0}} = begin{cases} 0.66~^{+~0.11}_{-~0.07}mathrm{,(stat)} pm 0.03mathrm{,(syst)} & textrm{for } 0.045 < q^{2} < 1.1~mathrm{,GeV^2}c^4 , , 0.69~^{+~0.11}_{-~0.07}mathrm{,(stat)} pm 0.05mathrm{,(syst)} & textrm{for } 1.1phantom{00} < q^{2} < 6.0~mathrm{,GeV^2}c^4 , . end{cases} end{eqnarray*} The corresponding 95.4% confidence level intervals are $[0.52, 0.89]$ and $[0.53, 0.94]$. The results, which represent the most precise measurements of $R_{K^{*0}}$ to date, are compatible with the Standard Model expectations at the level of 2.1--2.3 and 2.4--2.5 standard deviations in the two $q^{2}$ regions, respectively.