LogoLogo
BugBug HomepageContact SupportLoginSign up free
  • Documentation
  • Tutorial for beginners
  • Best practices
  • BugBug App FAQ
  • Quick Start
    • What is test automation?
    • Start for free
    • Create your first project
    • Install Chrome extension
    • Create and run the tests
  • Creating Tests
    • Your first test
    • Independent tests
    • Duplicating tests
    • New test from here
  • Recording tests steps
    • BugBug overlay
    • Recording clicks
    • Recording hover
    • Recording keyboard typing
    • Recording assertions
    • Recording drag & drop
    • Record from here
    • Re-recording steps
    • Recording pop-up window actions
    • Using keyboard shortcuts
  • Editing tests
    • Grouping steps
    • Components
    • Manually editing steps
    • Actions
    • Assertions
    • Tabs & iframes
    • Variables
    • Local variables
    • Profiles
    • Custom JavaScript actions
  • Running tests
    • Running the tests
    • Statuses
    • Run (locally)
    • Run and pause here
    • Run in cloud
    • Schedules
    • Parallel runs
    • Running via API
    • Test your local build or protected web page using ngrok
  • Preventing failed tests
    • Waiting conditions
    • Smart click
    • Smart scroll
    • Selectors
    • Timeout
    • Delay / Sleep
    • Project settings
  • Debugging Tests
    • Runs history
    • Screenshots
    • Debug in Chrome
    • Breakpoint (run step-by-step)
  • Organizing tests
    • Naming your tests
    • Searching tests
    • Suites
    • Components
    • Projects
  • Workflow Tips
    • Edit & Rewind
    • Changing the test screen size
    • Multiple environments
    • Testing registration & login
    • Integrating with build systems
    • Mobile version testing
  • Collaboration
    • Organizations
    • Inviting team members
    • Alerts
      • Sending email notification
      • Sending webhook
      • Sending Slack message
      • Sending Teams message
  • Integrations
    • CLI
    • Zapier
    • Slack
    • GitHub
    • Bitbucket
    • Gitlab
    • Trello
    • Jira
  • Your account
    • Account settings
    • Edit your name and email
    • Forgot password
    • Manage Subscriptions
    • Account FAQ
  • Troubleshooting
    • Prohibited behaviors
    • Updating Chrome extension
    • Clear cookies and site data for BugBug
    • Testing basic auth password protected websites
    • Common selectors issues
    • CAPTCHA in automation testing
    • Cloud tests sometimes failing
    • IPs list of cloud runners
    • VPN or a Firewall
    • A/B tests
    • Report a bug
  • IN-DEPTH GUIDES
    • Beginners tutorial to automation testing
    • XPath Selectors without coding
    • Tech Leader's Guide to Automation Testing
    • Test automation guides
  • FREE TOOLS
    • BugBug Testing Inbox
    • Example SaaS App
    • No-code XPath Selector Builder
  • Other links
    • BugBug Homepage
    • Pricing
    • Terms & conditions
    • Privacy Policy
Powered by GitBook
On this page
  • Save variable for later
  • Insert a variable during step recording
  • Available variables
  • Unavailable variables during step recording
  • Search variables on the list
  • Local variables in web app UI
  • Combine local and other variables in one JS custom variable

Was this helpful?

  1. Editing tests

Local variables

PreviousVariablesNextCustom JavaScript actions

Last updated 1 year ago

Was this helpful?

BugBug has the option to set up and insert a variable from the tested source during test recording. Now you can store any text value from the web page you are testing in a variable and use it in feature steps. For example, to find out newly registered unique users in your CRM. Also, you can use built-in variables or custom variables added to the project.

A new option for variables in the test recording process can be found in the BugBug Extension overlay.

When you click on the "Variables" button there will be two options:

  • Save variable for later

  • Insert variable

Save variable for later

This option is used to save the new text value as a variable during the test recording. You can find an element and copy the value directly from the browser. Now there is no need to hardcode values and change them later in a BugBug web app steps edition. You can move forward.

Click on the "Save variable for later" button. Saving a variable mode is now active.

At this time you can click on an element with text value on a tested web app and save it into a variable. For example, you can save the search phrase - "Bugbug automation tool".

