doufutao4428 2018-05-06 14:43
浏览 905
已采纳

Testify Suite中SetupSuite和SetupTest之间的区别

I am trying to figure out difference between SetupSuite and SetupTest for quite some time now. Based on information on blogs I have understood that SetupSuite is run before entire suite and SetupTest runs before each test case. But what could be practical example in such a case? And how does dependency injection differ in both the cases?

  • 写回答

2条回答 默认 最新

  • douyaosi3164 2018-06-25 21:35
    关注

    Generally you want to use SetupTest so that each individual test function runs with a clean environment. SetupSuite is useful in cases where the setup code is time consuming and isn't modified in any of the tests. An example of when this could be useful is if you were testing code that reads from a database, and all the tests used the same data and only ran SELECT statements. In this scenario, SetupSuite could be used once to load the database with data.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看