Products Downloads


French version


The Template Editing APE extension provides an environment for declaring and executing test cases (unit tests) for each .ftlx template defined in your work directory (folder opened by Visual Studio Code).

As described on the Configuration of a programming environment page, the extension provides three basic functional blocks for programming and testing templates:

  • the template file text editor,
  • an APE instance: A Spring Boot MergeTransformMicroService APE application is embedded with the extension, and is configured to execute the test cases defined for each template that is developed.
  • A REST client: In the same way as Insomnia, this tool executes a test case by sending an HTTP request containing its data to consume the Web service of the Spring Boot APE dedicated to execution of the template. The request result can be viewed directly in the extension.


By definition, a test case is the instantiation of a use case in a defined context. In the context of the APE, a test case groups all the data necessary to describe a use case for a template executed by means of a Web service from the Spring Boot APE.

A test case is unique: It is characterized by a name and is associated with a single template.


By definition, a test suite is a group of test cases: This suite consists of a set of parameters defining the execution environment as well as a collection of test cases. In the context of the APE, a test suite contains the parameters necessary to configure and execute the Spring Boot APE and comprises the test cases from templates defined in the work space. A test sequence is unique in a work directory.


User interface

The Template Editing APE extension provides a view specific to test management. To activate this view, click on the icon in the Visual Studio Code activity bar (left side):



This view displays four tree sub-views in the side bar:

  • the TEST SUITE view: it shows all the test cases from the templates defined in the work directory (and its sub-directories, if any),
  • the TEMPLATE TEST CASES view: it shows all the test cases for the active template,
  • the TEST CASE INFO view: it shows the information about the active test case,
  • the TEST CASE RUN view: it shows the information about execution of the active test case.

If there is no test suite when a work directory is opened, the TEST SUITE view tells you it is necessary to generate a test suite file in order to create test cases.

The TEMPLATE TEST CASES, TEST CASE INFO and TEST CASE RUN views automatically update their content when the user changes the active document.

↑ Top of page

TEST SUITE view


This is the main test suite view. If no test suite is found in the work directory, this view tells you it is necessary to generate a test suite file in order to create test cases.

Once this tree view is created, it shows the test cases grouped by template. Each test case is a terminal item of the tree view represented by the icon. The text associated with the item is the name of the test case followed by the locale associated with the test case. When you mouse click on a test case item, a document containing the test case data is opened and displayed in the editor's editing zone. If the document is already open, it becomes the active document.

A test case item is attached to a parent item represented by the icon. The text of this parent item is the name of the associated .ftlx template.

Each template item is located in the tree view by a path representing the associated template name space (a sub-path of directories relating to a search root which is the name space root directory indicated when the test suite file is generated).

When you move the mouse cursor in the view display zone, the available commands are displayed.

General commands

The general commands are displayed in the view title bar: They are accessed either via icons or via a context-sensitive menu under the "..." icon.




New test case 

This command adds a test case to the test suite. A test case is created in four steps:

  • Step 1 Enter a test case name,
  • Step 2 Enter a test case description (can be left empty),
  • Step 3 From the proposed list select the template associated with the test case. Each template is located in its name space. The list updates automatically according to the text entered in the field.
  • Step 4 Enter the HTTP request from the Spring Boot APE's Web service which will be consumed when the test case is executed. In this step, two input helps are available (placed above the field):
    • Use the  icon (Choose an existing request URL) to choose one URL from the existing URLs (those created by default and those created by the user). When an URL is defined with environment variables, its expanded value is displayed on the same line.
    • Use the  icon (Add an environment variable) to add an environment variable at the end of the text you are entering. The list proposes all the variables defined in the current environment as well as the variables from the base environment (if they have not been redefined in the current environment). Each line in the list displays the variable name, its real value and its expanded value if it contains other variables, its origin (environment in which the variable was defined or redefined) and finally its type (numeric, character string, Boolean, null).


To cancel these input helps and return to step 4, click on the Back button.


