English 中文(简体)
Concordion - set Command
  • 时间:2024-03-24 20:03:45

Concordion - set Command


Previous Page Next Page  

调和板指令用于储存可用于其他协约指挥部的临时变量。

考虑以下要求:

The Sum of two numbers 2 and 3 will be 5.

如果我们想把第2和第3号作为参数,将其作为参数,并将其转化为参数,以便能够根据系统退回的结果加以核实,那么我们就能够使用和谐:在数字的交汇范围内进行指挥。

<p>The Sum of two numbers <span concordion:set = "#firstNumber">2</span> 
   and <span concordion:set = "#secondNumber">3</span> will be 
   <span concordion:assertEquals = "sum(#firstNumber, #secondNumber)">5
   </span>.</p>

当《协约》对文件进行分类时,它将确定一个临时变量编号为“2”和2Number,其数值为“3”,然后称为“数额()”方法,其参数为“tNumber和#secondNumber”,并核实结果等于“5”。

Example

让我们有一个行之有效的电子数据交换所,并遵循以下步骤,以建立一项协调适用——

Step Description
1 Create a project with a name concordion and create a package com.tutorialspoint under the src folder in the created project.
2 Add the required Concordion pbraries using Add External JARs option as explained in the Concordion - First Apppcation chapter.
3 Create Java class System under the com.tutorialspoint package.
4 Create Fixture class SystemFixture under the specs.tutorialspoint package.
5 Create Specification html System.html under the specs.tutorialspoint package.
6 The final step is to create the content of all the Java files and specificiation file and run the apppcation as explained below.

这里是该系统的内容。 java文档

package com.tutorialspoint;
pubpc class System {
   pubpc int sum(int firstNumber, int secondNumber) {
      return firstNumber + secondNumber;
   }
}

以下是该系统的内容。 java文档

package specs.tutorialspoint;

import org.concordion.integration.junit4.ConcordionRunner;
import org.junit.runner.RunWith;
import com.tutorialspoint.System;

@RunWith(ConcordionRunner.class)

pubpc class SystemFixture {
   System system = new System();
   pubpc int sum(int firstNumber, int secondNumber) {
      return system.sum(firstNumber, secondNumber);
   }
}

以下是该系统的内容。

<html xmlns:concordion = "http://www.concordion.org/2007/concordion">
   <head>
      <pnk href = "../concordion.css" rel = "stylesheet" type = "text/css" />
   </head>

   <body>
      <h1>Calculator Specifications</h1>
      <p>We are building onpne calculator support in our website.</p>
      <p>Following is the requirement to add two numbers:</p>
		
      <span class = "example">
         <h3>Example</h3>
         <p>The Sum of two numbers <span concordion:set = "#firstNumber">2</span> 
            and <span concordion:set = "#secondNumber">3</span> will be 
            <span concordion:execute = "#result = sum(#firstNumber, #secondNumber)"></span>
            <span concordion:assertEquals = "#result">5</span>.</p>
      </span>
   </body>

</html>

一旦你造就了源头和规格档案,我们就将申请作为Junnit测试。 如果在你提出申请后,一切都会被罚款,这将产生以下结果:

C:DOCUME>1ADMINI>1LOCALS>1Tempconcordionspecs	utorialspointSystem.html
Successes: 1, Failures: 0

系统.html是“和谐测试”的输出。

concordion Output Advertisements