English 中文(简体)
assertEquals Command
  • 时间:2024-03-24 20:02:41

Concordion - assertEquals Command


Previous Page Next Page  

1. 一致主张 平等指挥用于对照特定价值检查 Java豆财产或方法结果。

考虑以下要求:

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

如果我们想将第2和第3号作为参数,并将其作为参数加以汇总,以便能够根据系统归还的5项结果加以核实,那么我们就能够使用和谐: 股权周围的对等指挥。

<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”和准号,即使用固定指挥的“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 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:assertEquals = "sum(#firstNumber, #secondNumber)">5</span>.</p>
      </span>
		
   </body>

</html>

一旦你造就了来源和规格档案,我们就将申请作为JUSG测试。 如果根据你的申请对所有物品都处以罚款,那么就会得出以下结果:

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

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

Concordion assertEquals command Output

Successes: 1, Failures: 0

Advertisements