At the end of the last step, the new test case is created in the view and the test case document is displayed in the editor's editing zone.

At each step you can cancel creation of a new test case by pressing the Esc. key.

↑ Top of page

Context-sensitive menu commands

The commands in this menu are grouped by theme. Some commands are only visible when the editor is in a specific context.


Commands to manage the Spring Boot APE application

Contains the following commands:

  • Start APE Spring Boot application (command only visible if the application has stopped),
  • Stop APE Spring Boot application (command only visible if the application has started),
  • Restart APE Spring boot application (command only visible if the application has started).

These commands manage the life cycle of the APE application.

The Spring Boot APE application must be started before executing a test case.

When selecting an environment, if it contains variables for configuring the Spring Boot APE configuration files, the application must be restarted in order for the parameters defined in the environment to take effect.


Show APE application configuration files

The configuration file to display is selected from a list containing the freemarker.properties, application.yml and fop.xconf files. The selected file is displayed in the editor's editing zone.

Since the APE configuration files are generated when the APE is started by means of the variables for configuring the current environment, these files are opened in read-only mode and the user cannot modify them.


This command is only visible if the APE application has started.


Commands to manage environments

Contains the following commands:

  • Create an environment: To create a new environment in the test suite by entering its name. After confirmation, the environment document is displayed in the editor's editing zone.
  • Delete an environment: To delete an environment from the test suite by selecting its name in the list of existing environments. Once deletion is confirmed, the environment is destroyed and if it was open in the editor's editing zone its document is closed.
  • Edit an environment: To view the contents of an environment by selecting its name in the list of existing environments. When the user selects the environment, its document is displayed in the editor's editing zone. If the environment was already open, its document becomes the active document. The base environment (created when the test file is generated) is always open in read-only mode and the user cannot modify it.


Close all test cases

This command closes all the test case documents open in the editor's editing zone, as well as all the documents resulting from execution of test cases open in this zone.


Reload test suite file

This command reloads the test suite file (only required if this file was modified outside the Visual Studio Code application). Reloading causes the Spring Boot APE application to stop if it had started, and closes all the test cases.


Display Adelia help

Displays this page in the machine's default browser.

When a request is made to open an external link, Visual Studio Code requests confirmation to open it. To avoid having to confirm each time, the link's URL source needs to be added as a trusted site.


Note: Trusted sites are managed in Visual Studio Code by enabling the "Manage Trusted Domains" command with the command palette (Ctrl + Shift + P in Windows).

Item commands

It is possible to access the commands associated with the items in the TEST SUITE tree view. Only the test case and template items have associated commands.

To activate these commands move the mouse cursor to the relevant item.

Top of page

Template item commands

New test case 

This command adds a test case to the test suite. This test case will be directly associated with the template defined by the item. Test cases are created in three steps:

  • Step 1 Enter a test case name,
  • Step 2 Enter a test case description (can be left empty),
  • Step 3 Enter the HTTP request from the Spring Boot APE's Web service which will be consumed when the test case is executed. In this step, two input helps are available (placed above the field):
    • Use the  icon (Choose an existing request URL) to choose one URL from the existing URLs (those created by default and those created by the user). When an URL is defined with environment variables, its expanded value is displayed on the same line.
    • Use the  icon (Add an environment variable) to add an environment variable at the end of the text you are entering. The list proposes all the variables defined in the current environment as well as the variables from the base environment (if they have not been redefined in the current environment). Each line in the list displays the variable name, its real value and its expanded value if it contains other variables, its origin (environment in which the variable was defined or redefined) and finally its type (numeric, character string, Boolean, null).


To cancel these input helps and return to step 3, click on the Back button.


At the end of the last step, the new test case is created in the view (a new test case item is created under the template item) and the test case document is displayed in the editor's editing zone.

At each step you can cancel creation of a new test case by pressing the Esc. key.


Context-sensitive menu commands

This menu is displayed after right-clicking on a template item.


