Tests and ScriptsScriptDynamic Variables

Dynamic Variables

Dynamic variables enable you to generate and use random data in your testing workflow. Bruno uses the faker.js library to generate random data. You can use these variables like any other variables in Bruno. The syntax to use dynamic variables is {{$randomData}}, and you can use them in the request body, authentication, parameters, and other fields.

Dynamic variables are case-sensitive and follow the camelCase convention.

Usage Examples

Here are some common use cases for dynamic variables:

  1. Test Data Generation:

    {
      "user": {
        "id": "{{$randomUUID}}",
        "name": "{{$randomFullName}}",
        "email": "{{$randomEmail}}",
        "phone": "{{$randomPhoneNumber}}",
        "address": {
          "street": "{{$randomStreetAddress}}",
          "city": "{{$randomCity}}",
          "country": "{{$randomCountry}}"
        }
      }
    }
  2. Authentication:

    {
      "credentials": {
        "username": "{{$randomUserName}}",
        "password": "{{$randomPassword}}",
        "lastLogin": "{{$isoTimestamp}}"
      }
    }
  3. Business Data:

    {
      "company": {
        "name": "{{$randomCompanyName}}",
        "catchPhrase": "{{$randomCatchPhrase}}",
        "department": "{{$randomDepartment}}",
        "account": {
          "number": "{{$randomBankAccount}}",
          "type": "{{$randomTransactionType}}"
        }
      }
    }

Available Dynamic Variables

Bruno provides a comprehensive set of dynamic variables for generating test data. These variables are organized into categories based on their functionality.

Basic Data Types

Variable NameDescriptionExamples
{{$guid}}A random UUID550e8400-e29b-41d4-a716-446655440000
{{$timestamp}}Current timestamp in milliseconds1562757107
{{$isoTimestamp}}Current timestamp in ISO format2024-03-20T12:34:56.789Z
{{$randomUUID}}A random UUID550e8400-e29b-41d4-a716-446655440000
{{$randomAlphaNumeric}}A random alpha-numeric character6, y, z
{{$randomBoolean}}A random boolean valuetrue, false
{{$randomInt}}A random integer between 0 and 1000802, 494, 200
{{$randomColor}}A random colorred, fuchsia, grey
{{$randomHexColor}}A random hex value#47594a, #431e48, #106f21
{{$randomAbbreviation}}A random abbreviationSQL, PCI, JSON
{{$randomWord}}A random wordprotocol, interface
{{$randomWords}}Multiple random wordsquick brown fox

Internet and Network

Variable NameDescriptionExamples
{{$randomIP}}A random IPv4 address241.102.234.100, 216.7.27.38
{{$randomIPV4}}A random IPv4 address192.168.1.1
{{$randomIPV6}}A random IPv6 addressdbe2:7ae6:119b:c161:1560:6dda:3a9b:90a9
{{$randomMACAddress}}A random MAC address33:d4:68:5f:b4:c7, 1f:6e:db:3d:ed:fa
{{$randomPassword}}A random 15-character alpha-numeric passwordt9iXe7COoDKv8k3, QAzNFQtvR9cg2rq
{{$randomLocale}}A random two-letter language code (ISO 639-1)ny, sr, si
{{$randomUserAgent}}A random user agentMozilla/5.0 (Macintosh; U; Intel Mac OS X 10.9.8; rv:15.6) Gecko/20100101 Firefox/15.6.6
{{$randomProtocol}}A random internet protocolhttp, https
{{$randomSemver}}A random semantic version number7.0.5, 2.5.8, 6.4.9
{{$randomDomainName}}A random domain nameexample.com
{{$randomDomainSuffix}}A random domain suffix.com, .org, .net
{{$randomDomainWord}}A random domain wordexample, test, demo
{{$randomExampleEmail}}A random example emailuser@example.com
{{$randomEmail}}A random email addressjohn.doe@example.com
{{$randomUserName}}A random usernamejohndoe123
{{$randomUrl}}A random URLhttps://example.com

