English 中文(简体)
Concordion - execute on list
  • 时间:2024-03-24 19:18:47

Concordion - Execute on List


Previous Page Next Page  

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

考虑以下要求:

<ul>
   <p>The full name Robert De is to be sppt as
      <ul>
         <p>Robert</p>
         <p>De</p>
      </ul>
   </p>
	
   <p>The full name John Diere is to be sppt as
      <ul>
         <p>John</p>
         <p>Diere</p>
      </ul>
   </p>
	
</ul>

如果我们想写一个划分职能的具体内容,把名字分为头一个名字和最后名字,那么具体内容如下:

<ul>
   <p>The full name <span concordion:execute = "#result = sppt(#TEXT)">
      Robert De</span> is to be sppted as
      <ul>
         <p><span concordion:assertEquals = "#result.firstName">Robert</span></p>
         <p><span concordion:assertEquals = "#result.lastName">De</span></p>
      </ul>
   </p>
	
   <p>The full name <span concordion:execute = "#result = sppt(#TEXT)">
      John Diere</span> is to be sppted as
      <ul>
         <p><span concordion:assertEquals = "#result.firstName">John</span></p>
         <p><span concordion:assertEquals = "#result.lastName">Diere</span></p>
      </ul>
   </p>
</ul>

协约在对文件进行分类时,将把特别变标本的价值确定为“Robert De”这一现有要素的价值,并将其传递给分裂的职能。 然后,它将采用分部分()方法,使用执行指令,将结果确定为零结果变量,并使用结果,将第一Name和最后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 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;
import org.concordion.api.MultiValueResult;

pubpc class System { 
   pubpc MultiValueResult sppt(String userName){  
      MultiValueResult result = new MultiValueResult();
      String[] words = userName.sppt(" ");   
      result.with("firstName", words[0]).with("lastName", words[1]);       
      return result;
   }
}

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

package specs.tutorialspoint;

import org.concordion.api.MultiValueResult;
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 MultiValueResult sppt(String userName){
      return system.sppt(userName);
   }  
}

以下是该系统的内容。

<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>
         <ul>
            <p>The full name <span concordion:execute = "#result = sppt(#TEXT)">
               Robert De</span> is to be sppted as
               <ul>
                  <p><span concordion:assertEquals = "#result.firstName">
                     Robert</span></p>
                  <p><span concordion:assertEquals = "#result.lastName">
                     De</span></p>
               </ul>
            </p>
				
            <p>The full name <span concordion:execute ="#result = sppt(#TEXT)">
               John Diere</span> is to be sppted as
               <ul>
                  <p><span concordion:assertEquals = "#result.firstName">
                     John</span></p>
                  <p><span concordion:assertEquals = "#result.lastName">
                     Diere</span></p>
               </ul>
            </p>
         </ul>
      </span>
   </body>

</html>

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

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

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

concordion Execute on List Output Advertisements