visual-studio-2013 - 可以在 Visual Studio 2013 负载测试中使用 Specflow 场景

标签 visual-studio-2013 load-testing specflow

我还计划将现有的 Specflow 场景(目前用于验收和自动化测试)用于 VS 负载测试,以避免重复和额外的工作。 Specflow 适用于这些测试,因为它只运行一次,但在负载测试的上下文中,当它多次执行每个 Specflow 场景并并行运行时会遇到问题和错误,并且随着用户数量的增加,它会得到更多

这些错误可能会导致某些测试失败,最终会产生不正确的测试结果,例如使用一个 Specflow 场景作为测试场景,负载测试为 20 个用户,2 分钟的时间段可能会导致 50 个类似于以下的错误。所以测试结果显示特定场景执行了 200 次,其中 150 次通过,50 次失败,失败是由 Specflow 错误引起的。在负载测试的上下文中,此结果完全错误且不正确,因为测试本身存在问题。

错误信息:

ScenarioTearDown threw exception. System.NullReferenceException: System.NullReferenceException: Object reference not set to an instance of an object.
TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.HandleBlockSwitch(ScenarioBlock block)
TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.ExecuteStep(StepInstance stepInstance) TechTalk.SpecFlow.Infrastructure.TestExecutionEngine.Step(StepDefinitionKeyword stepDefinitionKeyword, String keyword, String text, String multilineTextArg, Table tableArg)
TechTalk.SpecFlow.TestRunner.Then(String text, String multilineTextArg, Table tableArg, String keyword)

经过一些调查,似乎 Specflow 无法生成并并行运行相同的场景,这导致了此冲突并未能通过某些测试,但我对此也有一些疑问,并试图查看是否有任何解决方法,或者我是否遗漏了任何内容并想知道 Specflow场景可以用于负载测试吗?

最佳答案

我理解想要重用您的测试进行负载测试(不要重复自己),但是负载测试与验收测试的目的非常不同。负载测试应该采用现实的日常使用场景,并让越来越多的用户参与其中。出于这个原因,我敦促您将负载测试与验收测试和自动化测试分开。他们确实在测试不同的东西。

负载测试应该测试应用程序在每天高使用率下的性能,验收和自动化测试确保应用程序按照规范运行。

Load testing is the process of putting demand on a system or device and measuring its response. Load testing is performed to determine a system’s behavior under both normal and anticipated peak load conditions. It helps to identify the maximum operating capacity of an application as well as any bottlenecks and determine which element is causing degradation.



来源:Wikipedia: Load testing

An acceptance test is a formal description of the behaviour of a software product, generally expressed as an example or a usage scenario. ... For many Agile teams acceptance tests are the main form of functional specification; sometimes the only formal expression of business requirements. In other cases, they merely complement a specification document resulting from a less specifically Agile technique or formalism, such as uses cases or more narrative documents.



来源:Agile Aliance: Acceptance Testing

它们是不同的东西,所以测试和测试框架也应该不同。通过为负载测试保留一个单独的套件,您并没有真正“重复自己”。

至于为什么会失败的技术原因? SpecFlow 在使用普通 Visual Studio 测试运行器运行时,并不是为并行运行测试而构建的。有可用的并行测试运行器,但大多数是付费软件。

关于visual-studio-2013 - 可以在 Visual Studio 2013 负载测试中使用 Specflow 场景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27816904/

相关文章:

c# - 带有 NUnit 的 SpecFlow : SetUp method runs twice

c++ - VS13 C++ 贪心匹配不够贪心

c++ - VS2013 中的 Variadic 模板解析 - 错误 C3520

mysql - 你如何用MySQL模拟内存不足?

java - RMI 负载测试工具?

c# - SpecFlow IObjectContainer : How to register and consume multiple objects of the same type?

c# - “System.Data.Entity.ModelConfiguration.ModelValidationException”出现在 EntityFramework.dll 中,但未在用户代码中处理

visual-studio-2013 - UnityVS 无法附加到 Unity Editor - Visual Studio 2013 Community Edition

python - 使用 python 在 API 上进行负载测试

coded-ui-tests - BeforeFeature/AfterFeature 不能使用 SpecFlow 和编码的 UI