Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

robotframework - Can we force run a test case in robot framework?

I have a prerunmodifier file which removes certain test cases depending upon certain conditions. But, sometimes I want to force execute a tag even though it is removed by the prerunmodifier. Is there an option in Robot Framework to achieve the same?

Example:

This is a sample testcase
    [Tags]  ABC  Test_123
    Test step 1
    Test step 2
    .
    .
    .

Suppose the prerunmodifier removes the testcase with tag "ABC". The above test case will be excluded. But in some scenario I will want to run testcase with tag "Test_123". But if it is already removed by prerunmodifier when I mention the tag name "Test_123" under "--include" section this test case will not be available for execution and I will not be able to run the test case. Is there any option to handle such scenarios?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If a test case is removed by a prerun-modifier, then when the framework arguments come in to play the removed test case is like it never existed in the current scope. In other words there is no way to re-include the test case after the modifier was executed.

You have to solve this in the prerun-modifier possibly by providing extra parameters to it. You should pass the condition, for example tag Test_123 to override the removal of a test if the condition is met.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...