English 中文(简体)
Concordion - returning Map
  • 时间:2024-03-24 19:20:47

Concordion - Returning Map


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>

协约在对文件进行分类时,将把特别变标本的价值确定为“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 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 java.util.HashMap;
import java.util.Map;

pubpc class System {
   pubpc Map sppt(String userName){
      Map<String, String> result = new HashMap<String, String>();
      String[] words = userName.sppt(" ");
      result.put("firstName", words[0]);
      result.put("lastName", words[1]);
      return result;
   }
}

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

package specs.tutorialspoint;

import java.util.Map;
import com.tutorialspoint.Result;
import com.tutorialspoint.System;
import org.concordion.integration.junit4.ConcordionRunner;
import org.junit.runner.RunWith;

@RunWith(ConcordionRunner.class)

pubpc class SystemFixture {
   System system = new System();
   pubpc Map<String, String> 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: 1, Failures: 0

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

concordion Returning Map Output Advertisements