From 28889c51eca629b6f5c3d4e71a6be4ab50af5f3e Mon Sep 17 00:00:00 2001 From: Sean-M Date: Tue, 12 Feb 2013 09:57:47 -0500 Subject: [PATCH 1/4] Minor fix to the regression test may require reinstalling cygwin with python updates --- Testing/script/regression.py | 6 +++--- .../org/sleuthkit/autopsy/testing/RegressionTest.java | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Testing/script/regression.py b/Testing/script/regression.py index a0bb00c6ea..61c071d544 100644 --- a/Testing/script/regression.py +++ b/Testing/script/regression.py @@ -633,7 +633,7 @@ def compare_to_gold_html(): if os.path.isdir(os.path.join(os.getcwd(), case.output_dir, case.image_name, "AutopsyTestCase", "Reports", fs)): htmlfolder = fs autopsy_html_path = make_local_path(case.output_dir, case.image_name, "AutopsyTestCase", "Reports", htmlfolder) #, "AutopsyTestCase", "Reports", htmlfolder) - print autopsy_html_path + print(autopsy_html_path) try: @@ -1262,7 +1262,7 @@ def vsBuild(): vs.append("/p:configuration=release") vs.append("/p:platform=win32") vs.append("/t:rebuild") - print vs + print(vs) subprocess.call(vs) @@ -1563,4 +1563,4 @@ if __name__ == "__main__": if SYS is OS.WIN or SYS is OS.CYGWIN: main() else: - print("We only support Windows and Cygwin at this time.") \ No newline at end of file + print("We only support Windows and Cygwin at this time.") 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 fc4b85c5bd..3aa31d543b 100644 --- a/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java +++ b/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java @@ -24,6 +24,7 @@ import java.awt.Robot; import java.awt.Toolkit; import java.awt.image.BufferedImage; import java.io.File; +import java.io.FileWriter; import java.io.IOException; import java.text.DateFormat; import java.text.SimpleDateFormat; @@ -35,7 +36,6 @@ import java.util.logging.Level; import java.util.logging.Logger; import javax.imageio.ImageIO; import javax.swing.JDialog; -import javax.swing.JTabbedPane; import javax.swing.JTextField; import junit.framework.Test; import junit.framework.TestCase; @@ -116,10 +116,13 @@ public class RegressionTest extends TestCase{ logger.info("New Case"); NbDialogOperator nbdo = new NbDialogOperator("Welcome"); JButtonOperator jbo = new JButtonOperator(nbdo, 0); // the "New Case" button - jbo.clickMouse(); + jbo.push(); } - public void testNewCaseWizard() { + public void testNewCaseWizard() throws IOException { + FileWriter outp = new FileWriter("C:\\log.txt"); + outp.write("got to 124"); + outp.flush(); logger.info("New Case Wizard"); WizardOperator wo = new WizardOperator("New Case Information"); JTextFieldOperator jtfo1 = new JTextFieldOperator(wo, 1); From ac46436eebff4b06efdc75346b363d07f0b3681f Mon Sep 17 00:00:00 2001 From: Sean-M Date: Tue, 12 Feb 2013 10:25:55 -0500 Subject: [PATCH 2/4] Changed regression test It no longer creates a new thread --- .../src/org/sleuthkit/autopsy/testing/RegressionTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 3aa31d543b..9bef44669c 100644 --- a/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java +++ b/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java @@ -276,7 +276,7 @@ public class RegressionTest extends TestCase{ //new Timeout("pausing", 1000).sleep(); MainWindowOperator mwo = MainWindowOperator.getDefault(); JButtonOperator jbo = new JButtonOperator(mwo, "Generate Report"); - jbo.pushNoBlock(); + jbo.push(); new Timeout("pausing", 1000).sleep(); } From 47256dd128837c167c06a676a5f2ebc43885d513 Mon Sep 17 00:00:00 2001 From: Sean-M Date: Tue, 12 Feb 2013 13:39:39 -0500 Subject: [PATCH 3/4] minor regression test changes --- .../autopsy/testing/RegressionTest.java | 32 ++++++++++++------- 1 file changed, 20 insertions(+), 12 deletions(-) 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 9bef44669c..ee779f10a1 100644 --- a/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java +++ b/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java @@ -116,13 +116,10 @@ public class RegressionTest extends TestCase{ logger.info("New Case"); NbDialogOperator nbdo = new NbDialogOperator("Welcome"); JButtonOperator jbo = new JButtonOperator(nbdo, 0); // the "New Case" button - jbo.push(); + jbo.pushNoBlock(); } - public void testNewCaseWizard() throws IOException { - FileWriter outp = new FileWriter("C:\\log.txt"); - outp.write("got to 124"); - outp.flush(); + public void testNewCaseWizard(){ logger.info("New Case Wizard"); WizardOperator wo = new WizardOperator("New Case Information"); JTextFieldOperator jtfo1 = new JTextFieldOperator(wo, 1); @@ -276,25 +273,36 @@ public class RegressionTest extends TestCase{ //new Timeout("pausing", 1000).sleep(); MainWindowOperator mwo = MainWindowOperator.getDefault(); JButtonOperator jbo = new JButtonOperator(mwo, "Generate Report"); - jbo.push(); + jbo.pushNoBlock(); new Timeout("pausing", 1000).sleep(); } - public void testGenerateReportButton() { + public void testGenerateReportButton() throws IOException { + FileWriter outp = new FileWriter("log.txt"); + outp.write("got to 282\n"); + outp.flush(); logger.info("Generate Report Button"); - JDialog reportDialog = JDialogOperator.waitJDialog("Generate Report", false, false); + JDialog reportDialog = JDialogOperator.waitJDialog("Report", false, false); JDialogOperator reportDialogOperator = new JDialogOperator(reportDialog); - JButtonOperator jbo0 = new JButtonOperator(reportDialogOperator, "Generate Report"); + JButtonOperator jbo0 = new JButtonOperator(reportDialogOperator, "Next"); DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy-HH-mm-ss"); Date date = new Date(); String datenotime = dateFormat.format(date); - jbo0.pushNoBlock(); + jbo0.pushNoBlock(); + outp.write("got to 292\n"); + outp.flush(); + JDialog reportDialog1 = JDialogOperator.waitJDialog("HTML", false, false); + outp.write("got to 295\n"); + outp.flush(); + JDialogOperator reportDialogOperator1 = new JDialogOperator(reportDialog1); + JButtonOperator jbo1 = new JButtonOperator(reportDialogOperator1, "Finish"); + jbo1.pushNoBlock(); new Timeout("pausing", 3000).sleep(); // Give it a few seconds to generate screenshot("Finished Report"); JDialog previewDialog = JDialogOperator.waitJDialog("Report Preview", false, false); JDialogOperator previewDialogOperator = new JDialogOperator(previewDialog); - JButtonOperator jbo1 = new JButtonOperator(previewDialogOperator, "Close"); - jbo1.pushNoBlock(); + JButtonOperator jbo2 = new JButtonOperator(previewDialogOperator, "Close"); + jbo2.pushNoBlock(); new Timeout("pausing", 3000).sleep(); // Give the program a second to idle to be safe System.setProperty("ReportStr", datenotime); screenshot("Done Testing"); From bfba3dbe18a93429802fac496a453a53b6d6e8b4 Mon Sep 17 00:00:00 2001 From: Sean-M Date: Tue, 12 Feb 2013 14:36:29 -0500 Subject: [PATCH 4/4] Updated regression test, now will check reports --- Testing/script/regression.py | 7 +++---- .../autopsy/testing/RegressionTest.java | 20 ++++++------------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/Testing/script/regression.py b/Testing/script/regression.py index 61c071d544..4aa91809af 100644 --- a/Testing/script/regression.py +++ b/Testing/script/regression.py @@ -397,7 +397,7 @@ def run_config_test(config_file): # Runs the test on the single given file. # The path must be guarenteed to be a correct path. def run_test(image_file, count): - if not image_type(image_file) != IMGTYPE.UNKNOWN: + if image_type(image_file) == IMGTYPE.UNKNOWN: printerror("Error: Image type is unrecognized:") printerror(image_file + "\n") return @@ -627,18 +627,17 @@ def compare_to_gold_db(): # Using the global case's variables, compare the html report file made by # the regression test against the gold standard html report def compare_to_gold_html(): - gold_html_file = make_local_path(case.gold, case.image_name, "index.html") + gold_html_file = make_local_path(case.gold, case.image_name, "Report", "index.html") htmlfolder = "" for fs in os.listdir(os.path.join(os.getcwd(),case.output_dir, case.image_name, "AutopsyTestCase", "Reports")): if os.path.isdir(os.path.join(os.getcwd(), case.output_dir, case.image_name, "AutopsyTestCase", "Reports", fs)): htmlfolder = fs - autopsy_html_path = make_local_path(case.output_dir, case.image_name, "AutopsyTestCase", "Reports", htmlfolder) #, "AutopsyTestCase", "Reports", htmlfolder) + autopsy_html_path = make_local_path(case.output_dir, case.image_name, "AutopsyTestCase", "Reports", htmlfolder, "HTML Report") #, "AutopsyTestCase", "Reports", htmlfolder) print(autopsy_html_path) try: autopsy_html_file = get_file_in_dir(autopsy_html_path, "index.html") - if not file_exists(gold_html_file): printerror("Error: No gold html report exists at:") printerror(gold_html_file + "\n") 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 ee779f10a1..3746f52abb 100644 --- a/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java +++ b/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java @@ -278,28 +278,20 @@ public class RegressionTest extends TestCase{ } public void testGenerateReportButton() throws IOException { - FileWriter outp = new FileWriter("log.txt"); - outp.write("got to 282\n"); - outp.flush(); logger.info("Generate Report Button"); - JDialog reportDialog = JDialogOperator.waitJDialog("Report", false, false); + JDialog reportDialog = JDialogOperator.waitJDialog("Generate Report", false, false); JDialogOperator reportDialogOperator = new JDialogOperator(reportDialog); JButtonOperator jbo0 = new JButtonOperator(reportDialogOperator, "Next"); DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy-HH-mm-ss"); Date date = new Date(); String datenotime = dateFormat.format(date); jbo0.pushNoBlock(); - outp.write("got to 292\n"); - outp.flush(); - JDialog reportDialog1 = JDialogOperator.waitJDialog("HTML", false, false); - outp.write("got to 295\n"); - outp.flush(); - JDialogOperator reportDialogOperator1 = new JDialogOperator(reportDialog1); - JButtonOperator jbo1 = new JButtonOperator(reportDialogOperator1, "Finish"); + new Timeout("pausing", 1000).sleep(); + JButtonOperator jbo1 = new JButtonOperator(reportDialogOperator, "Finish"); jbo1.pushNoBlock(); - new Timeout("pausing", 3000).sleep(); // Give it a few seconds to generate - screenshot("Finished Report"); - JDialog previewDialog = JDialogOperator.waitJDialog("Report Preview", false, false); + new Timeout("pausing", 8000).sleep(); // Give it a few seconds to generate + screenshot("Progress"); + JDialog previewDialog = JDialogOperator.waitJDialog("Progress", false, false); JDialogOperator previewDialogOperator = new JDialogOperator(previewDialog); JButtonOperator jbo2 = new JButtonOperator(previewDialogOperator, "Close"); jbo2.pushNoBlock();