问题
I'm trying to test the load response of an OpenERP module that I've been developing. I've managed to authenticate and read from my model(s) thanks to this tutorial.
I'd like now test the creation and update of existing records, but I can't find anywhere the syntax to do such actions. I tried to adapt from the read method, but I'm not able to figure out how the xml is supposed to be built.
Is anyone that has already done such testing, willing to share knowledge about how to call the create and / or the write methods?
Thanks in advance!
回答1:
Refer to OpenERP documentation on XML-RPC Web Services, it has examples on create
and write
actions.
If you won't be able to translate their PHP examples to JMeter XML-RPC XML body perhaps you can use SoapUI to generate stubs.
It also worth looking into Testing SOAP/REST Web Services Using JMeter guide for generic approach of web services testing with JMeter.
回答2:
Finally got it to work. Found a thread on Lauchpad reporting a bug on creation partners with JMeter and the code there helped me understand how this should work, so I'll leave here the XML configuration file to create records on a custom module on OpenERP.
<?xml version='1.0'?>
<methodCall>
<methodName>execute</methodName>
<params>
<param>
<!-- Select your database -->
<value><string>may_9</string></value>
</param>
<param>
<!-- User uid, 1, why not? -->
<value><int>1</int></value>
</param>
<param>
<!-- user login -->
<value><string>admin</string></value>
</param>
<param>
<!-- identify your object -->
<value><string>generic.request</string></value>
</param>
<param>
<!-- and your action -->
<value><string>create</string></value>
</param>
<param>
<!-- here comes the values to insert -->
<value>
<!-- create a struct where you identify the field name, the field type and the value you want to insert in it -->
<struct>
<member>
<name>name</name>
<value><string>JMeter Request</string></value>
</member>
<member>
<name>subject_type</name>
<value><int>1</int></value>
</member>
<member>
<name>responsible_name</name>
<value><int>4</int></value>
</member>
<member>
<name>request_description</name>
<value><string>Desc</string></value>
</member>
<member>
<name>stating_reasons</name>
<value><string>stating reasons</string></value>
</member>
<member>
<name>expected_date</name>
<value><string>08/31/2014</string></value>
</member>
</struct>
</value>
</param>
</params>
</methodCall>
And that should work fine!
Hope this helps :)
来源:https://stackoverflow.com/questions/24535719/how-to-create-update-test-records-on-openerp-7-using-jmeter