changeset 548:34a7d51b30f5

Simplifying the testcases output in JSToJSet and JSToJGet reproducers.
author Jana Fabrikova <jfabriko@redhat.com>
date Wed, 31 Oct 2012 17:07:58 +0100
parents 9327b9bd2d37
children b76eaadf30cc
files ChangeLog tests/reproducers/simple/JSToJGet/testcases/JSToJGetTest.java tests/reproducers/simple/JSToJSet/testcases/JSToJSetTest.java
diffstat 3 files changed, 32 insertions(+), 27 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Oct 29 15:07:56 2012 -0400
+++ b/ChangeLog	Wed Oct 31 17:07:58 2012 +0100
@@ -1,3 +1,10 @@
+2012-10-31 Jana Fabrikova <jfabriko@redhat.com>
+
+	*tests/reproducers/simple/JSToJGet/testcases/JSToJGetTest.java:
+	Modifying the testcase output to a simpler text.
+	*tests/reproducers/simple/JSToJSet/testcases/JSToJSetTest.java:
+	Modifying the testcase output to a simpler text.
+
 2012-10-29  Omair Majid  <omajid@redhat.com>
 
 	* tests/reproducers/signed/DeploymentPropertiesAreExposed/resources/DeploymentPropertiesAreExposed.jnlp,
--- a/tests/reproducers/simple/JSToJGet/testcases/JSToJGetTest.java	Mon Oct 29 15:07:56 2012 -0400
+++ b/tests/reproducers/simple/JSToJGet/testcases/JSToJGetTest.java	Wed Oct 31 17:07:58 2012 +0100
@@ -74,12 +74,12 @@
 
     private void evaluateStdoutContents(String testStr, ProcessResult pr) {
         // Assert that the applet was initialized.
-        Assert.assertTrue("JSToJGetTest stdout should contain \"" + initStr
-                + "\" but it didn't.", pr.stdout.contains(initStr));
+        Assert.assertTrue("JSToJGetTest stdout should contain " + initStr
+                + " but it didnt.", pr.stdout.contains(initStr));
 
         // Assert that the applet was set up for the GM tests.
-        Assert.assertTrue("JSToJGetTest stdout should contain \"" + setupStr
-                + "\" but it didn't.", pr.stdout.contains(setupStr));
+        Assert.assertTrue("JSToJGetTest stdout should contain " + setupStr
+                + " but it didnt.", pr.stdout.contains(setupStr));
 
         // Assert that the tests have passed.
         String s0 = testStr + passStr;
@@ -99,26 +99,24 @@
         }
 
         String failStr = "JSToJGet " + testStr
-                + ": \"passed\" not found in the applet stdout, which is: "
-                + pr.stdout.substring(indBegin, pr.stdout.length());
+                + ": passed not found in the applet stdout.";
 
         if (ind1 != -1) {
             // int inde = pr.stdout.indexOf(expStr);
             // int indf = pr.stdout.indexOf(foundStr);
-            int indend = pr.stdout.indexOf(endStr);
-            failStr = pr.stdout.substring(ind1, indend + endStr.length());
+            // int indend = pr.stdout.indexOf(endStr);
+            failStr = "JSToJGet: value mismatch in "+testStr;
         }
 
         if (ind2 != -1) {
             // int inde = pr.stdout.indexOf(expStr);
             // int indf = pr.stdout.indexOf(foundStr);
-            int indend = pr.stdout.indexOf(endStr);
-            failStr = pr.stdout.substring(ind2, indend + endStr.length());
+            // int indend = pr.stdout.indexOf(endStr);
+            failStr = "JSToJGet: type mismatch in "+testStr;
         }
 
         if (ind3 != -1) {
-            failStr = "JSToJGet: " + testStr
-                    + pr.stdout.substring(ind3, pr.stdout.length());
+            failStr = "JSToJGet: an error occured during " + testStr;
         }
 
         Assert.assertTrue(failStr, (ind3 == -1));// no error on Java side
--- a/tests/reproducers/simple/JSToJSet/testcases/JSToJSetTest.java	Mon Oct 29 15:07:56 2012 -0400
+++ b/tests/reproducers/simple/JSToJSet/testcases/JSToJSetTest.java	Wed Oct 31 17:07:58 2012 +0100
@@ -66,12 +66,12 @@
     
     private void evaluateStdoutContents(String expectedStdout, ProcessResult pr) {
         // Assert that the applet was initialized.
-        Assert.assertTrue("JSToJSetTest stdout should contain \"" + initStr
-                + "\" but it didn't.", pr.stdout.contains(initStr));
+        Assert.assertTrue("JSToJSet: the stdout should contain " + initStr
+                + ", but it didnt.", pr.stdout.contains(initStr));
 
         // Assert that the values set by JavaScript are ok
-        Assert.assertTrue("The output should include: "+expectedStdout+", but is: "+pr.stdout,
-                pr.stdout.contains(expectedStdout));
+        Assert.assertTrue("JSToJSet: the output should include: "+expectedStdout+", but it didnt.",
+        		pr.stdout.contains(expectedStdout));
 
     }
 
@@ -83,23 +83,23 @@
     }
     
     private void jsToJavaSetSpecialTest(String fieldStr, String valueStr, int testType) throws Exception {
-        String strURL = "/JSToJSet.html?";
-        String expectedStdout = "";
-        switch( testType ){
+    	String strURL = "/JSToJSet.html?";
+    	String expectedStdout = "";
+    	switch( testType ){
         case 0://array element
-            strURL += fieldStr + ";" + valueStr;
-            expectedStdout = "New array value is: "+valueStr;
+        	strURL += fieldStr + ";" + valueStr;
+        	expectedStdout = "New array value is: "+valueStr;
             break;
         case 1://whole array, set 1st element
-            strURL += fieldStr + ";[" + valueStr;
-            expectedStdout = "New array value is: "+valueStr;
-            break;
+        	strURL += fieldStr + ";[" + valueStr;
+        	expectedStdout = "New array value is: "+valueStr;
+    		break;
         case 2://char et al - to be set at JS side
-            strURL += fieldStr + ";JavaScript";
-            expectedStdout = "New value is: "+valueStr;
+        	strURL += fieldStr + ";JavaScript";
+        	expectedStdout = "New value is: "+valueStr;
             break;
         default:
-            break;        
+            break;    	
         }
          
         ProcessResult pr = server.executeBrowser(strURL, new CountingClosingListenerImpl(), new CountingClosingListenerImpl());