Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Custom Tool

rvmseng
rvmseng Posts: 89

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

  • rvmseng
    rvmseng Posts: 89
    edited March 2019

    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_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭
    edited March 2019

    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.

  • rvmseng
    rvmseng Posts: 89

    would you please put your solution.

  • benken_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭
    edited March 2019

    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.

  • rvmseng
    rvmseng Posts: 89

    Thank you benken_parasoft,

    your solution work.

    BR.

  • rvmseng
    rvmseng Posts: 89
    edited March 2019

    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.

  • jakubiak
    jakubiak Posts: 795 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_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭
    edited March 2019

    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.

  • rvmseng
    rvmseng Posts: 89

    Thank you,

    It work.

  • benken_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭

    @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.

  • rvmseng
    rvmseng Posts: 89

    :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_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭

    Nice! I also wish you the best!

  • rvmseng
    rvmseng Posts: 89
    edited March 2019

    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_parasoft
    benken_parasoft Posts: 1,228 ✭✭✭

    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.

  • rvmseng
    rvmseng Posts: 89

    Thank you.