Open template file

Opens the file associated with the template (normally accessible via the Visual Studio Code Explorer view) and displays the document in the editor's editing zone. If it is already open, it becomes the active document.


Close all test cases

This command closes all the documents open in the editor's editing zone which correspond to:

  • test case documents associated with the template referring to the item,
  • documents resulting from execution of test cases associated with the template referring to the item.


Delete all test cases

After confirmation, deletes from the test suite all test cases associated with the template corresponding to the item. The open documents corresponding to the relevant test cases are closed.


↑ Top of page

Test case item commands

Run

This command executes the test case corresponding to the item. The document resulting from execution is displayed in the editor's editing zone.


Context-sensitive menu commands

This menu is displayed after right-clicking on a test case item.


Delete

After confirmation, deletes from the test suite the test case corresponding to the item. Open documents corresponding to the relevant test case are closed (test case document and document resulting from execution of the test case).


Duplicate

This command is used to duplicate a test case. After entering the name of the copied test case, the document for the new test case is displayed in the editor's editing zone.


Rename

This command is used to rename a test case, after entering its new name. If the test case document was open, it is displayed again in the editor’s editing zone with its new name.


Activate data model

This command is used to select this test case as the data model for the associated template. The item icon changes to . If there was a previous test case data model for this template, it is deselected.

↑ Top of page

The TEMPLATE TEST CASES view


This view groups together all the test cases associated with a template. Its content updates according to the active document:

  • a template document, a test case document, a document resulting from execution of a test case causes an update of the view,
  • while any other document empties the view.


The view's tree consists of a template item represented by the icon whose text is the name of the active template. Each test case is a terminal item of the tree view represented by the icon. The text associated with the item is the name of the test case followed by the locale associated with the test case. When you mouse click on a test case item, a document containing the test case data is opened and displayed in the editor's editing zone. If the document is already open, it becomes the active document.


When you move the mouse cursor in the view display zone, the available commands are displayed.

Item commands

It is possible to access the commands associated with the items in the TEMPLATE TEST CASES tree view. To activate these commands move the mouse cursor to the relevant item.

Top of page

Template item commands

New test case 

This command adds a test case to the test suite. This test case will be directly associated with the template defined by the item. Test cases are created in three steps:

  • Step 1 Enter a test case name,
  • Step 2 Enter a test case description (can be left empty),
  • Step 3 Enter the HTTP request from the Spring Boot APE's Web service which will be consumed when the test case is executed. In this step, two input helps are available (placed above the field):
    • Use the  icon (Choose an existing request URL) to choose one URL from the existing URLs (those created by default and those created by the user). When an URL is defined with environment variables, its expanded value is displayed on the same line.
    • Use the  icon (Add an environment variable) to add an environment variable at the end of the text you are entering. The list proposes all the variables defined in the current environment as well as the variables from the base environment (if they have not been redefined in the current environment). Each line in the list displays the variable name, its real value and its expanded value if it contains other variables, its origin (environment in which the variable was defined or redefined) and finally its type (numeric, character string, Boolean, null).


To cancel these input helps and return to step 3, click on the Back button.


At the end of the last step, the new test case is created in the view (a new test case item is created under the template item) and the test case document is displayed in the editor's editing zone.

At each step you can cancel creation of a new test case by pressing the Esc. key.


Context-sensitive menu commands

This menu is displayed after right-clicking on a template item.


Open template file

Opens the file associated with the template (normally accessible via the Visual Studio Code Explorer view) and displays the document in the editor's editing zone. If it is already open it becomes the active document.


Close all test cases

This command closes all the documents open in the editor's editing zone which correspond to:

  • test case documents associated with the template referring to the item,
  • documents resulting from execution of test cases associated with the template referring to the item.


Delete all test cases

After confirmation, deletes from the test suite all test cases associated with the template corresponding to the item. The open documents corresponding to the relevant test cases are closed.

Top of page

Test case item commands

