<div dir="ltr">Hi,
<div><br></div><div>Currently pytest creates an item object for each of the testcase and then puts them in a list. During run phase it serially pics one item after the other and runs the testcases one after the other.</div><div><br>I have a requirement where the next testcase to run has to be chosen dynamically based on the pass or fail criteria of the previous testcase..</div><div><br></div><div>Say i logically arrange by testcases in a tree structure like below:</div><div><br></div><div><img src="cid:ii_15ffe4432caf8c4e" alt="Inline images 4" width="544" height="339"><br></div><div>So if Test_A passed then test_B can be executed or else Test_C has to be executed. And so forth.. </div><div><br></div><div><br></div><div>There could be a scenarios:</div><div><br></div><div>1. where say i may have to run a single level for multiple iterations to verify if i am getting a stable result at a particular level.</div><div><br></div><div>2. Say through some internal logic i selected Test_H and it has failed. I may now decide to run Test_F and see if it passes. </div><div><br></div><div><div><span style="color:rgb(6,40,126);font-family:Consolas,Menlo,&quot;Deja Vu Sans Mono&quot;,&quot;Bitstream Vera Sans Mono&quot;,monospace;font-size:15.3px;white-space:pre;background-color:rgb(238,238,238)">pytest_runtest_teardown </span>And seems to get the nextItem directly so how to control what is the nextItem to be executed.Is there any existing hook i can use to do this.. Or can i implement a new hook to do such things???<br></div></div><div><br></div><div><br></div></div>