Merge pull request #196 from Smoss/master

More updates to the regression test.
This commit is contained in:
adam 2013-05-24 12:47:56 -07:00
commit d17c678e03
5 changed files with 28 additions and 19 deletions

View File

@ -93,12 +93,12 @@ public class RegressionTest extends TestCase{
enableModules(".*");
conf = conf.addTest("testNewCaseWizardOpen",
"testNewCaseWizard",
"testStartAddImage",
"testStartAddDataSource",
"testConfigureIngest1",
"testConfigureHash",
"testConfigureIngest2",
"testConfigureSearch",
"testAddImageWizard1",
"testAddSourceWizard1",
"testIngest",
"testGenerateReportToolbar",
"testGenerateReportButton"
@ -143,17 +143,17 @@ public class RegressionTest extends TestCase{
wo.btFinish().clickMouse();
}
public void testStartAddImage() {
public void testStartAddDataSource() {
logger.info("Starting Add Image process");
WizardOperator wo = new WizardOperator("Add Image");
WizardOperator wo = new WizardOperator("Add Data");
JTextFieldOperator jtfo0 = new JTextFieldOperator(wo, 0);
String imageDir = System.getProperty("img_path");
((JTextField)jtfo0.getSource()).setText(imageDir);
wo.btNext().clickMouse();
}
public void testAddImageWizard1() {
WizardOperator wo = new WizardOperator("Add Image");
public void testAddSourceWizard1() {
WizardOperator wo = new WizardOperator("Add Data");
while(!wo.btFinish().isEnabled()) {
new Timeout("pausing", 1000).sleep(); // give it a second (or five) to process
}
@ -163,7 +163,7 @@ public class RegressionTest extends TestCase{
public void testConfigureIngest1() {
logger.info("Ingest 1");
WizardOperator wo = new WizardOperator("Add Image");
WizardOperator wo = new WizardOperator("Add Data");
JTableOperator jto = new JTableOperator(wo, 0);
int row = jto.findCellRow("Hash Lookup", 1, 0);
jto.clickOnCell(row, 1);
@ -203,7 +203,7 @@ public class RegressionTest extends TestCase{
public void testConfigureIngest2() {
logger.info("Ingest 2");
WizardOperator wo = new WizardOperator("Add Image");
WizardOperator wo = new WizardOperator("Add Data");
JTableOperator jto = new JTableOperator(wo, 0);
int row = jto.findCellRow("Keyword Search", 1, 0);
jto.clickOnCell(row, 1);
@ -239,7 +239,7 @@ public class RegressionTest extends TestCase{
}
JButtonOperator jbo2 = new JButtonOperator(jdo, "OK", 0);
jbo2.pushNoBlock();
WizardOperator wo = new WizardOperator("Add Image");
WizardOperator wo = new WizardOperator("Add Data");
JCheckBoxOperator jbco0 = new JCheckBoxOperator(wo, "Process Unallocated Space");
if(Boolean.parseBoolean(System.getProperty("ignore_unalloc"))) {
jbco0.doClick();

View File

@ -23,10 +23,12 @@ def send_email(parsed, errorem, attachl, passFail):
serverval = element.getAttribute("value").encode().decode("utf_8")
# Create the container (outer) email message.
msg = MIMEMultipart()
element = parsed.getElementsByTagName("subject")[0]
subval = element.getAttribute("value").encode().decode("utf_8")
if(passFail):
msg['Subject'] = '[Test]Autopsy test passed.'
msg['Subject'] = '[Test]Autopsy ' + subval + ' test passed.'
else:
msg['Subject'] = '[Test]Autopsy test failed.'
msg['Subject'] = '[Test]Autopsy ' + subval + ' test failed.'
# me == the sender's email address
# family = the list of all recipients' email addresses
msg['From'] = 'AutopsyTest'

View File

@ -194,6 +194,8 @@ class TestAutopsy:
self.sorted_data_file = ""
self.gold_dbdump = ""
self.autopsy_dbdump = ""
self.artifact_count = 0
self.artifact_fail = 0
# Infinite Testing info
timer = 0
@ -396,9 +398,12 @@ class Database:
def retrieve_data(data_file, autopsy_con,autopsy_db_file):
autopsy_cur2 = autopsy_con.cursor()
global errorem
autopsy_cur2.execute("SELECT tsk_files.parent_path, tsk_files.name, blackboard_artifact_types.display_name, blackboard_artifacts.artifact_id FROM blackboard_artifact_types INNER JOIN blackboard_artifacts ON blackboard_artifact_types.artifact_type_id = blackboard_artifacts.artifact_type_id INNER JOIN tsk_files ON tsk_files.obj_id = blackboard_artifacts.obj_id")
database_log = codecs.open(data_file, "wb", "utf_8")
rw = autopsy_cur2.fetchone()
case.artifact_count = 0
case.artifact_fail = 0
appnd = False
counter = 0
try:
@ -409,6 +414,7 @@ def retrieve_data(data_file, autopsy_con,autopsy_db_file):
database_log.write(rw[1] + ' <artifact type = "' + rw[2] + '" > ')
autopsy_cur1 = autopsy_con.cursor()
looptry = True
case.artifact_count += 1
try:
key = ""
key = str(rw[3])
@ -418,7 +424,9 @@ def retrieve_data(data_file, autopsy_con,autopsy_db_file):
except Exception as e:
print(str(e))
print(str(rw[3]))
errorem += "Artifact with id#" + str(rw[3]) + " encountered an error.\n"
looptry = False
case.artifact_fail += 1
pass
if(looptry == True):
src = attributes[0][0]
@ -464,6 +472,7 @@ def retrieve_data(data_file, autopsy_con,autopsy_db_file):
rw = autopsy_cur2.fetchone()
except Exception as e:
print('outer exception: ' + str(e))
errorem += "There were " + str(case.artifact_count) + " artifacts for " + case.image_name + " and " + str(case.artifact_fail) + " of them were unusable.\n"
def dbDump():
autopsy_db_file = Emailer.make_path(case.output_dir, case.image_name,
@ -648,7 +657,7 @@ def run_test(image_file, count):
if(not file_exists(img_archive)):
img_archive = Emailer.make_path(case.gold_parse, case.image_name+"-archive.zip")
gold_path = case.gold_parse
img_gold = Emailer.make_path(gold_path, case.image_name)
img_gold = Emailer.make_path(gold_path, "tmp", case.image_name)
extrctr = zipfile.ZipFile(img_archive, 'r', compression=zipfile.ZIP_DEFLATED)
extrctr.extractall(gold_path)
extrctr.close
@ -1828,21 +1837,19 @@ def execute_test():
logres = search_common_log("TskCoreException")
if (len(logres)>0):
failedbool = True
global imgfail
imgfail = True
global errorem
errorem += "Autopsy Nightly test failed.\n"
passFail = False
for lm in logres:
errorem += lm
html.close()
if failedbool:
passFail = False
errorem += "The test output didn't match the gold standard.\n"
errorem += "Autopsy test failed.\n"
attachl.append(case.common_log_path)
attachl.insert(0, html.name)
else:
errorem = ""
errorem += "Autopsy Nightly test passed.\n"
errorem += "Autopsy test passed.\n"
passFail = True
attachl = []
if not args.gold_creation:
@ -1872,7 +1879,7 @@ def main():
daycount = 0
failedbool = False
redo = False
errorem = "The test standard didn't match the gold standard.\n"
errorem = ""
case = TestAutopsy()
database = Database()
printout("")

View File

@ -50,10 +50,10 @@ def compile(errore, attachli, parsedin):
errorem = "The test standard didn't match the gold standard.\n"
failedbool = False
if(tryredo):
errorem = ""
errorem += "Rebuilt properly.\n"
Emailer.send_email(parsed, errorem, attachl, True)
attachl = []
errorem = "The test standard didn't match the gold standard.\n"
passed = True
#Pulls from git