testng not running in priority order when dependsOnMethods is specified

后端 未结 3 1109
旧巷少年郎
旧巷少年郎 2021-01-12 11:31

Whenever we specify priority and dependsOnMethods on a @Test annotated method, the order of execution of test methods is not according

3条回答
  •  -上瘾入骨i
    2021-01-12 11:44

    All independent methods (that do not have @dependsOnMethods dependency) will be executed first. Then methods with dependency will be executed. If there is ambiguity in execution order even after this ordering, priority comes into picture.

    This is the ordering scheme:

    1. Execute all independent methods (methods without @dependsOnMethods annotation)
    2. If there is ambiguity in this ordering use priority to resolve ambiguity for independent methods
    3. Execute dependent methods in order of dependency
    4. If there is ambiguity in this ordering use priority to resolve ambiguity for dependent methods
    5. If there is still ambiguity (due to not using priority or two methods having same priority) order them based on alphabetical order.

    Now all ambiguity is resolved since no two methods can have the same name.

提交回复
热议问题