Parser test

Nov 16, 2017


  • General information(top)


    In A-Parser on the "Test parsing" tab, there is a possibility of test parsing to create and debug the work of your own presets.

    Unlike the "Task Editor", it is not possible to use "constructors", save the results of the presets operation to a "file", use several parsers, do not support macros, there is no multi-level parsing and other features that are supported in the task editor.

    The section is created on the principle of a unit test, in which individual parsers can be tested. The entire work process is displayed in the "Logs" window, this allows you to obtain detailed information about the operation of the parser (preset), starting from sending the request and until the results are received:
    [​IMG]

    Creating a test preset(top)


    To create a test preset, you need to fill in the appropriate fields. Each field has its own meaning:
    • [​IMG] "parser" - choose the parser we need from our list;
    • "request" - specify the query for the search;
    • [​IMG] "settings" - default value is "default", it is possible to select previously saved settings from the list, or using the icon through the "parser settings" menu, specify the required;
    • [​IMG] "additional settings" - a list of additional settings identical to those that are placed in the "task editor". Using the icon we get to the list where we select the parameters we need

    Quick settings area(top)



    In the "Test parsing" there is a quick settings area: disabling autoscrolling and enabling debug mode.
    [​IMG] By default "avstoskrol" is turned on, this means that as information is output to the log, we automatically will move down.
    [​IMG] When we turn off "autoscrolling", the icon changes its appearance, this means that as information is output to the log, we will remain on the spot, there will be no automatic movement down.

    [​IMG] By default, debug mode is disabled, this means that general information on parsing is output to the log.
    [​IMG] When we activate debug mode, the icon changes its appearance and the detailed information about parsing will be displayed in the log.

    In the log window, we see detailed information on parsing:
    [​IMG]
    In the part of the query, we can see:

    1. Request title
    2. The query string that is sent to the server
    3. The list of parameters that are sent along with the request (headers, coding, filters, etc.)
    In the part of the response that we receive from the server, we see the following information:
    [​IMG]
    1. "See in debug window" - a link to open a window where the page received as a result of the request is displayed
    [​IMG]
    2. "See full data" - a link on the opening of which appears a window with the source code received as a result of the request
    [​IMG]
    3. The results of the operation of the parser (preset) which are specified by default, or redefined by the option "Result format"

    If the "autoscroll" mode is created more for easy viewing, the "debug" mode is an indispensable tool for debugging your own parsers and presets. Analyzing the information received from the log in the "debug" mode, we can see at what stage and what happens during the execution of the task, how the query is formed and what the parser receives in response.
zbest and Forbidden like this.