For AI agents and LLMs: a machine-readable index is available at llms.txt. A plain-Markdown version of any documentation page is available by appending .md to its URL.
Skip to main content

Grouping Screenshots through Build Names

SmartUI CLI allows you to group screenshots in a build name and append new screenshots to an existing build. This feature enables you to assign build names, add screenshots to existing builds and manage your visual tests efficiently.

Prerequisites

  • Basic understanding of Command Line Interface
  • Login to TestMu AI SmartUI with your credentials.
  • Ensure you are using @lambdatest/smartui-cli version 4.1.43 or higher
  • A properly configured SmartUI CLI project
note

If you face any problems executing tests with SmartUI-CLI versions >= v4.x.x, upgrade your Node.js version to v20.3 or above.

Step 1: Install SmartUI CLI

If you haven't already installed SmartUI CLI, install it using npm:

Global Installation (Recommended):

npm install -g @lambdatest/smartui-cli

Local Installation:

npm install @lambdatest/smartui-cli

Step 2: Configure your Project Token

Setup your project token shown in the SmartUI app after creating your project.

export PROJECT_TOKEN="123456#1234abcd-****-****-****-************"

Step 3: Execute Tests with custom Build Names

You can add a custom build name by adding the --buildName flag to your test execution command. Here are different ways to use this feature:

Custom Build Name (Expected Usage)

Specify a custom build name to group your screenshots in the following way:

npx smartui --config .smartui.json exec --buildName "Sample Build Name" -- <execution-command>

Example: For a Node.js test script :

npx smartui --config .smartui.json exec --buildName "Sample Build Name" -- node test.js

Default Usage

If no buildname is specified, a random build name is added to the builds:

npx smartui --config .smartui.json exec -- <execution-command>

Step 4: Advanced Use Case

If you are running multiple test cases in a single job (e.g., using HyperExecute) and want to club all screenshots under a single build while maintaining consistent Git baseline management, you can do the following:

This can be done as follows:

npx smartui --config .smartui.json exec --buildName $env:JOB_ID -- node test.js

Key Benefits

  • Efficient Grouping: Screenshots are grouped by build names, improving organization and traceability.
  • Seamless Git Integration: Integrates smoothly with Git to maintain baseline integrity across branches.
  • Flexible Updates: Allows appending screenshots to existing builds, enhancing adaptability.
  • Optimized Workflows: Supports streamlined operations for both parallel and single-job executions.

Conclusion

This approach provides a structured and efficient way to manage visual tests:

  • New Build for Each HyperExecute Job: A dedicated build is created for every HyperExecute job, ensuring clear separation and traceability.
  • Consolidated Screenshot Grouping: Screenshots from all tests within the same job are appended to a single build for seamless organization.
  • Uninterrupted Git Workflow: Git branching strategies remain unaffected, enabling robust baseline management across branches.

Additional Resources

Test across 3000+ combinations of browsers, real devices & OS.

Book Demo

Help and Support

Related Articles