Run

This command executes the test case corresponding to the item. The document resulting from execution is displayed in the editor's editing zone.


Context-sensitive menu commands

This menu is displayed after right-clicking on a test case item.


Delete

After confirmation, deletes from the test suite the test case corresponding to the item. Open documents corresponding to the relevant test case are closed (test case document and document resulting from execution of the test case).


Duplicate

This command is used to duplicate a test case. After entering the name of the copied test case, the document for the new test case is displayed in the editor's editing zone.


Rename

This command is used to rename a test case, after entering its new name. If the test case document was open, it is displayed again in the editor's editing zone with its new name.


Activate data model

This command is used to select this test case as the data model for the associated template. The item icon changes to . If there was a previous test case data model for this template, it is deselected.

↑ Top of page

The TEST CASE INFO view


This view shows the information about the active test case. Its content updates according to the active document:

  • a test case document, a document resulting from execution of a test case causes an update of the view,
  • while any other document empties the view.


The view's tree consists of items to display and modify information constituting the test case:

  • The text of the item with the or icon is the name of the test case. The second icon indicates that this test case is selected as the data model,
  • The text of the item with the icon is the description of the test case,
  • The text of the item with the  icon is the URL of the test case HTTP request. The item's tooltip displays the expanded value of the URL, if it contains environment variables,
  • The text of the item with the icon is Headers. The item comprises all the HTTP headers of the request. A digit indicates the cardinality of this data,
  • The text of the items with the icon is the name of the HTTP header and its value if it is defined. The item's tooltip displays the expanded value of the header value if it contains environment variables.


When you move the mouse cursor in the view display zone, the available commands are displayed.

Edit 

This command is used to modify the text of an item. Depending on the type of item, this command can be used to modify:

  • the name of the test case by entering a new name in the entry field,
  • the description of the test case by entering a new description in the entry field,
  • the URL of the test case HTTP request. To do so, two input helps are available (placed above the URL entry field):
    • Use the  icon (Choose an existing request URL) to choose one URL from the existing URLs (those created by default and those created by the user). When an URL is defined with environment variables, its expanded value is displayed on the same line.
    • Use the  icon (Add an environment variable) to add an environment variable at the end of the text you are entering. The list proposes all the variables defined in the current environment as well as the variables from the base environment (if they have not been redefined in the current environment). Each line in the list displays the variable name, its real value and its expanded value if it contains other variables, its origin (environment in which the variable was defined or redefined) and finally its type (numeric, character string, Boolean, null).
  • An HTTP request header (its name and/or its value). Two steps are required to make the modification:
    • Step 1 Modification of the header name,
    • Step 2 Modification of the header value. Input help is available (placed above the entry field):
      • Use the  icon (Add an environment variable) to add an environment variable at the end of the text you are entering. The list proposes all the variables defined in the current environment as well as the variables from the base environment (if they have not been redefined in the current environment). Each line in the list displays the variable name, its real value and its expanded value if it contains other variables, its origin (environment in which the variable was defined or redefined) and finally its type (numeric, character string, Boolean, null).

Delete

This option is only available for header items. It is used, after confirmation, to delete one header from the set of HTTP request headers.

Add

This option is only available for the Headers item. It is used to add a new header to the set of HTTP request headers. The header is added in two steps:

  • Step 1 Enter the header name,
  • Step 2 Enter the header value. Input help is available (placed above the entry field):
    • Use the  icon (Add an environment variable) to add an environment variable at the end of the text you are entering. The list proposes all the variables defined in the current environment as well as the variables from the base environment (if they have not been redefined in the current environment). Each line in the list displays the variable name, its real value and its expanded value if it contains other variables, its origin (environment in which the variable was defined or redefined) and finally its type (numeric, character string, Boolean, null).

↑ Top of page

The TEST CASE RUN view


This view shows the information about execution of the active test case.

