Value expressions

When you run your tests, Tosca Cloud interacts with the screen elements in your application to ensure your workflows behave as expected. Use value expressions to insert data into your application, verify displayed content, or store data for later use. For example, you can fill out a form, check if a table displays the correct prices, or save order confirmation details to compare with your database.

Static vs. dynamic values

You can always put static values into your test case. For example, define that Tosca Cloud should enter I love testing into a specific entry field.

However, some use cases work better with dynamic values. These are values that Tosca Cloud auto-generates at runtime, based on your specifications in a so-called value expression.

Let's say you have a webshop. The final price of a product consists of several components: base price, tax, and shipping costs.

In theory, you could manually calculate the totals for every possible combination and then put the resulting sums as static values into your test cases. That's doable, but not great: it's a lengthy process, it's error-prone, and if anything changes, you have to do it all over again.

To create a resilient, low-maintenance test case that automates these problems away, do this instead: 

  • Have Tosca Cloud retrieve applicable price components from your application. And then save that information.

  • Use a value expression to calculate the total for a specific combination in your test case.

  • Link test data to your test case.

Types of value expressions

Here are the types of value expressions you can use in your tests:

  • Scroll operations, where Tosca Cloud scrolls the page.

  • Click operations, where Tosca Cloud performs mouse clicks to navigate menus and buttons.

  • Keyboard commands, where Tosca Cloud types on the keyboard.

  • Variable values, which let you reuse the value that you've previously saved to a variable. For example, to compare it to data in a different part of your application.

  • Parameter values, which let you reuse the value of a custom parameter that you've set for your test case. For example, to insert the value into a text field.

  • Date and time values, which let you generate dates and times. For example, a time stamp to track progress in your database, or a specific date to enter into a customer data form.

  • Calculations, which let you hand the math over to Tosca Cloud. For example, to calculate a total and compare it to what's in your table.

  • Random values, which let you generate random numbers or strings. For example, to test workflows where the exact values aren't crucial, and you're tired of typing sdklfjdslkf into all your test cases. Or to test basics, such as "This particular entry field doesn't accept any string longer than X characters."

  • Regular expressions, which let you dynamically buffer or extract data. You can also create random values with regular expressions. For example, you can extract usernames from a userinfo label.

  • Resource expressions, which let you reference data and files. For example, you can load an XML file and use its data in later test steps.

  • String operations, which let you change and transform your string data. For example, you can capitalize text in a buffer.

  • Dynamic text expressions, which let you extract text to compare and verify. For example, you can use values in a buffer.

  • UserSimulation, which lets you automate user interactions for your test. For example, Tosca Cloud can click on buttons or links.

  • Number formats, which let you dynamically change number format for regional requirements. For example, you can change the decimal or grouping character of numeric values.

  • Intervals, which let you enter a range instead of a specific value when you verify. For example, you can verify that a value is a number between 75 and 125.

  • Key vault secrets, which let you use passwords and credentials you store in key vaults. For example, you can use a client ID and client secret you have in CyberArk.