📜  Concordion-运行命令

📅  最后修改于: 2020-12-07 04:46:04             🧑  作者: Mango


Concordion run命令可用于将多个规范链接在一起,并将它们显示在一个中央页面上。该命令可以运行所有规范,同时适当地以绿色/红色/灰色显示链接的背景。

现在,我们将创建两个规范并将它们链接在一起。我们将重用在“ Concordion-在列表中执行”和“ Concordion-在表中执行”两章中创建的规范,作为系统规范和计算器规范。

让我们拥有一个运行良好的Eclipse IDE,并按照下面给出的步骤创建一个Concordion应用程序-

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 libraries using Add External JARs option as explained in the Concordion – First Application chapter.
3 Create Java class System under the com.tutorialspoint package.
4 Create Fixture classes SystemFixture, CalculatorFixture under the specs.tutorialspoint package.
5 Create Specification html files System.html, Calculator.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 application as explained below.

这是System.java文件的内容-

package com.tutorialspoint;
import org.concordion.api.MultiValueResult;

public class System { 
   public MultiValueResult split(String userName){  
      MultiValueResult result = new MultiValueResult();
      String[] words = userName.split(" ");   
      result.with("firstName", words[0]).with("lastName", words[1]);       
      return result;
   }
    
   public int sum(int firstNumber, int secondNumber) {
      return firstNumber + secondNumber;
   }
}

以下是SystemFixture.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)

public class SystemFixture {
   System system = new System();
   public MultiValueResult split(String userName){
      return system.split(userName);
   }  
}

以下是CalculatorFixture.java文件的内容-

package specs.tutorialspoint;

import org.concordion.integration.junit4.ConcordionRunner;
import org.junit.runner.RunWith;
import com.tutorialspoint.System;

@RunWith(ConcordionRunner.class)

public class CalculatorFixture {
   System system = new System();
   public int sum(int firstNumber, int secondNumber) {
      return system.sum(firstNumber, secondNumber);
   }
}

以下是System.html文件的内容-


   

   
      

System Specifications

We are building specifications for our online order tracking application.

Following is the requirement to split full name of a logged in user to its constituents by splitting name by whitespace:

Example

  • The full name Robert De is to be splited as
    • Robert
    • De
  • The full name John Diere is to be splited as
    • John
    • Diere
Calculator Service Specifications

以下是Calculator.html文件的内容-


   

   
      

Calculator Specifications

We are building online calculator support in our website.

Following is the requirement to add two numbers:

Example

First Number Second Number Sum
2 3 5
4 5 9

创建完源文件和规范文件后,让我们将应用程序作为JUnit Test运行。如果您的应用程序一切正常,则将产生以下结果-

C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\concordion\specs\tutorialspoint\System.html
Successes: 2, Failures: 0
C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\concordion\specs\tutorialspoint\System.html
Successes: 6, Failures: 0

System.html是Concordion测试运行的输出。

concordion运行命令输出

单击链接计算器服务规格。您将看到以下输出-

手风琴输出