Names and Personal Information

Variable NameDescriptionExamples
{{$randomFirstName}}A random first nameEthan, Chandler, Megane
{{$randomLastName}}A random last nameSchaden, Schneider, Willms
{{$randomFullName}}A random first and last nameConnie Runolfsdottir, Sylvan Fay, Jonathon Kunze
{{$randomNamePrefix}}A random name prefixDr., Ms., Mr.
{{$randomNameSuffix}}A random name suffixI, MD, DD
{{$randomJobArea}}A random job areaMarketing, Engineering, Sales
{{$randomJobDescriptor}}A random job descriptorSenior, Lead, Junior
{{$randomJobTitle}}A random job titleSoftware Engineer, Product Manager
{{$randomJobType}}A random job typeFull-time, Contract, Part-time
{{$randomPhoneNumber}}A random phone number+1-555-123-4567
{{$randomPhoneNumberExt}}A random phone number with extension+1-555-123-4567 ext. 123

Location

Variable NameDescriptionExamples
{{$randomCity}}A random city nameNew York, London, Tokyo
{{$randomStreetName}}A random street nameMain Street, Park Avenue
{{$randomStreetAddress}}A random street address123 Main St, 456 Park Ave
{{$randomCountry}}A random country nameUnited States, Japan, Germany
{{$randomCountryCode}}A random country codeUS, JP, DE
{{$randomLatitude}}A random latitude40.7128, 35.6762
{{$randomLongitude}}A random longitude-74.0060, 139.6503

Images

Variable NameDescriptionExamples
{{$randomAvatarImage}}A random avatar image URLhttps://i.pravatar.cc/300
{{$randomImageUrl}}A random image URLhttps://picsum.photos/200/300
{{$randomAbstractImage}}A random abstract imagehttps://loremflickr.com/320/240/abstract
{{$randomAnimalsImage}}A random animal imagehttps://loremflickr.com/320/240/animals
{{$randomBusinessImage}}A random business imagehttps://loremflickr.com/320/240/business
{{$randomCatsImage}}A random cat imagehttps://loremflickr.com/320/240/cats
{{$randomCityImage}}A random city imagehttps://loremflickr.com/320/240/city
{{$randomFoodImage}}A random food imagehttps://loremflickr.com/320/240/food
{{$randomNightlifeImage}}A random nightlife imagehttps://loremflickr.com/320/240/nightlife
{{$randomFashionImage}}A random fashion imagehttps://loremflickr.com/320/240/fashion
{{$randomPeopleImage}}A random people imagehttps://loremflickr.com/320/240/people
{{$randomNatureImage}}A random nature imagehttps://loremflickr.com/320/240/nature
{{$randomSportsImage}}A random sports imagehttps://loremflickr.com/320/240/sports
{{$randomTransportImage}}A random transport imagehttps://loremflickr.com/320/240/transport
{{$randomImageDataUri}}A random image data URIdata:image/png;base64,…

Finance

Variable NameDescriptionExamples
{{$randomBankAccount}}A random bank account number1234567890
{{$randomBankAccountName}}A random bank account nameChecking Account
{{$randomCreditCardMask}}A masked credit card number**** **** **** 1234
{{$randomBankAccountBic}}A random BIC codeDEUTDEFF
{{$randomBankAccountIban}}A random IBANDE89370400440532013000
{{$randomTransactionType}}A random transaction typedeposit, withdrawal
{{$randomCurrencyCode}}A random currency codeUSD, EUR, JPY
{{$randomCurrencyName}}A random currency nameUS Dollar, Euro, Yen
{{$randomCurrencySymbol}}A random currency symbol$, €, ¥
{{$randomBitcoin}}A random Bitcoin address1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa

Business

