Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In order to introduce TDD4C to you logic, you need to use Logic Manager Pricefx Studio or packaging to be able to fetch logics from the server. Then, set up a Git repo for your project, which will allow you to have continuous integration job on PFX Jenkins at https://nexus.pricefx.net/jenkins/view/tdd4c/.

...

  1. Create a Maven metadata file where you enable Groovy usage and pull all the dependencies. In the root folder of your project, create the pom.xml file like this one (substitute "myproject" with you project name). 

    Code Block
    languagexml
    linenumberstrue
    collapsetrue
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>net.pricefx.myproject</groupId>
        <artifactId>myproject-logic</artifactId>
        <version>1.0-SNAPSHOT</version>
        <name>Price f(x) MyProject Logic</name>
    
        <properties>
            <!-- testing -->
            <junit.version>4.12</junit.version>
            <spock.version>1.1-groovy-2.4</spock.version>
    
            <!-- maven -->
            <maven-compiler-plugin.version>3.6.1</maven-compiler-plugin.version>
            <maven-surefire-plugin.version>2.20</maven-surefire-plugin.version>
    
            <source.jdk>1.8</source.jdk>
            <target.jdk>1.8</target.jdk>
            <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        </properties>
    
        <build>
            <testSourceDirectory>tdd4c</testSourceDirectory>
            <plugins>
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>${maven-compiler-plugin.version}</version>
                    <configuration>
                        <source>${target.jdk}</source>
                        <target>${target.jdk}</target>
                        <forceJavacCompilerUse>true</forceJavacCompilerUse>
                    </configuration>
                    <executions>
                        <execution>
                            <phase>compile</phase>
                            <goals>
                                <goal>compile</goal>
                                <goal>testCompile</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.gmavenplus</groupId>
                    <artifactId>gmavenplus-plugin</artifactId>
                    <version>1.5</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>addTestSources</goal>
                                <goal>testCompile</goal>
                            </goals>
                        </execution>
                    </executions>
                    <configuration>
                        <testSources>
                            <testSource>
                                <directory>${basedir}/tdd4c</directory>
                                <includes>
                                    <include>**/*.groovy</include>
                                </includes>
                            </testSource>
                        </testSources>
                    </configuration>
                </plugin>
            </plugins>
        </build>
    
        <dependencies>
    
            <!-- Test -->
            <dependency>
                <groupId>junit</groupId>
                <artifactId>junit</artifactId>
                <version>${junit.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>org.spockframework</groupId>
                <artifactId>spock-core</artifactId>
                <version>${spock.version}</version>
                <scope>test</scope>
                <exclusions>
                    <exclusion>
                        <groupId>org.codehaus.groovy</groupId>
                        <artifactId>groovy-all</artifactId>
                    </exclusion>
                </exclusions>
            </dependency>
            <dependency>
                <groupId>net.pricefx</groupId>
                <artifactId>tdd4c</artifactId>
                <version>1.0-SNAPSHOT</version>
                <scope>test</scope>
            </dependency>
    
        </dependencies>
    
        <repositories>
            <repository>
                <id>Default repo</id>
                <url>http://repo1.maven.org/maven2</url>
                <snapshots>
                    <enabled>false</enabled>
                </snapshots>
                <releases>
                    <enabled>true</enabled>
                </releases>
            </repository>
    
            <repository>
                <id>Pricefx public maven artifacts</id>
                <url>https://nexus.pricefx.net/tools</url>
                <snapshots>
                    <enabled>true</enabled>
                </snapshots>
                <releases>
                    <enabled>true</enabled>
                </releases>
            </repository>
        </repositories>
    </project>


  2. Create the tdd4c folder in the project's root directory.
  3. Mark it as the test sources root in you favourite IDE.