Forum Discussion

Prudential_UK_A's avatar
Prudential_UK_A
Frequent Contributor
16 years ago

Re: Actions to be available on multiple selections

Hi,

I was wondering if it would be possible to add functionality that allows a user to select multiple test steps, or test cases or assertions (for example) and then be able to apply a generic action to them, like 'remove' or 'delete'?  This type of functionality could be available in a right mouse click pop up menu.

Thanks
Nicole :-)

2 Replies

  • Hi Nicole,

    this should actually be possible; add them to a actionGroup named "SoapUIMultiActions" and be sure the action implements SoapUIMultiAction.. for example in the default soapui-actions.xml there is

    <tns:actionGroup name="SoapUIMultiActions" id="SoapUIMultiActions">
            <tns:actionMapping actionId="MultiTestStepDeleteAction" keyStroke="DELETE"/>
        </tns:actionGroup>


    and the corresponding action is as follows:

    package com.eviware.soapui.impl.actions.multi;

    import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestStep;
    import com.eviware.soapui.model.ModelItem;
    import com.eviware.soapui.support.UISupport;
    import com.eviware.soapui.support.action.support.AbstractSoapUIMultiAction;

    public class MultiTestStepDeleteAction extends AbstractSoapUIMultiAction<ModelItem>
    {
    public static final String SOAPUI_ACTION_ID = "MultiTestStepDeleteAction";

    public MultiTestStepDeleteAction()
    {
    super( SOAPUI_ACTION_ID, "Delete", "Delete selected items" );
    }

    public void perform( ModelItem[] targets, Object param )
    {
    if( UISupport.confirm( "Delete selected Test Steps?", "Delete Items" ) )
    {
    for( ModelItem target : targets )
    {
    ( ( WsdlTestStep )target ).getTestCase().removeTestStep( ( WsdlTestStep )target );
    }
    }
    }

    public boolean applies( ModelItem target )
    {
    return( target instanceof WsdlTestStep );
    }
    }


    Implement the applies method as desired.

    Does that help you forwards?

    regards!

    /Ole
    eviware.com
  • Prudential_UK_A's avatar
    Prudential_UK_A
    Frequent Contributor
    Hi Ole,

    Thanks for your speedy reply.  That helps with regards to our own actions, but what about if we want to apply the built-in actions to multiple test cases or steps for example?

    Thanks
    Nicole :-)