Variable NameDescriptionExamples
{{$randomCompanyName}}A random company nameTechCorp Inc.
{{$randomCompanySuffix}}A random company suffixLLC, Inc., Ltd.
{{$randomBs}}A random business buzz phraserevolutionize end-to-end systems
{{$randomBsAdjective}}A random business adjectiveinnovative, scalable
{{$randomBsBuzz}}A random business buzz wordsynergize, leverage
{{$randomBsNoun}}A random business nounsolutions, platform
{{$randomCatchPhrase}}A random company catch phraseInnovate. Create. Transform.
{{$randomCatchPhraseAdjective}}A random catch phrase adjectiveinnovative, revolutionary
{{$randomCatchPhraseDescriptor}}A random catch phrase descriptornext-generation, cutting-edge
{{$randomCatchPhraseNoun}}A random catch phrase nounsolutions, platform

Database

Variable NameDescriptionExamples
{{$randomDatabaseColumn}}A random database column nameid, name, created_at
{{$randomDatabaseType}}A random database typevarchar, int, timestamp
{{$randomDatabaseCollation}}A random database collationutf8_general_ci, latin1_swedish_ci
{{$randomDatabaseEngine}}A random database engineInnoDB, MyISAM

Dates

Variable NameDescriptionExamples
{{$randomDateFuture}}A random future date2024-12-31T23:59:59.999Z
{{$randomDatePast}}A random past date2020-01-01T00:00:00.000Z
{{$randomDateRecent}}A random recent date2024-03-15T12:34:56.789Z
{{$randomWeekday}}A random weekdayMonday, Tuesday
{{$randomMonth}}A random monthJanuary, February

Files and System

Variable NameDescriptionExamples
{{$randomFileName}}A random file namedocument.pdf
{{$randomFileType}}A random file typeapplication/pdf
{{$randomFileExt}}A random file extension.pdf, .jpg
{{$randomCommonFileName}}A random common file namedocument.pdf
{{$randomCommonFileType}}A random common file typeapplication/pdf
{{$randomCommonFileExt}}A random common file extension.pdf, .jpg
{{$randomFilePath}}A random file path/path/to/file.txt
{{$randomDirectoryPath}}A random directory path/usr/local/bin
{{$randomMimeType}}A random MIME typeapplication/json

Commerce

Variable NameDescriptionExamples
{{$randomPrice}}A random price99.99, 149.95
{{$randomProduct}}A random productChair, Table
{{$randomProductAdjective}}A random product adjectiveErgonomic, Modern
{{$randomProductMaterial}}A random product materialWood, Metal
{{$randomProductName}}A random product nameErgonomic Wooden Chair
{{$randomDepartment}}A random department nameElectronics, Clothing

Hacker and Lorem

Variable NameDescriptionExamples
{{$randomNoun}}A random nounprotocol, interface
{{$randomVerb}}A random verbhack, override
{{$randomIngverb}}A random -ing verbhacking, overriding
{{$randomAdjective}}A random adjectivedigital, virtual
{{$randomPhrase}}A random phraseTry to reboot the SQL bus
{{$randomLoremWord}}A random Lorem Ipsum wordlorem, ipsum
{{$randomLoremWords}}Multiple Lorem Ipsum wordslorem ipsum dolor
{{$randomLoremSentence}}A random Lorem Ipsum sentenceLorem ipsum dolor sit amet.
{{$randomLoremSentences}}Multiple Lorem Ipsum sentencesLorem ipsum dolor sit amet. Consectetur adipiscing elit.
{{$randomLoremParagraph}}A random Lorem Ipsum paragraphLorem ipsum dolor sit amet…
{{$randomLoremParagraphs}}Multiple Lorem Ipsum paragraphsLorem ipsum dolor sit amet…\n\nConsectetur adipiscing elit…
{{$randomLoremText}}A random Lorem Ipsum textLorem ipsum dolor sit amet…
{{$randomLoremSlug}}A random Lorem Ipsum sluglorem-ipsum-dolor
{{$randomLoremLines}}Multiple Lorem Ipsum linesLorem ipsum dolor\nConsectetur adipiscing elit