user_object_adaptor [TAST DokuWiki ]

User Tools

Site Tools


Sidebar

First steps in TAST

What is UML

Computer setup for TAST use

FAQ

Recognized Issues

TAST tool Menu

TAST Adaptors

Adaptors examples

TAST Integrations

Interesting features

Documentation of technical administration

Modeling recommendations

Training in the TAST tool

user_object_adaptor

User Object Adaptor

Introduction

This adapter is used to execute the flow information of the TAST execution process, by manipulating variables that are used to obtain and establish values ​in the adapters, as well as in decision making and loops.

Configuration

No information is established during initialization of the adapter. It is by using the information of the predefined functions where it is performed.

Initialization Parameters

There are no Initialization Parameters.

Functions

  • assertion(stepResult,…): Executes the JavaScript function using the variables that are introduces as input parameters and returns a boolean.
  • compareParameters(Element1, Element2): Compares two values with an operator chosen by the user. Returns true or false.
  • compareScreens: Compare html screenshot with 3270 host screenshot.
  • compareTextFiles: compares two text or csv files. Returns true or false and generates a csv file as evidence.
  • compareVariables(Name 1, Name 2): Compares two variables with the operator chosen by the user. Returns true if they are equal.
  • copyFile(): This predefined function makes a copy of a file and move it to a new place. The input parameters are:
    • sourceFile, to enter the file you want to copy.
    • targetFile, to select where you want this file (it can be the same path). And
    • preserveFile, a Boolean, if “true” its marked it put the date of the file same as the original one.
      If the names and the path of the original and the copy are the same, the name of the copy is changed for copy-“thenameoftheoriginal”.”ext”.
  • dateAddition: Returns a date as a result of adding a number in the selected unit.
  • dateDifference: Returns the difference between the dates in the selected unit. You need to select the date formats, both the first and second one, and input the first and second date in those formats. The last parameter is to select in which unit you want the time to be returned.
  • dateWeekDay: Returns the day of the week in the specified format (number or literal).
  • executeCommand(): Executes a command in Windows O.S. The aim of this PF is to execute commands in the local console. This is the reason because is located into the User Adaptor.
    • The Input parameter is the command itself. The command has to be preceded with the string “cmd /c”, for example:
      “cmd /c dir /p” to list the files in a directory, or “cmd /c copy pathfileOrg pathfileDst” to copy one file to another.
  • executeCommandParam:
  • executeJavaScript(NameFunction): Executes the javaScript function whose name is entered as a parameter. The function can have input parameters and return a value. The input parameters will be the variables defined with setVariable, or the results of other predefined functions. The value that returns will be saved in the output variable.
    Javascript Version ECMAScript 5.
  • failTest(ErrorMsg): Returns error with or without the error message that the user enters in the ErrorMsg parameter.
  • getCurrentDate(DateFormat): Returns the current date with the established format or format by default in a parameter of type TASTDATATABE. To get: current date → TASDATATABLE [1]. Current day→ TASDATATABLE [2]. Current month→ TASDATATABLE [3]. Current year (yyyy) → TASDATATABLE [4]. Current year (yy) → TASDATATABLE [5].
  • getCurrentDateAsDate(): Returns the current date as a Date type. Input parameters are not required.
  • getCurrentDateAsString(): Returns the current date as a String type with the format introduced by the user in the input parameter dateFormat as a value.


  • isExistVariable(): This function checks if the variable exists. Returns “yes” if exist or “no” otherwise. “Name” is the input parameter used to check it and it is case sensitive.
  • manualTast(): Launches the process of Manual Intervention to allow the user to create and document Manual Test Cases, uploading it to ALM. Input parameters are not needed.
  • removeVariable(): Removes the variable whose name is entered as a parameter. “Name” is the input parameter used to remove it and it is case sensitive.
  • replaceAll(): Replaces all substring of this string that matches the given regular expression with the given replacement. The input parameters are varName (to indicate the name of the variable we want to change), regex (regular expression), and replacement.
  • saveRepositoryAsEvidence: Generates the repository(s) used as evidence of the step.
  • sendEmail(): send an e-mail. It has the following fields:
    • To: addresses to send the e-mail to, separated by semicolons.
    • Subject: subject of the email.
    • Body: body of the e-mail.
    • TS Results: If checked, the following will be added to the subject and body of the mail:
      - Subject: (Result- ok/ko/not completed).
      - Body: (TestCaseNameN. TCDN Description - [Result - ok/ko].
      - URL - (url of the evidence file for this testcase in TAST).
    • Attachment: (OPTIONAL, multiple field, will go last). Path to the file(s) to be attached to the mail.
  • sendKeys(String, Delay in miliseconds): This function sends the keys one by one where the cursor is at this moment. It has two input parameters:
    • Parameter String: keys to send, for example:
      ~!@#$%^&*()_+{}|:\”<>? abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ çÇáÉñÑä
    • Parameter Delay miliseconds (Optional): delay in milliseconds between keys, for example 200.
  • sendKeysCombination(Key+Key, Delay in miliseconds): This function sends the combinations of the keys (or Java Robot KeyEvent API) one by one separated by a + where the cursor is at this moment. For Java Robot KeyEvent API see link: 'https://docs.oracle.com/javase/7/docs/api/java/awt/event/KeyEvent.html'.
    Receive two parameters: Combination of keys to send, for example: “Control+a”, “Control+z”, “Control+alt+3”, “delete”, “VK_CONTROL+VK_A”, “VK_CONTROL+VK_ALT+VK_A”, “VK_DELETE” etc… (Optional) Delay in milliseconds between keys, for example 200.

    The list of allowed Keys are: ADD, ALT, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, ARROW_UP, BACKSPACE, BACK_SPACE, CANCEL, CLEAR, COMMAND, CONTROL, DECIMAL, DELETE, DIVIDE, DOWN, END, ENTER, EQUALS, ESCAPE, F1, F10, F11, F12, F2, F3, F4, F5, F6, F7, F8, F9, HELP, HOME, INSERT, LEFT, LEFT_ALT, LEFT_CONTROL, LEFT_SHIFT, META, MULTIPLY, NULL, NUMPAD0, NUMPAD1, NUMPAD2, NUMPAD3, NUMPAD4, NUMPAD5, NUMPAD6, NUMPAD7, NUMPAD8, NUMPAD9, PAGE_DOWN, PAGE_UP, PAUSE, RETURN, RIGHT, SEMICOLON, SEPARATOR, SHIFT, SPACE, SUBTRACT, TAB, UP
  • sendKeysPaste(Text): This function executes pasting the text where the cursor is at this moment. Like buffered text paste using “Control+V” combination. Receive one parameter: Text to paste, for example: ~!@#$%^&*()_+{}|:\”<>? abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ çÇáÉñÑä
  • setArrayVariable(): Creates or modifies a specific cell in an array. The setVariable is used to create the array, and the created variable is used as the name in the first parameter of the setArrayVariable.
    The variable type of the value you want to create or modify must be Boolean, Date, Double, Integer or String.
    You have to specify the column number and the row number to access the cell you want to create or modify.
    For example: ColNum(1) and RowNum(2) would give you access to the second cell of the array.
  • setVariable(): Creates a variable whose name is entered as a parameter. The variable types are: TastTableData, String, Integer, Double, Date or Boolean.
    To create an array from this function, the user has to create a variable type TASTTABLEDATA and add in the value box the value like the following example:
    [ [
    {“type”:“STRING”,”value”:“myfirstdata”}
    ,
    {“type”:“STRING”,”value”:“myseconddata”}
    ,
    {“type”:“INTEGER”,”value”:“3”}
    ],[
    {“type”:“STRING”,”value”:“segovia”}
    ,
    {“type”:“STRING”,”value”:“avila”}
    ,
    {type”:“INTEGER”,”value”:“24”}
    ] ]
    ¨The same happens with: TASTROWTABLEDATA
    [ [
    {“type”:“DOUBLE”,”value”:“5.25”}
    ,
    {“type”:“DATE”,”value”:“05/08/2019”}
    ,
    {“type”:“BOOLEAN”,”value”:“false”}
    ] ]

    The allowed types of variables are:
    STRING; INTEGER; DOUBLE; DATE; BOOLEAN.

    Also the first value in a tastTableData and tastRowTableData is 1.

    As posible confusion cases, to use the elements of a table, for example to use “value”:“05/08/2019” the user can do it like: #nameOfTheTastRowTableData.getCellValue(2), this way the user will obtain the value of the example in the tastRowTableData.

    Another case could be the user capability to edit the space in certain position of the “array” for example to edit: “value”:“05/08/2019” in tastRowTableData, could be done with: #nameOfTheTastRowTableData.setCellValue(2, “05/08/2019”).
  • systemCloseProgram(): Close system program. Closes the Outlook of your system. With the input parameter you choose between two options, “hxoutlook” or “outlook”.
  • takeScreenshot(): This function does an screenshot with Java Robot to an element that is visible at that moment in the user screen. It does not require input parameters and the data will be stored in evidences folder.
  • waitFor(): Waits a certain amount of time introduced in the input parameter timeInSeconds.
user_object_adaptor.txt · Last modified: 2024/07/04 12:27 by montse