We present the results of high quality long-slit spectroscopy of planetary nebulae ( PNe ) and H ii regions in the two dwarf irregular galaxies Sextans A and B , which belong to a small group of galaxies just outside the Local Group . The observations were obtained with the ESO New Technology Telescope ( NTT ) multi-mode instrument ( EMMI ) . In Sextans A we obtained the element abundances in its only known PN and in three H ii regions with the classical T _ { e } method . The oxygen abundances in these three H ii regions of Sextans A are all consistent within the individual rms uncertainties , with the average 12+ \log ( O/H ) = 7.54 \pm 0.06 . The oxygen abundance of the PN in Sextans A is , however , significantly higher : 12+ \log ( O/H ) = 8.02 \pm 0.05 . This PN is even more enriched in nitrogen and helium , suggesting a classification as a PN of Type I . The PN abundances of S and Ar , which are presumably unaffected by nucleosynthesis in the progenitor star , are well below those in the H ii regions , indicating lower metallicity at the epoch of the PN progenitor formation ( \sim 1.5 Gyr ago , according to our estimates based on the PN parameters ) . In Sextans B we obtained spectra of one PN and six H ii regions . Element abundances with the T _ { e } method could be derived for the PN and three of the H ii regions . For two of these H ii regions , which have a separation of only \sim 70 pc in projection , the oxygen abundances do not differ within the rms uncertainties , with a mean of 12+ \log ( O/H ) = 7.53 \pm 0.05 . The third H ii region , which is about 0.6 kpc northeast from the former two , is twice as metal-rich , with 12+ \log ( O/H ) = 7.84 \pm 0.05 . This suggests considerable inhomogeneity in the present-day metallicity distribution in Sextans B . Whether this implies a general chemical inhomogeneity among populations of comparable age in Sextans B , and thus a metallicity spread at a given age , or whether we happen to see the short-lived effects of freshly ejected nucleosynthesis products prior to their dispersal and mixing with the ambient interstellar medium will require further study . For the PN we measured an O/H ratio of 12+ \log ( O/H ) =7.47 \pm 0.16 , consistent with that of the low-metallicity H ii regions . We discuss the new metallicity data for the H ii regions and PNe in the context of the published star formation histories and published abundances of the two dwarf irregular ( dIrr ) galaxies . Both dIrrs show generally similar star formation histories in the sense of continuous star formation with amplitude variations , but differ in their detailed enrichment time scales and star formation rates as a function of time . If we combine the photometrically derived estimates for the mean metallicity of the old red giant branch population in both dIrrs with the present-day metallicity of the H ii regions , both dIrrs have experienced chemical enrichment by at least 0.8 dex ( lower limit ) throughout their history .