The view's tree consists of items making it possible to display information about execution:

  • The text of the item with the or  icon is the return code of the executed HTTP request,
  • The text of the item with the icon is the request execution time,
  • The text of the item with the icon is the size of the request response,
  • The text of the item with the icon is Headers. The item comprises all the HTTP headers of the request response. A digit indicates the cardinality of this data,
    • The text of the items with the icon is the name of the HTTP header and its value.


This view is in read-only mode and no command is available.

Top of page

Creating a test suite



To add a test case it is first necessary to create a test suite. This action is performed in the TEST SUITE view (when the view detects that no test suite is present in the work folder) by clicking on the Generate it before creating test cases button: The user must select a sub-directory (work folder) which will be used as the name space root. The absolute path of this sub-directory will be used as the search root of the "file system" type of FreeMarker template loader which will be used to execute the Spring Boot APE application.

The chosen directory must contain all the templates to be tested. If a template is located outside this directory, it will not be possible to associate a test case to it. To choose the work folder as the search root, you must select the "\" sub-directory in the list.

The test suite file is created in the .apetest sub-directory of the work folder. The name of this file is apetestsuite.json (in JSON format). It contains all the information about the test suite:

  • all the created test cases,
  • all the created environments,
  • all the Spring Boot APE parameters.

Top of page

Management of environments

An environment is an execution context that can be configured by means of environment variables. The user is able to create / delete / edit their own environments. They are stored in the test suite file.

An environment is defined by a JSON object. The names of this object's attributes define the environment variables. Each variable is either Boolean, numeric or alphanumeric.

When an environment is edited (using the Edit command), a JSON format document is opened in the editor's editing zone. Its name is the name of the environment, and its content is the environment's data.

Input help (self-completion with the key combination Ctrl + Space, context-sensitive help when the mouse is placed on an attribute, etc.) is available for editing an environment.

Base environment

When a test suite is created, by default there is a base environment called "Base environment" containing the following variables:

  • hostname: Host name of a destination machine to which HTTP requests for test case execution are sent. The value of this variable is "localhost".
  • http_port: HTTP port number to which HTTP requests for test case execution are sent. The value of this variable is 8080.
  • context_path: Path used in the HTTP request to access the test case execution Web service. The value of this variable is "/ape".
  • api_version: Version of the Spring Boot APE Web services. The value of this variable is "v1".
  • base_url: Part of the HTTP request consisting of the hostname, http_port and context_path variables. The value of this variable is "http://{{{hostname}}}:{{{http_port}}}{{{context_path}}}".
  • root_log_level: Overall log level of the Spring Boot APE. The value of this variable is "WARN".


The default URL of the HTTP request for the Spring Boot APE Web service that will be consumed when the test case is executed is "{{{base_url}}}/{{{api_version}}}/<ws_name> where the value of ws_name is either "mergeandtransform" or "mergedoc" depending on the test cases.

Environment variable

In an environment, a variable can be defined either by a literal value (Boolean true/false value, numeric value, alphanumeric value) or by means of other variables. In this case it is necessary to use the notation {{{ ref_variable }}} (surrounding the variable name with a triple pair of curly brackets) to refer to the value of a variable in the definition of another variable.

When a variable is defined using other variables, it is therefore the alphanumeric type.


E.g. in the following environment:

{
"temperature": 23,
"unit": "?C",
"label": "The temperature is {{{temperature}}} {{{unit}}}"
}

The "label" variable is defined by means of two other variables, "temperature" and "unit", and its expanded (or deduced) value is the alphanumeric string "The temperature is 23 °C".


In the base environment, the expanded value of the base_url variable is "http://localhost:8080/ape" and the default URL of the Web services is "http://localhost:8080/ape/v1/<ws_name>".


It is possible to use a variable belonging to the current environment:

Variable overload

When a user creates a new environment, it inherits the base environment variables.

In this new environment the user can define a variable whose value refers to a base environment variable. In addition the user can redefine (or overload) the value of a base environment variable by redeclaring it in their environment.


