Skip to content

Testing

Sivasurya Santhanam edited this page Jun 21, 2018 · 6 revisions

Solr Instance for Testing

For testing the Data Import project there is a "mocked" Solr Server in the directory {workspace_loc}/knowledgefinder-dataimport/utils/src/test-files/solr and a "mocked" Solr Index in the directory {workspace_loc}/knowledgefinder-dataimport/utils/src/test-files/solr/collection1

Using this "mocked" Solr you don´t need a running Solr for testing your Transformers, DataImportHandler, …​ and all the classes which need a Solr instance or a Solr index.

Running test with maven

  • Command line:

    cd ./knowledgefinder-dataimport/utils/
    mvn clean test

If Maven runs out of memory set the environment variable MAVEN_OPTS e. g. to -Xmx512m.

  • Eclipse: 

    • Add new Maven Run Configuration with base directory ${workspace_loc:/knowledgefinder-dataimport/utils}, goal `clean test `to test the data import project.

Modify Data for Testing

In order to verify if the changes you made are actually working you sometimes have to create or modify the metadata of DataFinder, i. e. the attributes saved as SVN properties.

  • You check out data and configure your index

  • Then you can modify or add attributes with svn propedit of the svn property datafinder:json

  • Build the index again

If you comit the repository, be aware that changes of properties in the SVN repository may have consequences for other developers. So first make sure your work does not interfere with others. At least when in doubt communicate your planned activities with the other developers.

Getting test coverage

You can create coverage reports by executing the maven goal "cobertura:cobertura". The reports will be written in the directory target/site/cobertura of the project in which you have executed the goal.

Clone this wiki locally