Skip to content
This repository was archived by the owner on Jan 19, 2020. It is now read-only.
This repository was archived by the owner on Jan 19, 2020. It is now read-only.

Functional Tests Extensible #5

@manuel-rubio

Description

@manuel-rubio

I used to do a lot of mocks for database inside of functional tests and, sometimes, it's difficult to read all the information there so, I think the better is implemente the capability functional tests can be extended, for example...

<functional>
    ...
    <dbi xmlns="dbi:dbi_tests">
        <query><![CDATA[SELECT * FROM mitable WHERE name = $1]]></query>
        <params>
            <param id="1">Alice</param>
        </params>
        <result type="JSON"><![CDATA[
            ["Alice", "female", 1970]
        ]]></result>
        <send event="queried"/>
    </dbi>
    ...
</functional>

In Params we can use:

<param type="all"/>

To accept whatever param in that position and, the query can use:

<query type="begins_with"><![CDATA[SELECT * FROM mytable]]></query>

And then the query can match with whatever query, even if we adds GROUP BY, ORDER BY, WHERE, ...

About events:

<send event="queried"/>

This is equivalent to the next code, inside of the code part of the mock:

(_,_,_) -> PID ! queried, {"Alice", "female", 1970}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions