Custom Tool

rvmsengrvmseng Posts: 79

Dear Support team,

I create a custom tool and I define some GUI fields in "parasoft-extension.xml" based on below images, but I have a problem in parametrize inputs. when I want use ${my_var} in input fields it can't parse variable value and it return only string "${my_var}", please refer below images



Comments

  • rvmsengrvmseng Posts: 79
    edited March 13

    Please visit following link in SOA documentation, unfortunately it does not work for me.

    https://docs.parasoft.com/display/SOAVIRT9103/Adding+a+Custom+Tool#AddingaCustomTool-Definingparasoft-extension.xmlforaCustomTool

    Data Sources, Data Bank values, environment variables and test or responder suite variables can be referenced in the extension GUI fields using the ${var_name} syntax. The standard "Parameterized" and "Scripted" GUI controls can also be used to parameterize fields.

    Please assist me.

  • benken_parasoftbenken_parasoft Posts: 649 ✭✭✭
    edited March 13

    I recommend you contacting Parasoft Support if you don't get an answer from the forum community.

    In case this helps you, one thing I can say is that in your implementation of com.parasoft.api.tool.ICustomTool.execute(IToolInput, IToolContext) that you get the field values by calling context.getConfiguration().getString("fieldId"). The returned value will have any variables resolved automatically, for any variables that successfully resolve. Please also note that accessing the field values from other methods in your ICustomTool implementation, like isValidConfig(), won't have variables resolved since that method is called outside of test execution context. In those cases you get the configured value whereas "execute" method has access to the resolved value you need at execution time.

  • rvmsengrvmseng Posts: 79

    would you please put your solution.

  • benken_parasoftbenken_parasoft Posts: 649 ✭✭✭
    edited March 13

    would you please put your solution.

    I updated my previous comment with some info just in case that helps you. I can't see what you might doing wrong and I only have time to provide quick answers on the forum. Otherwise, if you would like someone from Parasoft Support to assist then I would recommend contacting them directly.

  • rvmsengrvmseng Posts: 79

    Thank you benken_parasoft,

    your solution work.

    BR.

  • rvmsengrvmseng Posts: 79
    edited March 14

    Dear Support team,

    I write a Custom Tool and deploy it on Soatest and it work properly and there is not any exception and error, but when I want to use it in LoadTest it return below exception:

    Invalid extension type. Expected instance of com.parasoft.api.tool.ICustomTool but saw com.mp.mqtt.MQttTool: com.mp.mqtt.MQttTool cannot be cast to com.parasoft.api.tool.ICustomTool.

    The class "com.mp.mqtt.MQttTool" implement "com.parasoft.api.tool.ICustomTool" but Loadtest throw exception still.

    Also I added my custom tool to Loadtest system property.

  • jakubiakjakubiak Posts: 447 admin

    This is most likely because you are adding com.parasoft.api.jar within the System Properties. The com.parasoft.api.* packages are already present in Load Test, so you don't need to add the jar to the System Properties. Adding the jar there looks like it is causing problems with the class loaders. Remove the com.parasoft.api.jar and I expect it will start working for you.

  • benken_parasoftbenken_parasoft Posts: 649 ✭✭✭
    edited March 14

    Please also consider checking out "MQTT Extensions" from the Parasoft Marketplace:
    https://marketplace.parasoft.com/#query?limit=24&offset=0&keywords=mqtt

    Also see MQTT Extensions docs.

  • rvmsengrvmseng Posts: 79

    Thank you,

    It work.

  • benken_parasoftbenken_parasoft Posts: 649 ✭✭✭

    @rvmseng, I am very curious to know why you decided to write a custom tool for MQTT. The one Parasoft developed for the Parasoft Marketplace is very robust and sophisticated.

  • rvmsengrvmseng Posts: 79

    :smile:

    because unfortunately I can not access to market place and I don't work in a company and I am a free lancer. I like your tools and I believe Parasoft is the best.

    I wish the best for you and your company.

  • benken_parasoftbenken_parasoft Posts: 649 ✭✭✭

    Nice! I also wish you the best!

  • rvmsengrvmseng Posts: 79
    edited March 16

    Dear Benken,

    How can I define a drop down list for Custom Tool input, please refer to below comment.

    Tables or lists can be implemented as comma-separated values in the string fields.

    https://docs.parasoft.com/display/SOAVIRT9103CTP310/Adding+a+Custom+Tool

    unfortunately I can not define it, because the "filed" element only has 3 attributes.

    <field id="myid" label="my lable" type="string" />

  • benken_parasoftbenken_parasoft Posts: 649 ✭✭✭

    You can't define a drop down list. You have to leave type="string". In the java code for your custom extension you would need to parse the value and report errors on bad input as appropriate.

  • rvmsengrvmseng Posts: 79

    Thank you.

Sign In or Register to comment.