0 Replies Latest reply on Jun 15, 2020 1:22 PM by Martin Zehetmeier

    How to get Overall Result of Script in OpenScript

    Martin Zehetmeier

      Hello,

      we use OpenScript (Version: 13.3.0.1 Build 262) on Windows 10 and Internet Explorer 11.900

       

      In my very simple test script I launch a browser, open a website and check for a text on the site "test" which is not present and that's why the test fails.

       

      In the finish section I want to get the overall result of my script (which should be failed - as the Reports says too

       

      Overall Result: Failed

      Result failed: The text "test" is not found in the HTML content. 

       

      But however I try to log this result it shows me my script has passed

       

      See below for the output of my own info-Logs.

       

      So my question is: How can I access the result of the Overall Result in the Java code and the summary.

       

      Any help is appreciated.

       

      Please see my code and console below.

       

       

       

      15:12:32,315 INFO  [1] has LastError
      15:12:32,345 INFO  [1] getLastError null
      15:12:32,414 INFO  [1] No Exception
      15:12:32,440 INFO  [1] isIterationPassed passed
      15:12:32,467 INFO  [1] isLastResultPassed passed
      

       

       

       

       

      public void initialize() throws Exception {
      browser.launch();
      }
      

       

      /**
      * Add code to be executed each iteration for this virtual user.
      */
      public void run() throws Exception {
      beginStep("[1] No Title (/spread)", 0);
      {
      web
      .window(17,
      "/web:window[@index='0' or @title='Help Spread DuckDuckGo']")
      .navigate("https://duckduckgo.com/spread");
      {
      think(5.733);
      web.assertText("test", "test", Source.DisplayContent,
      TextPresence.PassIfPresent, MatchOption.Exact);
      }
      }
      endStep();
      
      
      }
      

       

      public void finish() throws Exception {
      
      
      if (hasLastError()) {
        info("has LastError");
        info("getLastError " + String.valueOf(getLastError()));
      }
      
      
               Exception exception = getIterationResult().getError();
               if(exception == null){
                   info("No Exception");
               }
               else{
                   info("Exception");
                   info(exception.getMessage());
               }
               boolean isIterationPassed = getIterationResult().isPassed();
               if(isIterationPassed){
                 info("isIterationPassed passed");
               }
               else{
                 info("isIterationPassed not passed");
               }
              
               boolean isLastResultPassed = getLastResult().isPassed();
               if(isLastResultPassed){
                 info("isLastResultPassed passed");
               }
               else{
                 info("isLastResultPassed not passed");
               }
        
         browser.close();
      }