Skip to content

Tutorial: Create new test application

iks github user edited this page Jun 3, 2019 · 36 revisions

Back


  1. Create file ./sysnat.test.runtime.environment/src/main/resources/execution_properties/GoogleSearch.properties.

  2. Give the new properties file the following content:

    isWebApplication=true 
    withLogin=false 
    StartParameter=starturl          
    
    googlesearch.production.starturl=https://www.google.com/ 
    
  3. Create java class ./sysnat.test.runtime.environment/src/main/java/com/iksgmbh/sysnat/language_templates/googlesearch/LanguageTemplatesGoogleSearch.java.

  4. Give the new java file the following content:

    package com.iksgmbh.sysnat.language_templates.googlesearch;
    
    import java.util.HashMap;
    
    import com.iksgmbh.sysnat.ExecutableExample;
    import com.iksgmbh.sysnat.ExecutionRuntimeInfo;
    import com.iksgmbh.sysnat.annotation.LanguageTemplateContainer;
    import com.iksgmbh.sysnat.common.utils.SysNatConstants.WebLoginParameter;
    import com.iksgmbh.sysnat.language_templates.LanguageTemplates;
            
    /** 
     * Contains the basic language templates for applicable 
     * for the Google Search test application. 
     */ 
     @LanguageTemplateContainer 
     public class LanguageTemplatesGoogleSearch implements LanguageTemplates 
     { 
          private ExecutableExample executableExample; 
          private ExecutionRuntimeInfo executionInfo; 
            
          public LanguageTemplatesGoogleSearch(ExecutableExample aExecutableExample) 
          {
              this.executableExample = aExecutableExample;
              this.executionInfo = ExecutionRuntimeInfo.getInstance();
          }
            
          //#############################################################################
          //                     I N T E R F A C E    M E T H O D S
          //#############################################################################
            
          @Override
          public void doLogin(final HashMap<WebLoginParameter,String> startParameter) {
              // no login/logout for Ithis test application
          }
    
          @Override
          public void doLogout() {
              // no login/logout for this test application
          }
    
          @Override
          public boolean isLoginPageVisible() {
              return false; // no login for this test application
          }
    
          @Override
          public boolean isStartPageVisible() {
              try {
                  return executableExample.isTextCurrentlyDisplayed("Über Google");
               } catch (Exception e) {
                   return false;
               }
          }
    
          @Override
          public void gotoStartPage() {
              if ( ! isStartPageVisible() ) {
                  executableExample.getGuiController().reloadCurrentPage();
              }
          }
            
          //#############################################################################
          //              L A N G U A G E   T E M P L A T E    M E T H O D S
          //#############################################################################
            
          // TODO: add methods that represent natural language instructions
    }
    
  5. Open file ./sysnat.natural.language.executable.examples/settings.config.

  6. Line 4 contains the comma separated list of available test applications. Add GoogleSearch to this list.

  7. Start the SysNat with its SystemConfigDialog, select test application GoogleSearch and target tnvironment Production, finally start test execution.

  8. Check the launched error report. It tells that no executable example has been found. That is what is done in the next part of the tutorial...


Back

Clone this wiki locally