Forum Discussion

claudiaborges's avatar
claudiaborges
Occasional Contributor
4 years ago

Best practices for automation

Do you make end to end scripts and other long scripts exploring the whole functionality or do you do more atom tests?like for instance, adding something to your profile:

long script would be just one containing

adding, editing and deleting the object

atomised script would be one for each of these states. 

 

I am curious. 

Thanks

 

  • Both.

    Depends on object tested, on test strategy, on test budget, on client, on your skills, ...

     

    In fact, i build business test object starting from small/single action (like callMenu, closeCurrentScreen, selectValueInList, callToolbarAction, ...) and slowly aggregating these to build small business action (like selectSample, managePrinter, manageUserRigths, ..) to finally ending with complex business action (like editSample, editProject).

    I keep the same name of small/single action or small business action whatever the tested app is.

     

    After that i build test case using theses actions as test brick.

     

    At the end i've this kind of test :

    /**
     * @file Bibliothèque TestComplete des cas de test Ariane : Test item 22696
     * @author Biache Benoit
     * @version 1.00
     */
    
    //USEUNIT ariane
    //USEUNIT arianeEngine
    //USEUNIT POC_Globals
    //USEUNIT POC_Context
    
    /*****************************************************************************************/ 
    /***************************** Implémentation test item 22696 ****************************/ 
    /*****************************************************************************************/ 
    
    /**
     * Test fonctionel CT 22696 Saisie demande Anapath [Cas 1]
     * @function
     * @returns {boolean} Renvoie <b>true</b> si le test s'est bien effectué
     */
    function CT_22696() {
      if (!startTest("22696", "Saisie demande Anapath [Cas 1]"))
        return false;
      let go = true;
      try {
        /* Début CT -------------------------------------------------------------------------*/
        let data = globals.currentTestData;
        go = go ? myAriane.connect              (data.LOGIN, data.PASSWORD, data.VERSION) : false;
        go = go ? myAriane.callRibbonMenu       (ariane.ribbonMenu.demandeAnapath) : false;
        go = go ? myAriane.selectPrinterModels  ("Feuille demande=" + data.IMP_FEUILDEMANDE + ";Étiquette prélèvement=" + data.IMP_ETIQPRELEV) : false;
        go = go ? myAriane.selectHospital       (data.CODE_ETB, data.NOM_ETB) : false;
        go = go ? myAriane.selectCriteria       ("**bleep**|Egal à|T=" + globals.currentTestData.patient.**bleep**) : false;
        go = go ? myAriane.setSimplifiedRequest ("Urgent=true;Prescripteur=" + data.PRESCRIPTEUR + "|" + data.ADR_PRESCRIPTEUR + ";Destinataire=" + data.DESTINATAIRE + "|" + data.ADR_DESTINATAIRE, ariane.statusMenu.none) : false;
        go = go ? myAriane.setSimplifiedSample  ("Date=" + data.DATEPRELEV + ";Nombre=" + data.NBPRELEV + ";Définition=" + data.AXE1 + "|" + data.AXE2 + "|" + data.AXE3 + "|" + data.AXE4, ariane.statusMenu.none) : false;
        go = go ? myAriane.editSample           (2, "Commentaire=Test du commentaire^a~u|TEST DU COMMENTAIRE", ariane.statusMenu.saveClose) : false;
        go = go ? myAriane.closeCurrentScreen   () : false;
        if (!go) {
          myAriane.closeCurrentScreen();
          throw Error(myAriane.getErrorString());
        }  
        /* Fin CT ---------------------------------------------------------------------------*/
      }
      catch(e) {
        globals.error = e.message;
        go            = false;
      }
      go ? endTest("SUCCESS") : endTest("FAILURE");
      return go;
    }
    

     

     

     

  • BenoitB's avatar
    BenoitB
    Community Hero

    Both.

    Depends on object tested, on test strategy, on test budget, on client, on your skills, ...

     

    In fact, i build business test object starting from small/single action (like callMenu, closeCurrentScreen, selectValueInList, callToolbarAction, ...) and slowly aggregating these to build small business action (like selectSample, managePrinter, manageUserRigths, ..) to finally ending with complex business action (like editSample, editProject).

    I keep the same name of small/single action or small business action whatever the tested app is.

     

    After that i build test case using theses actions as test brick.

     

    At the end i've this kind of test :

    /**
     * @file Bibliothèque TestComplete des cas de test Ariane : Test item 22696
     * @author Biache Benoit
     * @version 1.00
     */
    
    //USEUNIT ariane
    //USEUNIT arianeEngine
    //USEUNIT POC_Globals
    //USEUNIT POC_Context
    
    /*****************************************************************************************/ 
    /***************************** Implémentation test item 22696 ****************************/ 
    /*****************************************************************************************/ 
    
    /**
     * Test fonctionel CT 22696 Saisie demande Anapath [Cas 1]
     * @function
     * @returns {boolean} Renvoie <b>true</b> si le test s'est bien effectué
     */
    function CT_22696() {
      if (!startTest("22696", "Saisie demande Anapath [Cas 1]"))
        return false;
      let go = true;
      try {
        /* Début CT -------------------------------------------------------------------------*/
        let data = globals.currentTestData;
        go = go ? myAriane.connect              (data.LOGIN, data.PASSWORD, data.VERSION) : false;
        go = go ? myAriane.callRibbonMenu       (ariane.ribbonMenu.demandeAnapath) : false;
        go = go ? myAriane.selectPrinterModels  ("Feuille demande=" + data.IMP_FEUILDEMANDE + ";Étiquette prélèvement=" + data.IMP_ETIQPRELEV) : false;
        go = go ? myAriane.selectHospital       (data.CODE_ETB, data.NOM_ETB) : false;
        go = go ? myAriane.selectCriteria       ("**bleep**|Egal à|T=" + globals.currentTestData.patient.**bleep**) : false;
        go = go ? myAriane.setSimplifiedRequest ("Urgent=true;Prescripteur=" + data.PRESCRIPTEUR + "|" + data.ADR_PRESCRIPTEUR + ";Destinataire=" + data.DESTINATAIRE + "|" + data.ADR_DESTINATAIRE, ariane.statusMenu.none) : false;
        go = go ? myAriane.setSimplifiedSample  ("Date=" + data.DATEPRELEV + ";Nombre=" + data.NBPRELEV + ";Définition=" + data.AXE1 + "|" + data.AXE2 + "|" + data.AXE3 + "|" + data.AXE4, ariane.statusMenu.none) : false;
        go = go ? myAriane.editSample           (2, "Commentaire=Test du commentaire^a~u|TEST DU COMMENTAIRE", ariane.statusMenu.saveClose) : false;
        go = go ? myAriane.closeCurrentScreen   () : false;
        if (!go) {
          myAriane.closeCurrentScreen();
          throw Error(myAriane.getErrorString());
        }  
        /* Fin CT ---------------------------------------------------------------------------*/
      }
      catch(e) {
        globals.error = e.message;
        go            = false;
      }
      go ? endTest("SUCCESS") : endTest("FAILURE");
      return go;
    }