English 中文(简体)
returning MultiValueResult
  • 时间:2024-03-24 19:20:07

Concordion - Returning MultiValueResult


Previous Page Next Page  

协调一致的执行指挥可用来以地图的形式获得行为的结果,我们可以通过地图获得行为方面的多重产出。 例如,考虑以下要求:

The full name Robert De is to be broken into its first name Robert and last name De.

在这里,我们需要有一种单独的功能,接受用户名称,并归还一个具有第一Name和最后Name的地图物体,作为其具有相应价值的钥匙,以便我们能够加以利用。

如果我们想为这种分职能写一个具体内容,即接受用户名称和结果标的输出,那么具体内容如下:

<p>The full name <span concordion:execute = "#result = sppt(#TEXT)">Robert 
   De</span> is to be broken into first name 
   <span concordion:assertEquals = "#result.firstName">Robert</span> and last name 
   <span concordion:assertEquals = "#result.lastName">De</span>.</p>

协约在对文件进行分类时,将把特别变标本的价值确定为“罗伯特·德”现有要素的价值,并将其传递给分裂功能。 然后,它将采用分部分()法,使用执行指令,将结果确定为“结果”变量,使用结果图,将第一Name和最后Name数值作为产出。

Example

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

Step Description
1 Create a project with the 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;
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>
         <p>The full name <span concordion:execute = "#result = sppt(#TEXT)">Robert De</span> 
            is to be broken into first name <span 
            concordion:assertEquals = "#result.firstName">Robert</span> and last name <span 
            concordion:assertEquals = "#result.lastName">De</span>.</p>
      </span>
		
   </body>

</html>

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

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

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

concordion Returning Map Output Advertisements