E.g. in the following environment:

{
"http_port": 8081,
"mergeandtransform_url": "{{{base_url}}}/{{{api_version}}}/mergeandtransform"
}

the expanded value of the "margeandtransform_url" variable is "http://localhost:8081/ape/v1/mergeandtransform". The http_port variable is overloaded and the other variables base_url and api_version are inherited.

Current environment

Execution of a test case is associated with an execution context. By default the execution context is linked to the base environment. The Visual Studio Code status bar indicates via the icon which environment is being used:



"No environment" means that the base environment is the current environment. It is possible to change the current environment by clicking on the icon: The new environment must be selected from the list of proposed environments.

Depending on the type of variables defined and/or overloaded in the new current environment, it may be necessary to restart the Spring Boot APE to take into account the new execution context (e.g. changing the HTTP port, changing the log level, etc.).

Top of page

Management of the Spring Boot APE application

This application is embedded with the extension. It sets out all the APE's Web services for executing test cases.

The user manages the functioning of this application by means of start, stop and restart commands (the application is not installed as a service).

To be able to execute the Spring Boot APE you need to first install a JDK or JRE Java 1.8 minimum. The search for a JDK / JRE is performed in this order:

  • search to ascertain whether the "Ape Spring Boot: Java Path" option is indicated in the Template Editing APE extension (this option is used to specify the root path of a JDK or JRE),
  • search for the JAVA_HOME environment variable in the machine's operating system,
  • search for a "java.exe" executable in the list of paths defined by the PATH system environment variable.


By default, it is only possible to execute a test case if the Spring Boot APE has started (see the Spring Boot APE configuration operation: Automatic Start App Executing Test Case). In the event of automatic starting, depending on host machine performance it may be necessary to increase the start-up waiting time (see the Spring Boot APE configuration option: Waiting Time Before Executing Test Case).

The Spring Boot APE output channel

When this application starts up, an output channel is created to display the output logs produced by execution of the test cases. This channel called "APE application" is displayed in the "OUTPUT" tab of the Panel area in the Visual Studio Code interface:



The overall log level of the Spring Boot APE is indicated by the root_log_level environment variable. It is possible to overload this value in a new environment (the possible values are TRACE, DEBUG, INFO, WARN, ERROR and FATAL).

In addition, in the extension configuration options it is possible to configure the text styles and colors to apply to the different log levels in the output channel.

Finally, it is possible to clear the output channel using the "Clear Output"command available in the context-sensitive menu of the output channel window.


The APE start command displays the Adelia Print Engine banner in the output channel.

The APE stop command displays the text "Adelia Print Engine is shut down" in the output channel.

Execution of a test case can produce logs at different levels in the output channel.

Status of the Spring Boot APE

At any time you can obtain the current status of the application in the Visual Studio Code status bar:


Configuration of the Spring Boot APE

As indicated in the Starting options section, the application can be configured using the following configuration files:

  • application.yml (configuration Spring Boot),
  • freemarker.properties (configuration du moteur FreeMarker),
  • fop.xconf (configuration Apache FOP).


When the application starts, these three files are generated automatically and are loaded by the application. Generation of these files is based on configurable information.

Configuration of the .yml application

In this YAML format file, the server.port, server.servlet.context-path and logging.level.ROOT attributes are mapped respectively to the http_port, context_path and root_log_level environment variables.

It is possible to distinguish a given log level for each Java package. To do so, the environment variable applicationYaml.logging.level can be defined as follows:

"applicationYaml": {
	"logging": {
		"level": [
			{
				"package": "com.hardis.adelia.mergedocengine",
				"level": "DEBUG"
			},
			{
				"package": "com.hardis.adelia.transformxslfoengine",
				"level": "DEBUG"
			}
		]
	}
}

The "level" attribute is a sequence of objects defined by two attributes:

  • package: takes the name of a Java package to which you want to assign a log level,
  • level: the log level to set for this package

