Depends On Test + [Template]

Hi,

I was refactoring a test case that may depend on another test, but I need to introduce a [Template] as part of the refactor. I receive an error (Unexpected argument: Do something A) when trying to use the Depends On Test line.

Example:

Test Do something B
    [Tags]  TAG-A  TAG-B
    [Documentation]  Some documenation
	Depends On Test  Do something A
    [Template]  Method that does some things with the data from the test case
    ${test_item_t01}
    ${test_item_t02}
    ${test_item_t03}
    ${test_item_t04}
    ${test_item_t05}

You missed the continuation marker on the Documentation section:

Test Do something B
    [Tags]  TAG-A  TAG-B
    [Documentation]  Some documenation
    ...    Depends On Test  Do something A
    [Template]  Method that does some things with the data from the test case
    ${test_item_t01}
    ${test_item_t02}
    ${test_item_t03}
    ${test_item_t04}
    ${test_item_t05}

Hi HelioGuilherme66,

Thanks for your response, but my intention is not to have the line Depends On Test Do something A to be part of the documentation, my intention is to have this line be functional, as I described initially.

I would like Test Do something B to depend on Test Do something A and also make use of a [Template] and it does not seem to be working.

I should perhaps add my environment details:

Python Release Python 3.10.0
IntelliJ IDEA 2023.2.4 (Community Edition)
robocorp.lsp.intellij (1.11.0)
PythonCore (232.10203.2)

You need to store the data from test A (in a file for example), and set a tag indicating the success of test A. Then in test B, usually at Setup, you check the tag from test A and proceed.

The way you are planning to do, is not possible because Robot Framework does not have that feature.

1 Like