gpt4 book ai didi

AUnit - Usefullness of the `Test_Caller` package(A`TEST_CALER`程序包的有用性)

转载 作者:bug小助手 更新时间:2023-10-25 17:47:48 26 4
gpt4 key购买 nike



There seem to be two different ways to do the same thing when using the AUnit library:

在使用AUnit库时,似乎有两种不同的方法来完成相同的任务:


Using the AUnit.Test_Cases.Test_Case type, creating some function tests, then register each tests with the AUnit.Test_Cases.Register_Tests function. We can then add this Test_Case to a Suite using the function AUnit.Test_Suites.Add_Test.

使用AUnit.Test_Cases.Test_Case类型,创建一些函数测试,然后使用AUnit.Test_Cases.Register_Test函数注册每个测试。然后,我们可以使用函数AUnit.Test_Suites.Add_Test将此测试用例添加到套件中。


There some example of this:

这里有一些这样的例子:



(Surprisingly, there no examples using this way in the AUnit repository.)

(令人惊讶的是,在AUnit存储库中没有使用这种方式的示例。)


The other way is to use the AUnit.Test_Fixtures.Test_Fixture type, creating some function tests. These tests can then be added to a Suite using the generic package AUnit.Test_Caller with the functions AUnit.Test_Suites.Add_Test and AUnit.Test_Caller.Create.

另一种方法是使用AUnit.TestFixtures.TestFixtures.TestFixture类型,创建一些功能测试。然后,可以使用通用程序包AUnit.Test_Caller将这些测试添加到套件中,该程序包带有函数AUnit.Test_Suites.Add_Test和AUnit.Test_Call.Create。


I can see way of using Test_Caller in:

我可以在以下位置看到使用Test_Caller的方法:



The only difference I can see is that, when using the AUnit.Test_Cases.Test_Case, you can override the Set_Up_Case, Set_Up, Tear_Down and Tear_Down_Case functions. While with the AUnit.Test_Fixtures.Test_Fixture you can only override the Set_Up and Tear_Down functions (because the tests are not group under a Test_Case).

我能看到的唯一区别是,在使用AUnit.Test_Cases.Test_Case时,您可以覆盖Set_Up_Case、Set_Up、tear_Down和tein_Down_Case函数。而使用AUnit.Test_Fixtures.Test_Fixture时,您只能覆盖Set_Up和tein_Down函数(因为测试不在Test_Case下分组)。


Appart from that, I don't really see much difference.

除此之外,我真的看不出有什么不同。


So, what is the use of the AUnit.Test_Fixtures.Test_Fixture type with the generic package AUnit.Test_Caller ? Why would use this over the (simpler ?) AUnit.Test_Cases.Test_Case type ?

那么,AUnit.TestFixtures.TestFixture类型与泛型包AUnit.TestCaller有什么用处呢?为什么要用这个而不是(更简单的?)AUnit.Test_Case.测试用例类型?


Every example I have seen in one format can be transformed into the other (the Set_Up_Case and Tear_Down_Case set appart). Could give an example which use one but cannot be done by the other ?

我看到的每一种格式的示例都可以转换为另一种格式(SET_UP_CASE和TREE_DWN_CASE集合appart)。可以举一个使用其中一个但另一个做不到的例子吗?


更多回答

See also 7.2. OOP considerations, which contrasts the two in the same context.

另请参见7.2。OOP注意事项,将两者在相同的上下文中进行对比。

优秀答案推荐
更多回答

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com