Package: robotframework-tags-parameters
robotframework-tags-parametersDescriptionThis project want simplify the complexity of initialisation and test by send
data with tag.This project can convert robotframework tag to dictionary. For this, the project
use jsonschema for declare and annotate tag.Example*** Setting ***LibraryTagsParametersTest SetupGeneric Test Setup*** Test Case ***Test1[Tags]foobarno-resetname:FOONo OperationTest2[Tags]resetname:BARNo OperationTest3[Tags]foobarNo Operation*** Keyword ***Generic Test Setup${result}=Convert Tags To Dict${CURDIR}/schema_file.jsonRun Keyword If${result.foo}Keyword1Run Keyword If"${result.name}" == "BAR"Keyword2...InstallationUse the package managerpipto install foobar.pipinstallrobotframework-tags-parametersUsageImport the library into you project*** Setting ***LibraryTagsParametersLibraryCollections*** Test Case ***Test[Tags]foobarno-resetname:FOO${result}=Convert Tags To Dict${CURDIR}/schema_file.jsonLog${result}Dictionary Should Contain Item${result}foo${True}Dictionary Should Contain Item${result}nameFOODictionary Should Contain Item${result}reset${False}Use the json schema for description tags structure:{"description":"My Tags","type":"object","properties":{"foo":{"type":"boolean"},"name":{"type":"string"},"reset":{"type":"boolean","default":true,"false-prefix":"no"}}}Tags schemaBooleanSimple boolean can be declared with the next jsonschema. By defaultfooisfalse:{"description":"My Tags","type":"object","properties":{"foo":{"type":"boolean"}}}For setfoo:*** Test Case ***True Foo[Tags]fooShould Be Equal${result.foo}     ${True}Default TagsShould Be Equal${result.foo}     ${False}If you want by default,trueboolean,you can usedefaultattribute.
For declarefalsewith tag, you need usefalse-prefixattribute.false-prefixcan be take anybody value.{"description":"My Tags","type":"object","properties":{"foo":{"type":"boolean","default":false,"false-prefix":"no"}}}For setfoo:*** Test Case ***False Foo[Tags]no-fooShould Be Equal${result.foo}     ${False}True Foo[Tags]fooShould Be Equal${result.foo}     ${True}Default TagsShould Be Equal${result.foo}     ${True}You can change too, the prefix fortruevalue withtrue-prefixattribute.true-prefixcan be take anybody value.{"description":"My Tags","type":"object","properties":{"foo":{"type":"boolean","true-prefix":"with","false-prefix":"without"}}}For setfoo:*** Test Case ***False Foo[Tags]without-fooShould Be Equal${result.foo}     ${False}True Foo[Tags]with-fooShould Be Equal${result.foo}     ${True}Default TagsShould Be Equal${result.foo}     ${False}StringSimple string can be declared with the next jsonschema. By defaultfooisNone:{"description":"My Tags","type":"object","properties":{"foo":{"anyOf":[{"type":"string"},{"type":"null"},]}}}For setfoo:*** Test Case ***Tag Foo with BAR value[Tags]foo:BARShould Be Equal${result.foo}BARDefault TagsShould Be Equal${result.foo}     ${{None}}You can use too atype checkingas like:{"description":"My Tags","type":"object","properties":{"foo":{"type":"string","maxLength":3}}}For setfoo:*** Test Case ***Tag Foo with BAR value[Tags]foo:BARShould Be Equal${result.foo}     ${BAR}Tag Foo with BAAR value[Tags]foo:BAAR[Documentation]Validation Error is throwIntegerSimple string can be declared with the next jsonschema.:{"description":"My Tags","type":"object","properties":{"foo":{"type":"integer","default":"0"}}}For setfoo:*** Test Case ***Tag Foo[Tags]foo:5Should Be Equal${result.foo}     ${5}Default TagsShould Be Equal${result.foo}     ${0}Default ValueDefault value can be declared with the next jsonschema. By defaultfoois${EMPTY}:{"description":"My Tags","type":"object","properties":{"foo":{"type":"string","default":""}}}For setfoo:*** Test Case ***Tag Foo with BAR value[Tags]foo:BARShould Be Equal${result.foo}BARDefault TagsShould Be Equal${result.foo}     ${EMPTY}JsonSchemaFor more explication into jsonschema, seehttps://json-schema.org/You can too seeargparse-from-jsonschemaContributingPull requests are welcome. For major changes, please open an issue first
to discuss what you would like to change.Please make sure to update tests as appropriate.TestsRun tests with tox command :tox
tox-etestsacc