Introduction
Autopsy has both functional and unit tests for the Core and KeywordSearch NBMs. These tests can be run at the NBM, package or file level via Netbeans or Apache Ant. The following sections will demonstrate how to run at each of these granularities with both Netbeans and Apache Ant.
Running Tests by NBM
- In Netbeans, right click the Autopsy-Core or Keyword Search NBM and click Test. This will run both the unit and functional tests.
- Run this ant command from within your autopsy directory. Replace {$NBM} with either KeywordSearch or Core.
- $ ant -f {$NBM} test
e.g. ant -f Core test
An internet connection may be required the first time the Autopsy Core tests are run. The ant target will attempt to reach out to Google Drive to download the required test data. This data is stored in autopsy\Core\test\qa-functional\data. In the event that tests are failing due to missing test data, manually run the “getTestDataFiles” target from the Core/build.xml script.
Running Tests by Package
- In Netbeans, right click the package and click Test. Unit and Functional tests are separated into their own packages.
- Run this ant command from within the autopsy directory. Replace {$PACKAGE_NAME} with the name of the test package and {$NBM} with either KeywordSearch or Core.
- $ ant -f {$NBM} -Dtest.includes=org/sleuthkit/autopsy/{$PACKAGE_NAME}/**/*Test.java test-single
e.g. ant -f Core -Dtest.includes=org/sleuthkit/autopsy/ingest/**/*Test.java test-single
Running Tests by File
- In Netbeans, right click the File and click “Test File”.
- Run this ant command from within the autopsy directory. Replace {$TEST_NAME} with the name of the .java file, {$NBM} with either KeywordSearch or Core and {$PACKAGE_NAME} with the name of the test package.
- $ ant -f {$NBM} -Dtest.includes=org/sleuthkit/autopsy/{$PACKAGE_NAME}/{$TEST_NAME} test-single
e.g. ant -f KeywordSearch -Dtest.includes=org/sleuthkit/autopsy/keywordsearch/CreditCardValidatorTest.java test-single