Esempio n. 1
0
 /**
  * @param guiObj, TestObject may be JMenuBar or JPopupMenu
  * @param path, String is the full path of some MenuItem on which a click action will take place
  */
 protected void selectMenuItemWithoutVerification(GuiSubitemTestObject guiObj, String path) {
   com.rational.test.ft.script.List list = Script.localAtPath(path);
   // guiObj.setState(Action.select(), list); // RobotJ doesn't like this...
   try {
     guiObj.click(list);
     // set status to ok
     testRecordData.setStatusCode(StatusCodes.OK);
     String altText =
         "MenuItem \"" + path + "\" clicked, " + windowName + ":" + compName + " " + action;
     log.logMessage(
         testRecordData.getFac(),
         passedText.convert(PRE_TXT_SUCCESS_4, altText, path, windowName, compName, action),
         PASSED_MESSAGE);
   } catch (TargetGoneException tge) {
     Log.info(
         "CFMenuBar IGNORING TargetGoneException probably resulting from intended window closure...");
     // set status to ok
     testRecordData.setStatusCode(StatusCodes.OK);
     String altText =
         "MenuItem \"" + path + "\" clicked, " + windowName + ":" + compName + " " + action;
     log.logMessage(
         testRecordData.getFac(),
         passedText.convert(PRE_TXT_SUCCESS_4, altText, path, windowName, compName, action),
         PASSED_MESSAGE);
   } catch (NullPointerException npe) {
     testRecordData.setStatusCode(StatusCodes.GENERAL_SCRIPT_FAILURE);
     log.logMessage(testRecordData.getFac(), "item not found: " + path, FAILED_MESSAGE);
   }
 }
Esempio n. 2
0
 /**
  * @param guiObj, TestObject may be JMenuBar or JPopupMenu
  * @param path, String is the full path of some MenuItem on which a click action will take place
  * @param fuzzy, boolean, If true, we will do a non-exact verification of existance of path
  */
 protected void selectMenuItemWithVerification(
     GuiSubitemTestObject guiObj, String path, boolean fuzzy) {
   MenuTree atree = null;
   try {
     atree = (MenuTree) extractMenuItems(guiObj, 0);
     log.logMessage(testRecordData.getFac(), "atree: " + atree, DEBUG_MESSAGE);
     // Do the work of matching..., verify the path
     // If fuzzy is true, do the partial match; otherwise do the exact match
     String match = atree.matchPath(path, fuzzy, null);
     if (match != null) {
       log.logMessage(testRecordData.getFac(), "match: " + match, DEBUG_MESSAGE);
       com.rational.test.ft.script.List slist = Script.localAtPath(match);
       try {
         guiObj.click(slist);
         // set status to ok
         testRecordData.setStatusCode(StatusCodes.OK);
         String altText =
             "MenuItem \"" + match + "\" clicked, " + windowName + ":" + compName + " " + action;
         log.logMessage(
             testRecordData.getFac(),
             passedText.convert(PRE_TXT_SUCCESS_4, altText, match, windowName, compName, action),
             PASSED_MESSAGE);
       } catch (TargetGoneException tge) {
         Log.info(
             "CFMenuBar IGNORING TargetGoneException probably resulting from intended window closure...");
         // set status to ok
         testRecordData.setStatusCode(StatusCodes.OK);
         String altText =
             "MenuItem \"" + match + "\" clicked, " + windowName + ":" + compName + " " + action;
         log.logMessage(
             testRecordData.getFac(),
             passedText.convert(PRE_TXT_SUCCESS_4, altText, match, windowName, compName, action),
             PASSED_MESSAGE);
       } catch (NullPointerException npe) {
         testRecordData.setStatusCode(StatusCodes.GENERAL_SCRIPT_FAILURE);
         log.logMessage(testRecordData.getFac(), "item not found: " + path, FAILED_MESSAGE);
       }
     } else {
       testRecordData.setStatusCode(StatusCodes.GENERAL_SCRIPT_FAILURE);
       log.logMessage(
           testRecordData.getFac(),
           getClass().getName() + ": no match on: " + path,
           FAILED_MESSAGE);
     }
   } catch (SAFSException se) {
     testRecordData.setStatusCode(StatusCodes.GENERAL_SCRIPT_FAILURE);
     log.logMessage(
         testRecordData.getFac(), getClass().getName() + ": " + se.getMessage(), FAILED_MESSAGE);
   }
 }