When an element is selected and a value is recorded, you will see an input in the BugBug extension menu where you can save the name for the new variable. Later this name will be visible in a list of variables in the BugBug extension menu.

When you save a variable, you will be taken to the main menu of the BugBug extension and can continue recording steps.

The saved variable is a cross-domain feature. Now you can use the saved value on different web apps in one test. eg. You can open a new tab and use the stored value there.

The variable can be overwritten several times during the test recording by using the same name. If you want to avoid this situation, use some unique names each time.

Using the same name of the variable as the built-in or custom variable name will override the data. This can cause a problem if your test is based on them and overriding these variables is not intended.

Insert a variable during step recording

Now you can insert a variable during step recording in BugBug. You can use saved variables from previous steps, use custom variables from the project, or use global variables that are predefined by default.

When you open the "Insert variable" menu the insert variable mode is now active for the selected variable. Now let's move on to the web application we're testing.

If you have an input that you want to automatically fill and you have opened the Insert Variable menu with the selected variable, you can simply click on an input to fill it with a value.

The "Insert variable" menu closes. The entry is saved with the value, and you can continue recording steps such as clicking Enter to open search results.

Available variables

During recording, you can also insert a variable added by default from BugBug such as:

  • Built-in variables

  • Custom variables

Using built-in or custom variables is now easy and you do not need to edit steps in the BugBug web application UI. You can find them in the list.

Unavailable variables during step recording

Built-in variables based on a suit or scheduled run

We cannot provide data such as {{suiteRunId}} because when recording, there is no suiteRunId. It's only accessible when the suite is running. You can insert this variable in normal test-edit mode on the BugBug web app UI for a case.

Some of the built-in variables are now disabled with notification. BugBug cannot import data from these variables. You can use it in step edit on the BugBug web app UI.

Custom JS variables

Search variables on the list

You can search for variables on the BugBug extension list by the variable name.

Local variables in web app UI

There is a new step form for local variables recorded from the tested source. You can edit this variable freely. The recorded variable can be found in the step list as a "set variable".

You can edit values such as the variable name or the correct item selector in the BugBug web application UI after you have finished recording.

Use a local variable

You can use local variables by selecting the "Insert variable" option during recording in the BugBug overlay. At the end of the recording session, the step using the local variable will be saved as "Type text" with the variable name used in the "value" field.

You can also add a local variable from the BugBug web app UI by selecting "add a new step" on the list and filling it all manually.

Select "Set variable" from the modal.

And fill in the requested inputs

Combine local and other variables in one JS custom variable

You can create a new variable using two different values in the JS form, which allows you to combine stored variables from the recording process and those that we provide as default global variables.

When you set variable from recording

When you use a new custom JS variable in step, BugBug will automatically combine the stored value with another variable that you want. These options allow you to combine values from all saved variables. You can call them as many times as you like.

To use a newly created variable, just put a variable name in double braces. After the first test run, you can find the calculated value of your variable from the previous test run in Step Details.

Do not use the local variable and its combination in steps before BugBug captures the wanted value. Otherwise, BugBug will return an undefined string instead of the desired local value.

Click the "Insert Variable" button. A variable menu will open. As you can see, we suggest the last saved variable by default. Every variable has a name and length-limited value presented below the name. You can open the drop-down menu to select another variable from the list. will be discussed in another chapter. Now we will focus on how to insert our saved variable into the designated input.

All these variables are described in the section of BugBug documentation.

Currently, there is no way to use a custom js variable during test recording. We are working on providing such a feature, but for now, we can only use variables with values that are accessible before the test starts recording. You can use custom JS variables in step edit on BugBug web app as we in our documentation.

Any recorded local variable can be used in the following steps by mentioning the local variable name in double curly brackets e.g. {{savedVariable}} in any text field like an assertion or custom selector. For more info check out .

You can use its name when creating a . All stored variables are accessible in JS form by using the argument variables combined with the variable name.

Variables
suggest
what are variables
Available variables
new custom JS variable
Variables button in recorder
Click on a "Save variable for later" button
Click the item with the desired text value
No spaces or other special characters allowed
Find an input you want to fill with the variable
Variables added by default to insert list.
Recorded step for local variable