问题标签 [test-framework]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
19736 浏览

javascript - javascript中的断言库,测试框架和测试环境有什么区别?

Chai是一个断言库。

MochaJasmine是测试框架。

Karma是一个测试环境。

我已经阅读了可用测试框架之间的区别:mocha、chai、karma、jasmine、should.js 等

0 投票
1 回答
3184 浏览

python - In Robot Framework, in the test case teardown phase, how to check whether the current test case is fail or pass?

In Robot Framework test case, we can create Teardown phase to do clean-up activities.


In the Teardown phase, how can we check whether the current test case is Pass or Fail?

I would like to do something when the test case Pass, and do something else when the test case Fail.

0 投票
1 回答
63 浏览

testing - 当我们在现有测试用例中间添加一个新测试用例时,测试框架会如何表现?

我有一个关于自动化框架的问题,假设我有 1000 个测试用例。我在中间添加了一个新的测试用例。

例如,我有 1000 个测试用例。我在中间(第 501 个)添加了一个测试用例。我在框架中可能面临哪些问题?

- 如果所有 1000 个 TC 之间都有一些依赖关系,我预计它可能会破坏执行顺序。除了这个问题,我无法找出任何其他可能的问题,请帮助我找出可能导致此处所有 TC 执行问题的问题。

0 投票
1 回答
1489 浏览

c# - Testing Event driven behavior

There seems to be a ton of advice for this sorta thing in the context of a GUI application. I think my particular scenario is different enough to warrent me asking. To sum up my question how do you test events?

Now for the long winded explanation. I've worked with Point of Service hardware for a little while now. This means that I had to write a few OPOS Service Objects. After a few years of doing that I managed to write my first COM visible C# service object and put it into production. I tried my best to unit test the entire project but found it rather difficult, but was able to come up with good unit tests for most all of the Service Object's interface implementation. The hardest part was the Event's part. Granted this scenario was the biggest and most common one that I faced, but I've come across similar scenarios in other applications of mine where testing for an event just seemed awkward. So to set the scene the Common Control object (CO) has at most 5 events that a person can subscribe too. When the CO calls the method Open OPOS finds the Service Object (SO) and creates an instance of it, then calls it's OpenService method. The third parameter of the SO is a reference to the CO. Now I don't have to define the entire CO, I only have to define the call back method for those 5 events. An example of the msr's definition is this

and my OpenService method would have this line of code

So I thought to myself for better testing, lets make a ControlObjectDispatcher. It will allow me to enqueue events, then fire them to the CO when conditions are correct. This is where I'm at. Now I know sorta how to test drive the implementation of it. But it just feels wrong. Lets take the DataEvent as an example. 2 conditions have to be met for a DataEvent to be fired. First the boolean property DataEventEnabled must be true, and the other boolean property FreezeEvents must be false. Also all events are strictly FIFO. So.. a Queue is perfect. And since I've written this before I know what the implementation will be. But writing a test for it that instills confidence to a new person to the project is difficult. Consider this pseudo code

Everyone reading this hear could wonder (without knowing the implementation) How do i know that say after 1 minute that this event fires? How do I know that that crazy Robert Snyder person didn't use a for loop and forget to exit the FireDataEvent routine after the iterations were all up? You really don't. Granted you could test for a minute.. but that defeats the purpose of a unit test.

So to sum up again... How does a person write a test for events? Events can fire whenever.. and they can sometimes take longer to process and fire then expected. I've seen in my integration tests for the first implementation of this where if I didn't sleep for say 50ms before asserting that an event was called then the test would fail with something like. expected data event to have fired, but was never fired Are their any test frameworks built for events? Are their any common coding practices that cover this?

0 投票
3 回答
402 浏览

testing - 如何测试专有网络协议

我有一个要测试的系统,该系统处理专有网络协议(需要检查)。测试的协议基于 TCP 和 UDP。

我正在寻找一种可以安装在我的 OS-X/Linux/Windows 计算机上的软件,将其连接到我要测试和注入协议消息并分析反馈的系统(软件应该能够比较每条收到的消息,如果它是预期的等等)。

更喜欢具有漂亮 GUI 和开源的软件,这样我可以在需要时添加功能(可能是付费软件)。

我应该从哪里开始?

0 投票
1 回答
208 浏览

java - 使用单例设计模式实现解决方案的建议

我需要实现一个解决方案作为测试框架的一部分,我正在考虑单例模式,原因如下所述。但是,我无法实现我想要的解决方案,因此需要一些关于可能实现的建议/输入。

问题陈述: 我有一个环境(我正在测试的产品的环境)配置属性文件,我想加载该文件并使测试框架可以全局访问参数的值。我想使用单例模式,因为这些属性是一次性值(如果尝试多次初始化,应该报告异常),应该全局可用并且可以单点访问这些方法。

但是,属性/参数列表非常长,因此将其分解为模块(类)是明智的。对于下面的解释,我尝试了作文。

