Posted on

How to evaluate a PHP commands to manipulate variables and clipboard (Experimental feature)

Add Control->EVAL to test

EVAL argument is a PHP 5 expression. See on how to write php
The result of the expression is returned to the CLIPBOARD

Working with Data

Data from Data Tab in Editor can be read from the test to the clipboard.

E.g. setting

FirstName: Barbara
LastName: Mustermann
Age: 26

Read Data

EVAL $FirstName

Reads the value of the FirstName (“Barbara”) into the CLIPBOARD. Note that there is a “$” in front of the variable name using the EVAL command.

Manipulate Data

EVAL $FirstName." ".$LastName

Concatenates $FirstName, ” “, $LastName using the “.” as usual in PHP and returns the result to the CLIPBOARD.

Compute with Data

EVAL $Age + 10

Adds 10 to the variable Age. In the example with Age = 26, this command returns 36 to the CLIPBOARD.

PHP Examples

Measure time between steps

EVAL microtime(true)
EVAL microtime(true) -  $CLIPBOARD

Returns the time passes in seconds to CLIPBOARD.

Call PHP for TimeStamp

EVAL date_format(new DateTime(), "d.m.Y H:i:s");

Returns a timestamp to CLIPBOARD

Call Java for TimeStamp

EVAL new Java("java.util.Date")->toString();

Returns a timestamp to CLIPBOARD

Manipulate strings

EVAL substr($CLIPBOARD, 0,strlen($CLIPBOARD)-5)

Removes the last 4 characters from CLIPBOARD

Set and Get values from data store

EVAL get("result")."\r\n".$CLIPBOARD)

Concatenates via “.” the string in the data store”result” with a newline (“\r\n”) and CLIPBOARD contents.

EVAL set("result")

Sets the value of the data store “result” to the value of the CLIPBOARD.

EVAL set("result", get("result") ."\r\n". $CLIPBOARD)

Performs the concatenation of the setting of the data store with a single line of code.

Posted on Leave a comment

Create random Emails

To create a random Email use button. The values are stored in buffer – clipboard content – and then can be pasted into your test.

Insert random Email into a test.

Make sure you are in mode.

  1. Make an entry field active and enter your Email address.
  2. Insert a click where the random number is to be inserted.
  3. Switch to mode.
  4. Click .
  5. Type in a PHP code to create a random number: rand(1,100000000)
    A random number will be inserted in clipboard.
  6. Click on to add the created random number to your email.

Posted on Leave a comment

Conditional Jump

Conditional jump , enables you to control execution flow depending on true/false value in Clipboard Content. Conditional Jump is only possible to a certain place in Action List that is marked with #Tag.

Introduce a condition using or .
Make sure you are in mode.

  1. Click on .
  2. Type in Tag name to jump in case of false return.
  3. Press Enter and record the action.
  4. Replay the test to check the expected behaviour.
    Once the condition is met and Clipboard content returns a true result, false path will end. Test actions will continue playing.

Please Notice

Click to control execution flow if the value in Clipboard content is true.