Products Downloads


French version


 

Note: this configuration has been kept for compatibility reasons but is considered as obsolete. We recommend that you define your new test projects with Gradle (also used for Adelia build).


The machine used for the test run must be a Windows machine:

  • on which Adelia is installed,
  • which has access to the Adelia environment, which contains the test programs, and
  • on which MAVEN is installed.


a) Installing MAVEN


Go to the website https://maven.apache.org/download.cgi and download an Apache-Maven "Binary zip archive" file.

Unzip the file on your machine and then change the path of your machine: replace it with the path of the Maven bin directory.



b) Setting up a test project


Create a directory in which you will place the pom.xml file and the "src" directory picked up in %ADELIWS%\Unit_Tests\Maven.


Changes to the pom.xml file:

< 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 > [ORGANISATION ID] </ groupId >

       < artifactId > [PROJECT ID] </ artifactId >

       < version > [PROJECT VERSION] </ version >

        < dependencies >

              < dependency >

                     < groupId > junit </ groupId >

                     < artifactId > junit </ artifactId >

                     < version > 4.9 </ version >

                     < scope > test </ scope >

              </ dependency >

              < dependency >

                     < groupId > com.hardis.adelia </ groupId >

                     < artifactId > adeljrt </ artifactId >

                    < version > [ADELJRT VERSION] </ version >

                     < scope > system </ scope >

                    < systemPath > ${env.ADELIWS}\javarun\adeljrt- [ADELJRT VERSION] .jar </ systemPath >

              </ dependency >

        </ dependencies >


        < build >

              < plugins >


                     < plugin >

                            < groupId > org.codehaus.mojo </ groupId >

                            < artifactId > exec -maven-plugin </ artifactId >

                            < version > 1.4.0 </ version >

                            < executions >

                                    < execution >

                                         < id > generate-test-pgm </ id >

                                         < phase > generate-test-sources </ phase >

                                         < goals >

                                                < goal > exec </ goal >

                                         </ goals >

                                   </ execution >

                            </ executions >

                            < configuration >

                                   < executable > AGPTS </ executable >

                                   < skip > ${skip.gen.test.pgm} </ skip >

                                   < environmentVariables >

                                          < javaSourceDirectory > ${project.basedir}\src\test\java\ </ javaSourceDirectory >

                                        < adeliaEnvironment > [ENVIRONMENT NAME] </ adeliaEnvironment >

                                        < adeliaTask01 > [TASK NAME] </ adeliaTask01 >

                                   </ environmentVariables >

                            </ configuration >

                     </ plugin >

                     < plugin >

                            < artifactId > maven -surefire-plugin </ artifactId >

                            < version > 2.12.4 </ version >

                            < executions >

                                   < execution >

                                          < id > default-test </ id >

                                         < phase > test </ phase >

                                         < configuration >

                                                < includes >

                                                       < include > **/*.java </ include >

                                                </ includes >

                                                < excludes >

                                                       < exlude > com/hardis/adelia/test/CHKTST.java </ exlude >

                                                </ excludes >

                                                < testFailureIgnore > true </ testFailureIgnore >

                                               < reportNameSuffix > [EXECUTION CONTEXT NAME] </ reportNameSuffix >

                                                < systemPropertyVariables >

                                                      < adeliaPhysicalServerHost > [MIDDLEWARE SERVER] </ adeliaPhysicalServerHost >

                                                       < adeliaPhysicalServerPort > [PORT] </ adeliaPhysicalServerPort >

                                                      < adeliaPhysicalServerProfile > [MIDDLEWARE PROFILE] </ adeliaPhysicalServerProfile >

                                                      < adeliaPhysicalServerPassword > [PASSWORD] </ adeliaPhysicalServerPassword >

                                                      < adeliaLogicalServer > [LOGICAL SERVER NAME] </ adeliaLogicalServer >

                                                      < adeliaDatabase > [DB TEST NAME] </ adeliaDatabase >

                                                </ systemPropertyVariables >

                                         </ configuration >

                                   </ execution >

                                   < execution >

                                         < id > final-report </ id >

                                         < phase > test </ phase >

                                         < goals >

                                                < goal > test </ goal >

                                         </ goals >

                                         < configuration >

                                                < includes >

                                                       < include > com/hardis/adelia/test/CHKTST.java </ include >

                                                </ includes >

                                                < reportNameSuffix > REPORT </ reportNameSuffix >

                                                < systemPropertyVariables >

                                                       < reportDirectory > ${project.build.directory}\surefire-reports\ </ reportDirectory >

                                                       < noXslStyleSheet > false </ noXslStyleSheet >

                                                </ systemPropertyVariables >

                                         </ configuration >

                                   </ execution >

                            </ executions >

                     </ plugin >

              </ plugins >

        </ build >

        < properties >

              < skip.gen.test.pgm > false </ skip.gen.test.pgm >

              < project.build.sourceEncoding > UTF-8 </ project.build.sourceEncoding >

        </ properties >

</ project >



The parameters are as follows:

ORGANISATION ID

Identifier of the organization (e.g. com.mycompany.myappli)

PROJECT ID

Project Name (e.g. MyApp)

VERSION

Version of your project (e.g.1.0.0)

ADELJRT VERSION

Version of the Adeljrt.jar file for your version of Adelia.

Put the same version number as the one provided in the %ADELIWS%\javarun directories% of the machine (e.g. put 13.4.0 if in the javarun subfolder you have the adelijrt-13.4.0.jar file)

ENVIRONMENT NAME

Name of the Adelia environment containing your test programs

TASK NAME

Name of the Adelia task containing your test programs

If your test programs are spread over several tasks, create additional elements: <adeliaTask02> , <adeliaTask03>…  (consecutively numbered and limited to 99 maximum).

EXECUTION CONTEXT NAME

Name used to identify a test execution context.

This name will be visible in the test report.

For example, if two execution blocks are defined to run the tests in the context of a Windows Middleware Server and an AS/400 server, the first block could be named WINDOWS_SERVER and the second AS400_SERVER.



The following parameters are not strictly speaking Framework parameters but are an illustration of the method used to transmit contextual information from the pom.xml file to the test programs.

In this case, these parameters are used to manage the dynamic Middleware connection used by the TEST_CONFIG management rule.

MIDDLEWARE SERVER

Name or IP address of the Middleware server

PORT

Listening port of the Middleware demon

MIDDLEWARE PROFILE

Middleware connection profile.

PASSWORD

Password associated with the Middleware profile

LOGICAL SERVER NAME

Name of the logical server used by the test programs

DB TEST NAME

Name of the test database defined in the server configuration file.

*DFT corresponds to the default base and

* NONE is used when it is not required to connect to a database.



If you need more execution contexts for your tests, you can add a second execution block. To do this:

  • duplicate the block with the "default-test" ID (from the "maven-surefire-plugin" plugin) and
  • change the ID and adjust its parameters.

Caution: the execution block with the "final-report" ID, which is used to make the test report should always be left at the end and should not be changed.


If some test programs must run in a particular execution context and not in another, you can set this particular case using <include> and <exclude> tags, naming the java source path directly.

Be sure to use / instead of a dot in the package.

You can use generic names with regard to a package (e.g. com/mestests/AS400/*.java): if you put your test programs in different tasks, they can have a different package even if they are in the same application area.



c) Runnning the test


Caution: if your test programs have AS/400 server parts, you must be, on your AS/400, at least at the level of PTF F003 of the AS/400 part of Adelia Studio 13.


To run the test, open a Windows command window, navigate to the directory of your test project (the one that contains your pom.xml file) and run the following command:

mvn clean test


Note: when you first run the command, your machine must have an Internet access so that Maven can download some components cited in the pom.xml file.


If no error is detected during the preparatory phase of the tests (analysis of the pom.xml file and generation of test programs) you will find the unit test report file AdeliaTestsReport.xml in your test project directory in the "target/surefire-reports" directory.

A style sheet is associated with this file (AdeliaTestsReport.xsl). It is used to present the results in an Internet Explorer or FireFox browser as an HTML page like the one shown below:




Caution: local style sheets are not accepted by the Chrome browser. You can disable taking the style sheet into account by replacing "false" by "true" in your pom.xml file for the "noXslStyleSheet" tag of the "final-report" execution block of the "maven-surefire-plugin" plugin.


Note: if you want to rerun the same tests as those carried out during the previous run, but skipping the step of generating test programs, you can do this by running the following command:

mvn -Dskip.gen.test.pgm=true test


List of error codes:

Errors related to executing the plug-in: org.codehaus.mojo: exec-maven-plugin

-1 to -4: Errors related to the ADELJOB command

-5: Generating or compiling a test program has failed (open the job manager for more information about the error)

-10: A task specified in an adeliaTaskxx tag does not exist in the environment

-11: A task specified in an adeliaTaskxx tag does is not a test type task

-50: Could not load an Adelia product dll

-51: The name of the Adelia environment is not specified in the pom.xml file

-52: Error connecting to the environment

-53: Error retrieving information about the environment.

-55: Error copying the file com/hardis/adelia/test/CHKTST.java under the test project directory


↑ Top of page

  • Aucune étiquette