In this example we apply the DEBUG log level to all Java classes defined in the two packages com.hardis.adelia.mergedocengine and com.hardis.adelia.transformxslfoengine.

↑ Top of page

Configuration of freemarker.properties

In this Properties format file it is possible to distinguish certain values of properties, i.e.:

  • boolean_format,
  • default_encoding,

  • locale,

  • log_template_exceptions,

  • template_exception_handler,

  • template_update_delay,

  • wrap_unchecked_exceptions


To do so, the freemarkerProp environment variable can be defined as follows (by defining the chosen variables):

"freemarkerProp": {
	"boolean_format": "yes,no",
    "default_encoding": "UTF-8",
    "locale": "fr",
    "log_template_exceptions": false,
    "template_exception_handler": "debug",
    "template_update_delay": "5s",
    "wrap_unchecked_exceptions": false
}


Configuration of fop.xconf

In this XML format file it is possible to distinguish certain values of properties, i.e.:

  • source-resolution,
  • target-resolution,
  • default-page-settings


To do so, the fopXconf environment variable can be defined as follows (by defining the chosen variables):

"fopXconf": {
	"source_resolution": 96,
	"target_resolution": 96,
	"default_page_settings": {
		"height": "29.7cm",
		"width": "21cm"
	}
}


Show APE application configuration files

This command triggers opening of a document containing the data from the file generated in the editor's editing zone. Each document has the name and type of the selected file.

If the current environment contains the configuration variables, their values are expanded in the generated file (the document displays the result file).


Top of page

Management of the data model

When developing a template, it is possible to provide help for input of a template's data model. To do so, the user must produce a specific JSON file called <template_name>_dmodel.json.

By means of the test suite, the user can use the data defined in a test case as the data model for the associated template. There can only be one data model test case in all of a template's test cases.

When a test case is defined as a template data model, its data replace those defined in the <template_name>_dmodel.json file if it exists (priority is given to the test case on the data model file).

In this case, the icon of the test case item in the TEST SUITE and TEMPLATE TEST CASES views is .

Similarly, the icon for the name of the test case in the TEST CASE INFO view is .

Information from test cases selected as data models is stored in the test suite.

Creating a test case

By definition, a test case groups all the data necessary to describe a use case for a template executed by means of a Web service from the Spring Boot APE. It is identified by the following information:

  • a name (mandatory),
  • a description (optional),
  • information about the call and execution of the relevant Web service, i.e.:
    • an access URL (mandatory),
    • HTTP headers (optional),
    • a payload: a JSON message stored in the body of the HTTP request. The main components of this JSON message are:
      • a data model (mandatory),
      • a template name (mandatory),
      • a name space (optional),
      • a locale (optional).


Creation of a test case can be started either in the Explorer view of Visual Studio Code, or in the TEST SUITE or TEMPLATE TEST CASES views of the Template Editing APE extension.

In addition, the user can delete / duplicate / rename a case test.

Editing a test case

When a test case is edited, a document with the same name is opened and displayed in the editor's editing zone. This JSON document contains the payload of the HTTP request sent to execute this test case.

Input help (self-completion with the key combinationCtrl + Space, context-sensitive help when the mouse is placed on an attribute, etc.) is available for editing the payload.

In addition, the syntax is analyzed during input of the document. This syntactical analysis can detect two types of problems: warnings and errors. When they are detected they are displayed in the "PROBLEMS" tab of the Panel area in the Visual Studio Code interface:



When a problem is detected on a test case, the icon for this test case item in the TEST SUITE and TEMPLATE TEST CASES views tree is or depending on the type of problem:



When the user performs a back-up, the content of the document associated with the test case is saved in the test suite file. It must be saved before executing the associated test case.

Commands

A test case document has associated commands positioned in the tab bar of documents open in the editing zone of the Visual Studio Code editor. These commands are only accessible when the active document is a test case document.

Run test case

This command is identical to the "Run" commands in the TEST SUITE and TEMPLATE TEST CASES views.

