Forum Discussion

CaryB's avatar
CaryB
Contributor
11 years ago

Last Plugin Hurdle

Well, I thought I had this licked but I guess I was wrong. I've migrated my existing non-Maven project to the new architecture but I've had to (temporarily at least) turn my custom test step into an action instead. It works, but I hate to remove functionality that was working. When I create an absolute barebones test step SoapUI is unable to add it to my test case due to a null pointer in the auto factory.


import com.eviware.soapui.config.TestStepConfig;
import com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase;
import com.eviware.soapui.impl.wsdl.teststeps.WsdlTestStepWithProperties;
import com.eviware.soapui.model.testsuite.TestCaseRunContext;
import com.eviware.soapui.model.testsuite.TestCaseRunner;
import com.eviware.soapui.model.testsuite.TestStepResult;
import com.eviware.soapui.plugins.auto.PluginTestStep;

@PluginTestStep(typeName = "",
name = "Sample Step",
description = "Does some sample stuff.",
iconPath = "disk.png")
public class SampleStep extends WsdlTestStepWithProperties {

public SampleStep(WsdlTestCase testCase, TestStepConfig config, boolean hasEditor, boolean forLoadTest) {
super(testCase, config, hasEditor, forLoadTest);
}

@Override
public TestStepResult run(TestCaseRunner testCaseRunner, TestCaseRunContext testCaseRunContext) {
return null;
}
}


All I've done at this point is created a class which extends the test step, overrode the run method as required, added a constructor, and included the PluginTestStep annotation.

When I try adding it to a test case this is what I get:


An error occurred [com.mycompany.SampleStep.buildTestStep(com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase, com.eviware.soapui.config.TestStepConfig, java.lang.Boolean)], see error log for details


Error Log

Tue Oct 28 10:05:14 EDT 2014:ERROR:java.lang.[b]NoSuchMethodException[/b]: com.mycompany.SampleStep.buildTestStep(com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase, com.eviware.soapui.config.TestStepConfig, java.lang.Boolean)
java.lang.NoSuchMethodException: com.mycompany.SampleStep.buildTestStep(com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase, com.eviware.soapui.config.TestStepConfig, java.lang.Boolean)
at java.lang.Class.getMethod(Unknown Source)
at [b]com.eviware.soapui.plugins.auto.factories.AutoTestStepFactory.buildTestStep[/b](SourceFile:37)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase.createTestStepFromConfig(WsdlTestCase.java:295)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase.insertTestStep(WsdlTestCase.java:484)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase.addTestStep(WsdlTestCase.java:400)
at com.eviware.soapui.impl.wsdl.actions.testcase.AddWsdlTestStepAction.perform(AddWsdlTestStepAction.java:61)
at com.eviware.soapui.impl.wsdl.actions.testcase.AddWsdlTestStepAction.perform(AddWsdlTestStepAction.java:34)
at com.eviware.soapui.support.action.swing.SwingActionDelegate.actionPerformed(SwingActionDelegate.java:89)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)


So have I missed a step or is the infrastructure not working as expected?

5 Replies

  • Hi,

    The typeName property in the @PluginTestStep doesn't have a name, your assigning it an empty string. It's possible that could be throwing things off. Also, did you create a class that uses the @PluginConfiguration annotation? I believe that is required to load a plugin through the plugin manager.

    http://www.soapui.org/apidocs/pro/com/e ... ation.html

    Regards,
    Marcus
    SmartBear Support
  • I caught that and fixed it but it had no effect.

    RE: @PluginConfiguration, yes. My actions are working fine. It's only the test step that blows up.
  • Hi,

    I noticed that the code you posted does not specify the package it is in.

    java.lang.NoSuchMethodException: com.mycompany.SampleStep.buildTestStep


    There should be a
    package com.mycompany;
    as the first line in the source file as well as the supporting directory structure com/mycompany for your code. Are you using a package for any of your source files? This could be a bug in the framework if you are not specifying a package in any of your code, and you are using the default package instead.


    Regards,
    Marcus
    SmartBear Support
  • Yes, I'm using packages and the appropriate structure. I just left the declaration out when I pasted it in the post.
  • Hi,

    I noticed one more thing. You have one more parameter in your constructor. You have boolean hasEditor parameter in your constructor, there should only be 3 parameters which is why you are getting the NoSuchMethodException. So your constructor should be:


    public SampleStep(WsdlTestCase testCase, TestStepConfig config, boolean forLoadTest) {
    super(testCase, config, hasEditor, forLoadTest);
    }



    Regards,
    Marcus
    SmartBear Support