{{sidenavigation.sidenavigationExpandLabel}}
{{getMsg('Help_YouAreHere')}}: {{page.title}} {{page.title}}
{{$root.getMsg("downLoadHelpAsPdf")}} {{helpModel.downloadHelpPdfDataStatus}}

Testing with JUnit

You can use the i-net PDFC Server to compare PDF files in your JUnit tests on any computer in your network. This can be your continuous integration server or from the IDE of the developers.

Pre requirement

Before you can start with JUnit testing you need:

  • One installed i-net PDFC server instance.
  • The plugin pdfcrpc must be activated and running. You can check this in the configuration manager GUI in the dialog plugins.

Dependencies

In your test enviroment you need to add the needed dependencies.

IVY

    <dependencies>
        <dependency org="de.inetsoftware" name="pdfcjunit" rev="24.+"/>
        <dependency org="junit" name="junit" rev="4.12"/>
        <dependency org="jakarta.websocket" name="jakarta.websocket-api" rev="2.2"/>
        <dependency org="jakarta.websocket" name="jakarta.websocket-client-api" rev="2.2"/>
        <dependency org="org.glassfish.tyrus" name="tyrus-container-jdk-client" rev="1.+"/>
    </dependencies>

Gradle

repositories {
    jcenter()
}
dependencies {
    testCompile 'de.inetsoftware:pdfcjunit:24.+'
    testCompile 'junit:junit:4.12'
    testCompile 'jakarta.websocket:jakarta.websocket-api:2.2'
    testCompile 'jakarta.websocket:jakarta.websocket-client-api:2.2'
    testCompile 'org.glassfish.tyrus:tyrus-container-jdk-client:1.+'
}

Sample Code

import static com.inet.pdfc.junit.PdfcAssert.*;
import org.junit.*;
 
public class PdfcTest {
 
    @BeforeClass
    public static void beforeClass() {
        // If you search for problems then you can enable the logging
        // PdfcAssert.setLogLevel( com.inet.logging.Logger.DEBUG );
 
        // if you have more as one i-net PDFC Server
        // or if the server can not be found via broadcast
        // setServicePath( "myhost:9900" );
 
        // if the current windows user has no access to the server
        // setCredentials( "user", "password" );
    }
 
    @Test
    public void myTest() {
        // compare if both files are equals
        assertPdfEquals( "file1.pdf", "file2.pdf" );
    }
}
i-net PDFC
This application uses cookies to allow login. By continuing to use this application, you agree to the use of cookies.


Help - Testing with JUnit