text_files_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

text_files_adaptor

Text Files Adaptor

Initialization Parameters

  • FilePath: The complete path, including the name of the file, of the file represented by the adapter in the diagram.
  • CharSet: The charset used to create the file. For example, if you are using files for Webservice testing, charset must be UTF-8. If you are using files from Windows to one FTP/SFTP server charset must be CP1252.

    IMPORTANT : It is really important to select properly the charset of the file, the return carriage character is handled in a different way depending on it. It can impact in all the predefine functions managing the file in TAST.

    To select the proper charset you, it is possible to identify it using the text editor in the following way:

  • Create/Overwrite: When the checkbox is marked, TAST will create a new file or overwrite it if the file already exists.

Functions

  • closeFile(): Closes the file and release the associated resources. Returns true if the file could be closed correctly or false otherwise. Input parameters are not required.
  • containsText(SearchString): Returns true if the text string entered in the searchString parameter exists in the file, false otherwise.
  • countFileLine(): Returns the number of lines in the file. Input parameters are not required.
  • countTextFile(): This function counts the number of times a string appears in a file. The input parameter searchString allow the user to search and execute the comparison.
  • deleteFtpFile(): This function deletes a file from the Ftp server. Returns if the operation was successful or it was not. The parameters that function needs are:
    • The Host parameter represents the address of the remote machine where the file resides.
    • The User parameter represents the user of connection to the remote system.
    • The Password parameter represents the user's password on the remote system.
    • The RemotePath parameter represents the path of the file on the remote system.
    • The Port parameter represents the port number of the server.
  • deleteSftpFile(): This function deletes a file from the Sftp server. Returns if the operation was successful or it was not. The parameters that function needs are:
    • The Host parameter represents the address of the remote machine where the file resides.
    • The User parameter represents the user of connection to the remote system.
    • The Password parameter represents the user's password on the remote system.
    • The RemotePath parameter represents the path of the file on the remote system.
    • The Port parameter represents the port number of the server.
  • generateFileAsEvidence(): The function generates a copy of the file in it's current state to add as evidence.
  • getFileText(): Reads the content of the file and it returns as a TastDataString variable. It does not require input parameters.
  • getFtpFile(Host, User, Password, RemotePath, LocalPath): Allows transferring a file via the Ftp protocol of a remote system to the local system in which the diagram is executed.
    • Returns true if the operation is successful, false otherwise.
    • The Host parameter represents the address of the remote machine where the file resides.
    • The User parameter represents the user of connection to the remote system.
    • The Password parameter represents the user's password on the remote system.
    • The RemotePath parameter represents the path on the remote system to the file that we want to transfer.
    • The LocalPath parameter represents the path, in the local file system, where we want to transfer the file.
  • getLineLength(lineNum): Returns the length of the file line indicated by the lineNum parameter.
  • getNumColumns(): Returns the number of columns contained in the TastTableData that was generated by the execution of the loadCsvFile function. It requires the execution of the loadCsvFile function in previous steps of the diagram.
  • getOwner(): Return file 's owner in the filesystem. Input parameters are not required.
  • getReadLine(lineNum): Returns a variable of type String to the executor with the content of the number of line indicated by the lineNum parameter.
  • getSftpFile(Host, Port, User, Password, RemotePath, LocalPath): Allows transferring a file via the Sftp protocol of a remote system to the local system in which the diagram is executed.
    • Returns true if the operation is successful, false otherwise.
    • The Host parameter represents the address of the remote machine where the file resides.
    • The Port parameter represents the port number on which the Sftp server listens for incoming connections. The Sftp takes port 22 by default.
    • The User parameter represents the user of connection to the remote system.
    • The Password parameter represents the user's password on the remote system.
    • The RemotePath parameter represents the path on the remote system to the file that we want to transfer.
    • The LocalPath parameter represents the path, in the local file system, where we want to transfer the file.
  • getSize(): Returns the file size in KiloBytes. Input parameters are not required.
  • getTableValue(RowNum, ColNum): Returns the contained value of the cell indicated by the RowNum and ColNum parameters. It requires the execution of the loadCsvFile function in previous steps of the diagram.
  • getTextFileData(): Keeps all the content of the file in an array and another file for futures operations. It does not require input parameters.
  • lineContainsText(lineNum, StringToSearch): Returns true if the text string entered in the StringToSearch parameter exists in the line of the file indicated by the lineNum parameter, and false otherwise.
  • loadCsvFile(Separator): Reads the contents of a csv-type file, and transforms it into a TastTableData variable that is returned to the executor so that we can operate on the data in the next steps of the diagram. The separator parameter indicates the separator character of fields in the file.
  • newFile(FilePath): Creates or overrides a file, with the path and the name indicated by the parameter “filePath”.
    If the file doesn´t exist, TAST will create it, as an empty file.
    If the file exist, TAST will delete the current file, and it will create a new empty one.
  • openFile(): Checks the existence of the file in the file system, and the reads / writes permissions on it. Returns true if the file could be accessed correctly or false otherwise. Input parameters are not required.
  • openNewFile(): Resets the content of the configured file to empty. This file must exist. Input parameters are not required.
  • putFtpFile(Host, User, Pasword, LocalFileName, RemoteFileName, HostDirectory): Allows to transfer a file, by the Ftp protocol, of the local system in which the diagram is executed to the remote system.
    • Returns true if the operation is successful, false otherwise.
    • The Host parameter represents the address of the remote machine where the file resides.
    • The User parameter represents the user of connection to the remote system.
    • The Password parameter represents the user's password on the remote system.
    • The LocalFileName parameter represents the full path to the file on the local system.
    • The RemoteFileName parameter represents the name of the file on the remote system.
    • The HostDirectory parameter represents the directory, in the remote file system, where we want to transfer the file.
  • putSftpFile(Host, Port, User, Password, LocalPath, RemotePathFormed): Allows to transfer a file, by the Sftp protocol, of the local system in which the diagram is executed to the remote system.
    • Returns true if the operation is successful, false otherwise.
    • The Host parameter represents the address of the remote machine where the file resides.
    • The Port parameter represents the port number on which the file server waits for incoming connections.The SFTP takes port 22 by default.
    • The User parameter represents the user of connection to the remote system.
    • The Password parameter represents the user's password on the remote system.
    • The LocalPath parameter represents the complete path and the name of the file in the local system.
    • The RemotePathFormed parameter represents the full path and the name of the file on the remote system.
  • replaceText(From_Str, To_Str): Allows to replace all the occurrences of the string “From_Str” by the string “To_Str”, and will save the file again.
  • writeEnter: The function append a carriage return to the file. Input parameters are not required.
  • writeTo(StringToWrite): Writes the text string in the file, in append mode.
    • Returns true if the write operation was successful, false otherwise. The input parameters are StringToWrite to receive the text string and addBreakLine to skip the line (this parameter is a Boolean).
text_files_adaptor.txt · Last modified: 2023/05/04 08:02 by montse