Generate client code

This command is available via a context-sensitive menu accessible under the "..." icon. It displays the execution source code of the test case in the form of a call to the relevant Web service.

From a list, the user chooses the destination programming language and the code library used to implement the Web service call. Several programming languages are available:

  • French language Adelia (use of the EXECUTE_HTTP instruction),
  • English language Adelia (use of the EXECUTE_HTTP instruction),
  • Java,
  • Go,
  • C,
  • PHP,
  • Python
  • Etc.


After the destination language is selected, a document containing the code for implementing the Web service call for the test case is opened and displayed in the editing zone of the Visual Studio Code editor.

The name of this document is the name of the test case followed by "[Client code]". When this document is active, you can change the destination language by clicking on the name of the language chosen in the Visual Studio Code status bar:


Top of page

Executing a test case

A test case is executed by calling the relevant Web service via the associated request, built from the headers and the payload defined in the test case, and then by rendering the result of the processing contained in the response to the request, in the form of a document the user can view.

This execution is triggered via the different "Run" commands described above. If a test case is currently being executed, this is indicated by an animation in the Visual Studio Code status bar:



In addition, execution can generate logs in the Spring Boot APE output channel.

On completion of execution, information about its result is displayed in the TEST CASE RUN view.


Rendering of the execution result generates a document that is displayed in the editor's editing zone. By default, execution of the test cases is rendered in a single document: A single result document is opened for all executions of all test cases. The result document of the last execution will be replaced by the result document of the next execution. The option entitled "Test Case Result Preview: Single Viewer Of The Test Case Result Document" in the parameters of the Template Editing APE extension makes it possible to associate a result document with each executed test case.


Depending on the return code of the execution result (the return code of the HTTP request), a document is either an error document or a result document.

Error document

An error document contains the errors occurring during execution of a test case, usually produced by the Spring Boot APE. This is a document in JSON format. Its name is the name of the executed test case, prefixed by "Preview ". The error described in this document's content goes hand in hand with the error logs produced in the output channel of the Spring Boot APE:


Result document

If there are no errors during execution, the result produced by the called Web service is a document in the format defined by the mimeType or outputMimeType attribute of the request payload. Its name is the name of the test case, prefixed by "Preview ".

When a result document is active, the information about the document size and test case execution time is displayed in the Visual Studio Code status bar (this information is also available in the TEST CASE RUN view):



By default, several formats are supported to display the content of the document in Preview mode (the content is interpreted and is displayed in the same way as a specialized reader), i.e.:

  • PDF: the document is displayed in the same way as Acrobat Reader or an Internet browser,
  • HTML: the document is displayed in the same way as an Internet browser,
  • XML: the document is indented correctly to make it easier to read, with the possibility of expanding / reducing nodes,
  • CSV: the data are displayed and indented in the form of columns,
  • PNG, JPEG: the image is viewed,
  • JSON: the document is indented correctly to make it easier to read, with the possibility of expanding / reducing the objects and arrays,


Some examples of documents displayed in Preview mode:


 


When no Preview mode is available for the result document format, its content is displayed in the form of raw data.

Commands for a result document

A result document has associated commands positioned in the tab bar of documents open in the editing zone of the Visual Studio Code editor. These commands are only accessible when the active document is a result document.



Save raw data

Saves the content of the result document in the form of a file. A dialog box enables the user to select the folder that will contain the file. By default, the file name contains the name of the test case, and has a suffix associated with the format of the result document.

Show test case

Displays the test case associated with the result document. This command triggers opening of a document containing the test case data and displays it in the editor's editing zone. If the document is already open, it becomes the active document.

Raw data

Switches the document to raw data display mode when the result document is in Preview mode. The name of the new document is the name of the test case prefixed by "Raw".

Preview data

Switches the document to display in Preview mode when the result document is in raw data display mode. The name of the new document is the name of the test case prefixed by "Preview".

Top of page

  • Aucune étiquette