例如

PS:只是一个示例输入代码,用于理解我的问题陈述。

期望:现在的期望是,在尝试获取主机名时,我应该通过 Configuration 静态对象进行单点访问(假设我已成功初始化所有成员变量),即

字符串主机名 = Configuration.getHostname();

或者

字符串主机名 = Configuration.getConfigObject().getHostname();

当前问题: 如何创建一个静态对象,该对象将使用组合或继承来引用所有方法(从概念上讲,组合是正确的方法)。

多重继承本来可以解决这个问题,但 Java 不支持这样排除。也不能考虑接口,因为重写所有方法既乏味又冗长,而且参数/方法会随着时间的推移而不断变化。

欢迎所有建议,即使它需要放弃这种设计模式并尝试不同的东西。

0 投票
2 回答
215 浏览

oracle - 有关 Oracle Siebel 测试的查询

我是 Oracle Siebel 测试的新手。我已经阅读了可用于测试 Siebel 的 Oracle Application Testing Suite。

我浏览了有关应用程序测试套件的 Oracle 视频,发现以下可用于 Siebel 测试: 1. 使用 openscript 的 Oracle 功能测试 (OFT) 2. Oracle 负载和性能测试

我浏览了以下链接: https://blogs.oracle.com/aamat/entry/siebel_test_automation http://download.oracle.com/oll/tutorials/ATS9_Siebel_Testing_Accelerators/041210_88547/index.htm http://www.oracle .com/technetwork/oem/grid-control/overview/twp-ats-test-siebel-133042.pdf http://www.oracle.com/technetwork/oem/grid-control/overview/ds-application-1。 pdf

我有以下疑问:

  1. 是否有任何其他有效的测试 Siebel 应用程序的方法,或者 ATS 是开始 Siebel 的最佳方法。

  2. 另外,可以在 ATS 中使用的框架有哪些?

  3. 是否有可用于 Siebel 的示例 ATS 框架?

  4. 是否有任何指南或演练可以帮助进行 POC?

请帮忙。

提前致谢

0 投票
1 回答
1295 浏览

c# - 通过 API 测试测量 C# .net 代码覆盖率

我很高兴在一个单元测试覆盖率为零且代码不可测试的项目中工作。当前唯一存在的测试是使用 REST/SOAP 接口的 API 测试。现在我问自己是否有可能通过 API 调用代码来测量代码/分支/行覆盖率。最后,我必须生成一份关于项目中涉及的每个文件的覆盖率百分比报告。

0 投票
1 回答
418 浏览

haskell - 如何在 Haskell 的测试框架中打印测试种子?

test-framework文档声明它支持“报告在 QuickCheck 运行失败时使用的种子,因此您可以在必要时重现失败。” 但是默认输出不显示这个,我找不到任何可以打开它的命令行选项。

有没有办法做到这一点test-framework,还是我必须usedSeed从 QuickCheck 手动打印?

0 投票
1 回答
1036 浏览

visual-studio - 如何让 NUnit GUI 测试运行程序从 Visual Studio 中可用?

我将 NuGetted NUnit (v 3.0.1) 和 NUnit Test Adapter (v 2.0.0) 放入我的 VS 2013 项目中,然后编写了一个允许我运行测试的类:

...但是我找不到要运行的 NUnit GUI,正如这里所说的。

我也尝试遵循这个,但无法在任何地方调用甚至找到 NUnit 测试运行器。在我的硬盘中搜索“NUnit.exe”没有找到匹配项。

当我尝试使用“ C:\Projects\RoboReporter\RoboReporter\packages\NUnit.3.0.1\lib\net45\nunitframework.dll ”作为外部程序启动时,Visual Studio 不允许它(因为它是一个 . DLL 并且需要一个 .exe,我猜)。

是否有一些我要省略的设置步骤?我什至(在通过 NuGet 安装它之后)进入工具 > 扩展和更新并从那里安装 NUnit 测试适配器,但我仍然在任何地方都看不到 NUnit 的迹象(尽管我的项目中有一个 NUnit.3.0.1 文件夹包文件夹))。

更新

我意识到我做错了;我在我的解决方案(一个类库)中添加了一个新项目,并从这里安装了应该是 NUnit GUI Runner 的东西。尽管如此,我还是没有看到这样的动物。“所有程序”没有它;这篇文章声称有一个链接,但该链接不是“实时”的,所以我搜索了“下载 NUnit GUI Test Runner”并下载/安装了 NUnit.3.0.1.msi,正如 TS 推荐的那样

突出显示我的测试项目,选择测试 | 窗户 | 测试资源管理器显示没有测试。我对如何让 NUnit 可操作感到困惑 [ck,mped]。

更新 2

我发现了这个,这似乎很有希望,但我在我的 NuGet 管理器中没有看到 NUnit 的“降级”选项;安装后,“卸载”是唯一存在的按钮,并且没有允许降级的下拉菜单或其他控件...