栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

setUp()和setUpBeforeClass()之间的区别

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

setUp()和setUpBeforeClass()之间的区别

@BeforeClass
@AfterClass
注解的方法将你的测试运行期间只有一次运行-
在测试整体的开始和结束,什么都运行之前。实际上,它们是在构建测试类之前运行的,这就是为什么必须声明它们的原因
static

@Before
@After
方法将在每次测试案例之前和之后运行,所以在测试运行期间可能会多次运行。

因此,假设您在类中进行了三个测试,则方法调用的顺序为:

setUpBeforeClass()  (Test class first instance constructed and the following methods called on it)    setUp()    test1()    tearDown()  (Test class second instance constructed and the following methods called on it)    setUp()    test2()    tearDown()  (Test class third instance constructed and the following methods called on it)    setUp()    test3()    tearDown()tearDownAfterClass()


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/497485.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号