English 中文(简体)
Concordion - assertTrue Command
  • 时间:2024-03-24 20:01:22

Concordion - assertTrue Command


Previous Page Next Page  

1. 一致主张 当固定装置需要知道预期结果才能进行测试时,即使用真正的指挥。

考虑以下要求:

User Name : Robert De
The User name starts with R.
The User name starts with S == false.

如果我们想要在用户名称上进行测试,并检查用户名称是否始于R。

<p>User Name :<span concordion:set = "#userName">Robert De</span></p>
<p>The User name <span concordion:assertTrue = "#userName.startsWith(#letter)">starts
   with <b concordion:set = "#letter">R</b></span>.</p>
<p>The User name <span concordion:assertTrue = "#userName.startsWith(#letter)">starts
   with <b concordion:set = "#letter">S</b></span>.</p>   

当Concordion parses the document时,它将设定一个临时变量,即“Robert De”。 然后,它将检查用户Name是否开始使用由下指挥部确定的字母缩略语变量所具体规定的信。

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 specification file and run the apppcation as explained below.

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

package com.tutorialspoint;
pubpc class System {   
}

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

package specs.tutorialspoint;

import org.concordion.integration.junit4.ConcordionRunner;
import org.junit.runner.RunWith;

@RunWith(ConcordionRunner.class)

pubpc class SystemFixture {
}

以下是该系统的内容。

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

   <body>
      <h1>System Specifications</h1>
      <p>We are building specifications for our onpne order tracking apppcation.</p>
      <p>Following is the requirement to sppt full name of a logged in user to 
         its constituents by spptting name by whitespace:</p>
   
      <span class = "example">      
         <h3>Example</h3>
         <p>User Name :<span concordion:set = "#userName">Robert De</span></p>
         <p>The User name <span concordion:assertTrue = "#userName.startsWith(#letter)">starts
            with <b concordion:set = "#letter">R</b></span>.</p>
         <p>The User name <span concordion:assertTrue = "#userName.startsWith(#letter)">starts
            with <b concordion:set = "#letter">S</b></span>.</p>          
      </span>
		
   </body>

</html>

一旦你造就了来源和规格档案,我们就将申请作为JUSG测试。 如果在你提出申请后,所有物品都会被罚款,那么就会产生以下结果:

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

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

concordion assertTrue command Output Advertisements