Concordion First Application - Concordion

What is Concordion First Application?

Let us begin programming with Concordion. earlier than you start writing your first instance using Concordion, you need to make certain that you have set up your Concordion environment properly as explained in Concordia - environment Setup tutorial. We also assume that you have a little bit working knowledge of Eclipse IDE.

So allow us to continue to put in writing a simple Concordion application so one can print the following acceptance test –

Step 1 - Create Java Project

The first step is to create a simple Java project using Eclipse IDE. Follow the option File → new → Project and finally select Java Project wizard from the wizard list. Now name your project as Concordion using the wizard window as follows –

concordion_wizard

Once your project is created successfully, you will have the following content in your Project Explorer –

concordion_dir

Step 2 - Add Required Libraries

Let us add concordion and its dependencies in our project. To do this, right-click on your project name concordion and then follow the options available in the context menu: Build Path → Configure Build Path to display the Java Build Path window as follows –

java_build_path

Now use Add External JARs button available under Libraries tab to add the following core JAR from the Concordion folder.

  • concordion-1.5.1
  • hamcrest-core-1.3
  • junit-4.12
  • ognl-2.6.9
  • xom-1.2.5

Step 3 - Create Source Files

Now let us create actual source files under the concordion project. First, we need to create a package called com.wisdomjobs. To do this, right-click on src in the package explorer section and follow the option: New → Package.

Next, we will create System .java file under the com.wisdomjobs package.

concordion_source_files

Here is the content of System.java file −

Step 4 - Create Specification Files

Now let us create actual specification files under the concordion project. First, we need to create a new source folder named specs. This folder will contain specification files like JUnitFixture or test runner and html files which are specifications. Now we need to create a package called specs.wisdomjobs. To do this, right-click on spec in the package explorer section and follow the option: New → Package.

Next, we will create System.html and SystemFixture.java files under the specs.wisdomjobs package. Thereafter, we will add concordion.css under specs source folder.

Here is the content of the System.html file −

concordion_specs_files


Here is the content of the SystemFixture.java file −

Here is the content of the concordion.css file −

There are two important points to note about the specification html file and the Test Fixture −

  • System.html is the specification html file that uses the concordion namespace.

  • System.html uses concordion:set command to set a value of temporary variables userName to be Robert. Here, userName is the parameter to be passed to the getGreeting method of System fixture.

  • System.html uses concordion:assertEquals command to check the output of getGreeting(userName) function to be Hello Robert!.

  • SystemFixture is a JUnit test fixture annotated with ConcordionRunner.class.

  • SystemFixture has a getGreeting method that returns greetings to the user.

Step 5 - Running the Program

Right-click on the content area of SystemFixture and select Run as > JUnit Test Case. You will see the following output with junit success.

System.html is the output of Concordion test run.

concordion_output

Congratulations, you have created your first Concordion Acceptance test successfully. Further, let us start doing something more interesting in the next few chapters.

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Concordion Topics