How to design data driven dependent scenarios testing?

梦想与她 提交于 2020-07-16 10:45:06

问题


I read its NOT best practice to write dependent test scenarios. But what if an application is heavily data-driven and manipulates (creates, multiple update flows, logically deletes) data. Basically, we want to minimize:

  1. Test data creation for each dependent scenario (ex. updates need creation of data first)
  2. re-execution of steps
  3. Overall test suite execution time

Question: In order to control the execution of threads, can I can extend Karate core classes which handles @parallel=false and add custom code which considers 'Depends on Scenario' ? Is there a better/alternate design? Please suggest.

Example:

  • Scenario1 : Create T1, T2 [Parallel]
  • Scenario2 : Create T3 [Parallel]
  • Scenario3 : Create R1(relationship between T1 and T2)which updates T1, T2 [Sequential: wait until 1]
  • Scenario4 : Create R2(relationship between T1 and T3) which updates T1, T3 [Sequential:wait until 1,2]
  • Scenario5 : Delete R1 which updates T1,T2 [Sequential: wait until 1,3]
  • Scenario6 : Delete T1 which deletes R1,R2 [Sequential: wait until 1,4,5]

回答1:


There is no "magic" you have to either:

a) write "flows" that set up data at the start (this is what a Background is for) and test all the expected conditions

b) write tests that are "smart" and are immune to the starting state of the database. for example, do a GET, see how many customers already exist, and then calculate expected count. but this can be affected by parallel threads unless each thread is designed to work on a different set of customers (partition by e.g. organization)

As a reminder, read this: https://github.com/intuit/karate#script-structure



来源:https://stackoverflow.com/questions/62494745/how-to-design-data-driven-dependent-scenarios-testing

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!