Search code examples
erlangtsung

Dynamic variable on Tsung XML config file


I've set up TSUNG (v1.7) to test my application, but I'm facing some problem using a dynamic variable on my http request. To be more precise I need to retrieve some data from a CSV file and inserting it in my request.

Reading the documentation it seems that I don't really need to write any sort of functions, since I'm using a version above the 1.3, so to achieve that I just need to specify the file path on the 'option' tag and use the 'setdynvars', but unfortunately it doesn't seems works (the web server response says that the content is empty). Any idea why?

<?xml version="1.0"?>
<!DOCTYPE tsung SYSTEM "/home/Desktop/tsung-1.7.0/tsung-1.0.dtd">
<tsung loglevel="warning">
    <clients>
        <client host="localhost" use_controller_vm="true"/>
    </clients>

    <servers>
        <server host="127.0.0.1" port="8000" type="tcp"/>
    </servers>

    <load>
        <arrivalphase phase="1" duration="2" unit="minute">
            <users interarrival="45" unit="second"/>
        </arrivalphase>
    </load>

    <options>
        <option name="file_server" id="transactions" value="/home/Desktop/transactions.csv"/>  
    </options>

    <sessions>

        <session name="dummy" weight="1" type="ts_http">
            <setdynvars sourcetype="file" fileid="transactions" delimiter=";" order="iter">
                <var name="number_transaction"/>
            </setdynvars>

            <request>
                <http url="...path..." method="GET" version="1.1"></http>
            </request>

            <request subst="true"> 
                <http url='...path...' version='1.1' contents='transaction_id=%%_number_transaction%%' content_type='application/x-www-fomr-urlencoded' method='POST'></http>
            </request>
        </session>

    </sessions>
</tsung>

Solution

  • After some attempt I've figure out that by simply removing the attribute content_type from the request it will make the whole configuration works!