org.faktorips.runtime
Class IpsTestCase

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by org.faktorips.runtime.IpsTestCase
All Implemented Interfaces:
junit.framework.Test

public abstract class IpsTestCase
extends junit.framework.TestCase

Base class for IPS test cases.

Author:
Jan Ortmann

Constructor Summary
IpsTestCase(String name)
          Creates a new test case.
 
Method Summary
protected abstract  void execAsserts()
          Compares the actual output (created by the business function) with the expected result.
protected abstract  void execBusinessFcts()
          Executes the business function(s) to test.
protected  DocumentBuilder getDocumentBuilder()
           
protected abstract  void readExpectedResult(Element expResultEl)
          Reads the expected result from the given Xml element.
protected abstract  void readInput(Element inputEl)
          Reads the input for the test from the given Xml element.
protected  void run(Document doc)
           
protected  void run(Element testCaseEl)
           
protected  void runTest()
          Implementation of the JUnit Test method that reads the test case data (input, expected output) from the test's resource, executes the business functions and compares the expected result with the actual result.
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runBare, setName, setUp, tearDown, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IpsTestCase

public IpsTestCase(String name)
Creates a new test case.

Method Detail

runTest

protected void runTest()
                throws Throwable
Implementation of the JUnit Test method that reads the test case data (input, expected output) from the test's resource, executes the business functions and compares the expected result with the actual result.

Overrides:
runTest in class junit.framework.TestCase
Throws:
Throwable

run

protected void run(Document doc)
            throws Exception
Throws:
Exception

run

protected void run(Element testCaseEl)
            throws Exception
Throws:
Exception

readInput

protected abstract void readInput(Element inputEl)
Reads the input for the test from the given Xml element.


readExpectedResult

protected abstract void readExpectedResult(Element expResultEl)
Reads the expected result from the given Xml element.


execBusinessFcts

protected abstract void execBusinessFcts()
                                  throws Exception
Executes the business function(s) to test.

Throws:
Exception - Any exception thrown by the business function is considered as an error.

execAsserts

protected abstract void execAsserts()
                             throws Exception
Compares the actual output (created by the business function) with the expected result.

Throws:
Exception

getDocumentBuilder

protected DocumentBuilder getDocumentBuilder()
                                      throws ParserConfigurationException
Throws:
ParserConfigurationException


Copyright © 2015. All rights reserved.