当灯具需要知道预期结果以执行测试时,使用Concordion assertFalse命令.
考虑以下要求 :
User Name : Robert DeThe User name does not start with S.
如果我们想要在用户名上执行测试并检查用户名是否不以S开头.
User Name :Robert De
The User name does not start with S.
当Concordion解析文档时,它会将临时变量#userName设置为值"Robert De".然后,它将检查userName是否以下一个命令中#letter变量set指定的字母开头.
示例
让我们一起工作Eclipse IDE就位并按照下面给出的步骤创建一个Concordion应用程序 :
步骤 | 描述 |
---|---|
1 | 创建一个名为 concordion 的项目,并在 src 文件夹下创建一个包 com.it1352在创建的项目中. |
2 | 使用 |
3 | 在 com.it1352包下创建Java类系统. |
4 | 在规格下创建Fixture类 SystemFixture . it1352包. |
5 | 创建规范html System.html 在 specs.it1352包下. |
6 | 最后一步是创建所有Java文件和规范文件的内容并运行应用程序,如下所述. |
这是System.java文件的内容 :
package com.it1352; public class System { }
以下是SystemFixture.java文件的内容 :
package specs.it1352; import org.concordion.integration.junit4.ConcordionRunner;import org.junit.runner.RunWith;@RunWith(ConcordionRunner.class)public class SystemFixture {}
以下是System.html文件的内容 :
System Specifications
We are building specifications for our online order tracking application.
Following is the requirement to split full name of a logged in user to its constituents by splitting name by whitespace:
Example
User Name :Robert De
The User name does not start with S.
完成创建源文件和规范文件之后,让我们将应用程序作为JUnit Test运行.如果您的应用程序一切正常,那么它将产生以下结果 :
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\concordion\specs\IT屋\System.htmlSuccesses: 1, Failures: 0
System.html是Concordion测试运行的输出.