English 中文(简体)
Concordion - execute on tables
  • 时间:2024-03-24 19:19:26

Concordion - Execute on Table


Previous Page Next Page  

和谐执行指挥可用来以重复的方式管理和谐装置。 例如,如果我们想以表格的形式以多种实例说明一项要求,那将是有益的。

考虑以下要求:

<table>
   <tr><th>First Number</th><th>Second Number</th><th>Sum</th></tr>
   <tr><td>2</td><td>3</td><td>5</td></tr>
   <tr><td>4</td><td>5</td><td>9</td></tr>
</table>

如果我们想写出一笔总付的具体规定,接受两个数字并得出其数额,那么具体内容如下:

<table>
   <tr><th>First Number</th><th>Second Number</th><th>Sum</th></tr>
   <tr concordion:execute = "#result = sum(#fullName)">
      <td concordion:set = "#firstNumber">2</td>
      <td concordion:set = "#secondNumber">3</td>
      <td concordion:assertEquals = "#result">5</td>
   </tr>
   <tr concordion:execute = "#result = sum(#fullName)">
      <td concordion:set = "#firstNumber">4</td>
      <td concordion:set = "#secondNumber">5</td>
      <td concordion:assertEquals = "#result">9</td>
   </tr>
</table>

在对文件进行分类时,它将设定一个临时变量,即“2”和“2”数值为“3”。 然后,它将使用执行指挥法,采用“第一号”和“第二号”参数的总和法,并将结果确定为“数字变量”,并核实“数字”等于“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 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 specification 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>
         <table>
            <tr>
               <th>First Number</th>
               <th>Second Number</th>
               <th>Sum</th>
            </tr>
            <tr concordion:execute = "#result = sum(#firstNumber, #secondNumber)">
               <td concordion:set = "#firstNumber">2</td>
               <td concordion:set = "#secondNumber">3</td>
               <td concordion:assertEquals = "#result">5</td>
            </tr>
            <tr concordion:execute = "#result = sum(#firstNumber, #secondNumber)">
               <td concordion:set = "#firstNumber">4</td>
               <td concordion:set = "#secondNumber">5</td>
               <td concordion:assertEquals = "#result">9</td>
            </tr>
         </table>
      </span>
		
   </body>

</html>

一旦你着手制作来文方和特稿档案,我们便可以把申请作为JUSG测试。 如果在你提出申请后,所有物品都会被罚款,那么就会产生以下结果:

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

系统.html是Concordion测试的结果。

concordion Execute on Table Output Advertisements