{{ message }}
Add "Get Variable Type" keyword to BuiltIn library#5683
Open
b-vamsipunnam wants to merge 1 commit into
Open
Conversation
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Adds a new BuiltIn keyword
Get Variable Typethat returns the runtime type of a value using Robot Framework friendly type names.Motivation
Robot Framework currently lacks a direct BuiltIn keyword for inspecting the runtime type of a value. Users typically rely on Python evaluation syntax:
${type}= Evaluate type($value).__name__While functional, this mixes Python-specific syntax into test data, reduces readability for non-Python users, and is less discoverable than a dedicated keyword.
The new keyword offers a cleaner, more self-documenting alternative:
This is particularly useful for dynamic test data handling, building reusable and generic keywords, debugging variables, and implementing type-aware logic in keyword-driven and data-driven automation.
Implementation
Added
Get Variable Typekeyword insrc/robot/libraries/BuiltIn.pyReturns normalized, user-friendly type names:
stringintegerfloatbooleanlistdictionarytuplesetnoneReturns
objectfor custom classes and other unsupported typesProperly handles
boolbeforeintbecauseboolis a subclass ofintin PythonTests
Added acceptance tests covering:
Files Changed
src/robot/libraries/BuiltIn.pyatest/testdata/standard_libraries/builtin/get_variable_type.robotatest/robot/standard_libraries/builtin/get_variable_type.robotRelated Issues
No existing issue found.
Thank you for your review and feedback.