Nexial Automation

Test Automation Platform for everyone!

X

$(projectfile)

Description

This built-in function provides reference to the files in the project directory of the running script. File reference will be relative to the project directory.

For example,
      suppose the running script is /project/MyProject/artifact/script/MyTestScript.xlsx,
      then based on standard Nexial project structure, the project directory is /projects/MyProject.
      Hence file reference will be relative to /projects/MyProject.

Available Functions

$(projectfile|text|file)

Retrieve the content of a project file specified as file. Assumes that the target file has “text” content (not binary).

Example

Suppose we have the following test Script:
script

Column param1 of row 7 shows that we are instructing Nexial to retrieve the text content of a project file under artifact/data/myfile.txt and print it in the output. Similar in row 9, column “param 2”, the same built-in function is used again for file content comparison.

Here’s the output:
output

Notice that the output at row 7 is the same as the “text” property printed on row 9.


$(projectfile|executionErrorsAsHtml|tableOnly)

Specialized built-in function to convert [execution errors] into HTML. Use true for tableOnly parameter to generate only the HTML table. See ErrorTracker for more details.


$(projectfile|projectProperty|name)

Display the value of a data variable specified in project.properties. For environment-specific properties file, such as project.QA.properties, prepend the data variable name with ::{ENV}::. For example,

  • $(projectfile|projectProperty|username) reads the username data variable defined in project.properties
  • $(projectfile|projectProperty|::QA::username) reads the username data variable defined in project.QA.properties

Note that this function reads specifically from the project.properties file only.


$(projectfile|projectProperty|name|value)

Create or update the value of a data variable in project.properties. For environment-specific properties file, such as project.QA.properties, prepend the data variable name with ::{ENV}::. For example,

  • $(projectfile|projectProperty|username|Admin) create or update the username data variable defined in project.properties with the value Admin.
  • $(projectfile|projectProperty|::QA::username|Admin) create or update the username data variable defined in project.QA.properties with the value Admin.

Note that this function will impact specifically the project.properties file only. If the specified data variable name already exists in the target project.properties file, the value will be updated in place (same line). If the specified data variable name is a new one, it will be added to the end of the file.

The original project.properties file will be backed up in the output directory. For clarity, the backup file name will contain timestamp.


$(projectfile|macro|file|sheet|name)

This specialized built-in function provides macro details such as macro file, sheet and macro name. These details mainly needed to be referred to invocation of macro from base » macroFlex(macro,input,output)). In this case, file can be relative path or absolute path of macro excel. For more details about parameters, go through base » macro(file,sheet,name)).
In following example, first parameter of base » macroFlex(macro,input,output)) command is the $(projectfile) built-in function which is used to invoke macro.
script


See Also