Closed jorainer closed 2 years ago
If there are no major objections (@lgatto ) I would merge that PR. I think this testing framework might be really helpful for MsBackend
developers to ensure the implemented backend is compliant with what we expect/require from a MsBackend
.
All changes from @sgibb applied - thanks for the review!
I see it from a practical point of view. Spectra
provides a infrastructure for MS data (similar to GRanges
for genomics). I think we should allow users to change whatever variables they want to change. You have also to consider that Spectra
are not always read from raw MS files - in many cases you want to manually create a Spectra
object and fill/change its content.
This PR bases heavily on the excellent work from @sneumann and @hechth (PR #224) and adds a test suite folder with unit tests checking all methods to access and set spectra variables in a
MsBackend
object.Backend developers can call the test suite to check if their backend is compatible with the expectations. The example below (from the
MsBackendMgf
package) shows how these tests can be included by adding the code below to the package's"testthat.R"
file:Thus, the backend to be tested needs to be created, initialized and assigned to a variable named
be
. Then, the respective test suite from theSpectra
package is called. Importantly, it is required to setstop_on_failure = TRUE
since otherwise the unit tests might silently fail and not be reported.