diff --git a/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java b/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java index d544648ccf..88b01a0fe3 100755 --- a/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java +++ b/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java @@ -29,6 +29,7 @@ import java.io.IOException; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.nio.file.Files; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.ArrayList; @@ -50,8 +51,8 @@ import org.netbeans.jellytools.WizardOperator; import org.netbeans.jemmy.Timeout; import org.netbeans.jemmy.Timeouts; import org.netbeans.jemmy.operators.JButtonOperator; -import org.netbeans.jemmy.operators.JListOperator; import org.netbeans.jemmy.operators.JCheckBoxOperator; +import org.netbeans.jemmy.operators.JComboBoxOperator; import org.netbeans.jemmy.operators.JDialogOperator; import org.netbeans.jemmy.operators.JFileChooserOperator; import org.netbeans.jemmy.operators.JLabelOperator; @@ -80,6 +81,7 @@ public class RegressionTest extends TestCase { private static final Logger logger = Logger.getLogger(RegressionTest.class.getName()); long start; + private static final File img_path = new File(System.getProperty("img_path")); /** * Constructor required by JUnit @@ -96,17 +98,34 @@ public class RegressionTest extends TestCase { NbModuleSuite.Configuration conf = NbModuleSuite.createConfiguration(RegressionTest.class). clusters(".*"). enableModules(".*"); - conf = conf.addTest("testNewCaseWizardOpen", - "testNewCaseWizard", - "testStartAddDataSource", - "testConfigureIngest1", - "testConfigureHash", - "testConfigureIngest2", - "testConfigureSearch", - "testAddSourceWizard1", - "testIngest", - "testGenerateReportToolbar", - "testGenerateReportButton"); + if (img_path.isFile()) { + conf = conf.addTest("testNewCaseWizardOpen", + "testNewCaseWizard", + "testStartAddImageFileDataSource", + "testConfigureIngest1", + "testConfigureHash", + "testConfigureIngest2", + "testConfigureSearch", + "testAddSourceWizard1", + "testIngest", + "testGenerateReportToolbar", + "testGenerateReportButton"); + } + + if (img_path.isDirectory()) { + conf = conf.addTest("testNewCaseWizardOpen", + "testNewCaseWizard", + "testStartAddLogicalFilesDataSource", + "testConfigureIngest1", + "testConfigureHash", + "testConfigureIngest2", + "testConfigureSearch", + "testAddSourceWizard1", + "testIngest", + "testGenerateReportToolbar", + "testGenerateReportButton"); + } + return NbModuleSuite.create(conf); @@ -152,7 +171,7 @@ public class RegressionTest extends TestCase { wo.btFinish().clickMouse(); } - public void testStartAddDataSource() { + public void testStartAddImageFileDataSource() { logger.info("Starting Add Image process"); WizardOperator wo = new WizardOperator("Add Data"); JTextFieldOperator jtfo0 = new JTextFieldOperator(wo, 0); @@ -165,6 +184,22 @@ public class RegressionTest extends TestCase { wo.btNext().clickMouse(); } + public void testStartAddLogicalFilesDataSource() { + logger.info("Starting Add Logical Files process"); + WizardOperator wo = new WizardOperator("Add Data"); + JComboBoxOperator comboBoxOperator = new JComboBoxOperator(wo); + // select the item indexed 2 (Logical Files) from the drop-down list. + comboBoxOperator.selectItem(2); + JButtonOperator addButtonOperator = new JButtonOperator(wo, "Add"); + addButtonOperator.pushNoBlock(); + JFileChooserOperator fileChooserOperator = new JFileChooserOperator(); + fileChooserOperator.setCurrentDirectory(img_path); + // set the current directory one level above the directory containing logicalFileSet folder. + fileChooserOperator.goUpLevel(); + fileChooserOperator.chooseFile(img_path.getName()); + wo.btNext().clickMouse(); + } + public void testAddSourceWizard1() { WizardOperator wo = new WizardOperator("Add Data"); while (!wo.btFinish().isEnabled()) { diff --git a/test/script/regression.py b/test/script/regression.py index c0fb8554f2..6ff4a62a84 100755 --- a/test/script/regression.py +++ b/test/script/regression.py @@ -743,11 +743,11 @@ class TestConfiguration(object): self.build_path = build_path def _init_imgs(self, parsed_config): - """Initialize the list of images to run tests on.""" + """Initialize the list of images to run tests on. Logical file set also included.""" for element in parsed_config.getElementsByTagName("image"): value = element.getAttribute("value").encode().decode("utf_8") print ("Image in Config File: " + value) - if file_exists(value): + if file_exists(value) or dir_exists(value): self.images.append(value) else: msg = "File: " + value + " doesn't exist" diff --git a/test/script/regression_utils.py b/test/script/regression_utils.py old mode 100644 new mode 100755 index 53f10da281..e14f86876a --- a/test/script/regression_utils.py +++ b/test/script/regression_utils.py @@ -71,6 +71,8 @@ def required_input_file(name): return False def image_type(image_file): + if (dir_exists(image_file)): + return IMGTYPE.LOGICAL ext_start = image_file.rfind(".") if (ext_start == -1): return IMGTYPE.UNKNOWN @@ -86,12 +88,15 @@ def image_type(image_file): # Returns the type of image file, based off extension class IMGTYPE: - RAW, ENCASE, SPLIT, UNKNOWN = range(4) + RAW, ENCASE, SPLIT, LOGICAL, UNKNOWN = range(5) def get_image_name(image_file): path_end = image_file.rfind("/") path_end2 = image_file.rfind("\\") ext_start = image_file.rfind(".") + if (image_type(image_file) == IMGTYPE.LOGICAL): + name = image_file[path_end2+1:] + return name if(ext_start == -1): name = image_file if(path_end2 != -1):