To be able to run the tests, two VM properties need to be present: -Dsnap.reader.tests.execute=true This property enables the acceptance test runner. If not set, all tests are skipped and a message is printed to the console window. -Dsnap.reader.tests.data.dir=<Path_To_Data> This property defines the root directory for the test dataset. All test-product definitions are referenced relative to this root directory. If the property is not set or does not denote a valid directory, the test setup fails. -Dsnap.reader.tests.failOnMissingData=false By default the reader tests fail if test data is missing. This property can be set to false to avoid this. It is helpful for developer if they don't have the complete test data set on their developer machine. -Dsnap.reader.tests.failOnMultipleIntendedReaders=false By default the reader tests fail if there is more then one reader intended for one file. This property can be set to false to avoid this. -Dsnap.reader.tests.log.file=<Path_To_LogFile> Specifies the path the log file shall be written to. If not given no log file will be created. -Dsnap.reader.tests.class.name=<ProductReaderPlugIn_ClassName> If the ProductReaderPlugIn class name is given only test for the reader plugin are executed. It is also possible to indicate the package of the reader plugins: for example, if <ProductReaderPlugIn_ClassName> is "org.esa.s3tbx.dataio.landsat", the tests for all the landsat reader plugins will be executed. A number of files must be provided in the resource directory of the reader module. They must be placed in the same package as the implemented plugin. The files must follow this naming convention: where <PRODUCT-ID> must match the product identifier that is defined within the *-data.json file. Example for Landsat: Plugin is The files must be located in Within the data file the test products are defined. Each definition consists of an id, a relative Path (see How to run and create a Reader Test) and a description (see class org.esa.snap.dataio.TestProduct). Within the product-id file the expected content of each product is defined (see class org.esa.snap.dataio.ExpectedContent). There are two different approaches for executing the reader tests: execute them when building the reader or execute them with the snap-reader-test project. In the first case, the dependency to the snap-reader-test project has to be added to the list of the reader dependencies. With the other approach, the dependency to the reader must be added to the dependency list of the snap-reader-tests module. Attention Remember to install the reader module to your local maven repository after you have made changes. The dependencies used by the snap-reader-tests link to installed jars. If not installed the old code will be used for the new test. For external reader acceptance tests (like SMOS-Box, SeaDAS), you need to implement a test class extending 'org.esa.snap.dataio.ProductReaderAcceptanceTest', leaving its implementation empty. Just to have something which can be started start. In the dependency list of the external module the 'test-jar' type of the snap-reader-tests dependency must be added. It is possible to add the snap-reader-tests as a new plugin in SNAP. Once installed, an option in the menu will be available in order to generate the expected content: It will generate the expected content by selecting randomly some pixel values for every band, metadata fields... If some pins have been selected in the product, then the pixel values will be collected in this points.
The SNAP product reader test is located in the snap-reader tests project (since v2.0).Run Configuration
Creating New Reader Test
<READER_PLUGIN_NAME>-data.json
<PRODUCT-ID>.json
org.esa.snap.dataio.landsat.geotiff.LandsatGeotiffReaderPlugin.
\src\main\resources\org\esa\snap\dataio\landsat\geotiff\LandsatGeotiffReaderPlugin-data.json
\src\main\resources\org\esa\snap\dataio\landsat\geotiff\L71191027_02720070313.json
Defining the dependencies
<dependency>
<groupId>org.esa.snap</groupId>
<artifactId>snap-reader-tests</artifactId>
<version>${snap.version}</version>
</dependency>
<dependency>
<groupId>org.esa.snap</groupId>
<artifactId>snap-reader-tests</artifactId>
<type>test-jar</type>
<scope>test</scope>
<version>${snap.version}</version>
</dependency>
Create the expected content
Manage space
Manage content
Integrations