持续改进:是否可以提前指定测试?
Continuous improvement: Is it possible to specify the tests in advance?
我习惯了 "old fashioned" 瀑布式开发周期。
对于一个新项目来说,持续集成似乎更符合我们的需求。
在瀑布中,您必须提前指定要实施的测试。
我的问题:
- 关于测试规范的持续集成开发周期的常用方法是什么?
- 如果你不指定测试,你能想出一种提前指定它们的方法吗?
非常感谢您的帮助。
在大学里,我们被教导说 "test driven development" 是有道理的,尤其是在有适当的编码规范的情况下。
如果您无法在编码前编写测试 -> 编码规范应该更具体/有问题。
我通常会根据 java 类 的编码规范编写单元测试,然后在我们的 jenkins 持续集成服务器上集成和执行。
如果我错了请原谅我,但这就是我学到的...
总是取决于所需的复杂程度java类,琐碎的"domain"类不需要大规格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.
}
在这种情况下,您可以在开始实现方法本身之前编写一些单元测试。
我希望这能让事情更清楚一些。
我习惯了 "old fashioned" 瀑布式开发周期。 对于一个新项目来说,持续集成似乎更符合我们的需求。
在瀑布中,您必须提前指定要实施的测试。
我的问题:
- 关于测试规范的持续集成开发周期的常用方法是什么?
- 如果你不指定测试,你能想出一种提前指定它们的方法吗?
非常感谢您的帮助。
在大学里,我们被教导说 "test driven development" 是有道理的,尤其是在有适当的编码规范的情况下。
如果您无法在编码前编写测试 -> 编码规范应该更具体/有问题。
我通常会根据 java 类 的编码规范编写单元测试,然后在我们的 jenkins 持续集成服务器上集成和执行。
如果我错了请原谅我,但这就是我学到的...
总是取决于所需的复杂程度java类,琐碎的"domain"类不需要大规格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.
}
在这种情况下,您可以在开始实现方法本身之前编写一些单元测试。
我希望这能让事情更清楚一些。