testing - 持续改进 : Is it possible to specify the tests in advance?

标签 testing continuous-integration specifications

我习惯了“老式”的瀑布式开发周期。 对于一个新项目,持续集成似乎更符合我们的需求。

在瀑布中,您必须提前指定要实现的测试。

我的问题:

  • 关于测试规范的持续集成开发周期的常用方法是什么?
  • 如果您不指定测试,您能想出一种提前指定它们的方法吗?

非常感谢您的帮助。

最佳答案

在大学里,我们被教导“测试驱动开发”是有道理的,尤其是在有适当的编码规范的情况下。

如果您无法在编码前编写测试 -> 编码规范应该更具体/有问题。

我通常会根据我的 java 类的编码规范编写单元测试,然后在我们的 jenkins 持续集成服务器上集成和执行。

如果我错了请原谅我,但这就是我学到的...

它总是取决于所需 java 类的复杂性,琐碎的“域”类不需要大规范 info

在大多数情况下,我们尝试指定类或方法应该如何工作(用文字),并写下一些示例值。

假设您应该编写一个方法来检查值是否在特定范围内:

// Example Specification:
// the method 'checkIfItsInRange' should return true when : the input lies within the range and it should be devidable by the distance value 
// Lets say the range goes from -30,00 to +30,00 with a distance from 0,25
// valid values :30, -30, 15.25, 15.50, 17.75 etc. -> return true
// invalid : -31, -30.01, +30.08, 0.4 etc. -> return false
// MissingParameterException when one of the Parameters is null

public boolean checkIfItsInRange throws MissingParameterException (BigDecimal from, BigDecimal to, BigDecimal distance, BigDecimal input) {
        // TODO implement depending on spec.
}

在这种情况下,您可以在开始实现方法本身之前编写一些单元测试。

我希望这能让事情变得更清楚一些。

关于testing - 持续改进 : Is it possible to specify the tests in advance?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52949402/

相关文章:

unit-testing - 如何使用golang实现单元测试程序?

r - 检查 R 中的日期是否为空?

docker - Gitlab CI/CD Runner 错误 : "unrecognized import path" GOLANG

git - 如何为 nuget 包设置 Azure DevOps CI 构建/发布管道(高级)

r - "matrix-like?"的(精确)含义是什么

c# - C# 是否强制 `unmanaged` 类型为 "blittable"?

ruby-on-rails - 如何使用 rspec 在路由规范中指定 https 协议(protocol)?

testing - 使用 Cypress 重定向

web-services - 如何在服务器端对使用 JSON restful web 服务构建的 web 应用程序进行负载测试?

continuous-integration - 在 hudson/jenkins 中加入了 "Build other projects"的控制台输出