Package com.eviware.soapui.model.testsuite

Examples of com.eviware.soapui.model.testsuite.TestStep


  {
    int ix = name.indexOf( PROPERTY_SEPARATOR );
    if( ix > 0 )
    {
      String teststepname = name.substring( 0, ix );
      TestStep refTestStep = testCase.getTestStepByName( teststepname );
      if( refTestStep != null )
      {
        TestProperty property = refTestStep.getProperty( name.substring( ix + 1 ) );
        if( property != null && !property.isReadOnly() )
        {
          property.setValue( value.toString() );
          return;
        }
View Full Code Here


    }
  }

  public void afterStep( TestCaseRunner testRunner, TestCaseRunContext runContext, TestStepResult result )
  {
    TestStep currentStep = runContext.getCurrentStep();
    if( currentStep instanceof WsdlRunTestCaseTestStep )
    {
      ( ( WsdlRunTestCaseTestStep )currentStep ).removeTestRunListener( this );
    }
  }
View Full Code Here

  public void afterStep( TestCaseRunner testRunner, SecurityTestRunContext runContext, SecurityTestStepResult result )
  {
    if( !isPrintReport() )
      return;

    TestStep currentStep = runContext.getCurrentStep();

    String securityTestName = "";
    String securityScanName = "";
    if( !result.getSecurityScanResultList().isEmpty() )
    {
      securityTestName = result.getSecurityScanResultList().get( 0 ).getSecurityScan().getParent().getName();
      securityScanName = result.getSecurityScanResultList().get( 0 ).getSecurityScanName();
    }

    String countPropertyName = currentStep.getName() + " run count";
    Long count = new Long( getExportCount() );// ( Long
    // )runContext.getProperty(
    // countPropertyName );
    if( count == null )
    {
      count = new Long( 0 );
    }

    runContext.setProperty( countPropertyName, new Long( count.longValue() + 1 ) );

    if( result.getStatus() == SecurityResult.ResultStatus.FAILED || isExportAll() )
    {
      try
      {
        String exportSeparator = System.getProperty( SOAPUI_EXPORT_SEPARATOR, "-" );

        TestCase tc = currentStep.getTestCase();

        String nameBase = StringUtils.createFileName( securityTestName, '_' ) + exportSeparator
            + StringUtils.createFileName( securityScanName, '_' ) + exportSeparator
            + StringUtils.createFileName( tc.getTestSuite().getName(), '_' ) + exportSeparator
            + StringUtils.createFileName( tc.getName(), '_' ) + exportSeparator
            + StringUtils.createFileName( currentStep.getName(), '_' ) + "-" + count.longValue() + "-"
            + result.getStatus();

        WsdlTestCaseRunner callingTestCaseRunner = ( WsdlTestCaseRunner )runContext
            .getProperty( "#CallingTestCaseRunner#" );

        if( callingTestCaseRunner != null )
        {
          WsdlTestCase ctc = callingTestCaseRunner.getTestCase();
          WsdlRunTestCaseTestStep runTestCaseTestStep = ( WsdlRunTestCaseTestStep )runContext
              .getProperty( "#CallingRunTestCaseStep#" );

          nameBase = StringUtils.createFileName( securityTestName, '_' ) + exportSeparator
              + StringUtils.createFileName( ctc.getTestSuite().getName(), '_' ) + exportSeparator
              + StringUtils.createFileName( ctc.getName(), '_' ) + exportSeparator
              + StringUtils.createFileName( runTestCaseTestStep.getName(), '_' ) + exportSeparator
              + StringUtils.createFileName( tc.getTestSuite().getName(), '_' ) + exportSeparator
              + StringUtils.createFileName( tc.getName(), '_' ) + exportSeparator
              + StringUtils.createFileName( currentStep.getName(), '_' ) + "-" + count.longValue() + "-"
              + result.getStatus();
        }

        String absoluteOutputFolder = getAbsoluteOutputFolder( ModelSupport.getModelItemProject( tc ) );
        String fileName = absoluteOutputFolder + File.separator + nameBase + ".txt";

        if( result.getStatus() == SecurityResult.ResultStatus.FAILED )
          log.error( currentStep.getName() + " failed, exporting to [" + fileName + "]" );

        new File( fileName ).getParentFile().mkdirs();

        PrintWriter writer = new PrintWriter( fileName );
        result.writeTo( writer );
View Full Code Here

  public final void setPropertyValue( String testStep, String property, String value ) throws Exception
  {
    if( !( context instanceof TestCaseRunContext ) )
      return;

    TestStep step = ( ( TestCaseRunContext )context ).getTestCase().getTestStepByName( testStep );
    if( step != null )
    {
      step.setPropertyValue( property, value );
    }
    else
    {
      throw new Exception( "Missing TestStep [" + testStep + "] in TestCase" );
    }
View Full Code Here

    {
      super( new WsdlTestStepsModelItem( getTestCase() ) );

      for( int c = 0; c < getTestCase().getTestStepCount(); c++ )
      {
        TestStep testStep = getTestCase().getTestStepAt( c );
        testStepNodes.add( createTestStepTreeNode( testStep ) );
      }

      getTreeModel().mapModelItems( testStepNodes );
    }
View Full Code Here

          || ( propertyModelItem instanceof TestSuite && ( ( TestCase )contextModelItem ).getTestSuite() == propertyModelItem );
    }

    if( contextModelItem instanceof TestStep )
    {
      TestStep testStep = ( ( TestStep )contextModelItem );

      return propertyModelItem == contextModelItem
          || ( propertyModelItem instanceof TestSuite && testStep.getTestCase().getTestSuite() == propertyModelItem )
          || ( propertyModelItem instanceof TestCase && testStep.getTestCase() == propertyModelItem )
          || ( propertyModelItem instanceof TestStep && testStep.getTestCase() == ( ( TestStep )propertyModelItem )
              .getTestCase() );
    }

    if( contextModelItem instanceof MockService )
    {
      return propertyModelItem == contextModelItem;
    }

    if( contextModelItem instanceof MockOperation )
    {
      return propertyModelItem == contextModelItem
          || ( propertyModelItem instanceof MockService && ( ( MockOperation )contextModelItem ).getMockService() == propertyModelItem );
    }

    if( contextModelItem instanceof MockResponse )
    {
      MockResponse testStep = ( ( MockResponse )contextModelItem );

      return propertyModelItem == contextModelItem
          || ( propertyModelItem instanceof MockService && testStep.getMockOperation().getMockService() == propertyModelItem )
          || ( propertyModelItem instanceof MockOperation && testStep.getMockOperation() == propertyModelItem )
          || ( propertyModelItem instanceof MockResponse && testStep.getMockOperation() == ( ( MockResponse )propertyModelItem )
              .getMockOperation() );
    }

    if( contextModelItem instanceof SecurityTest )
    {
View Full Code Here

    {
      // property expansion support
      value = context.expand( value );

      PropertyMutation allAtOncePropertyMutation = new PropertyMutation();
      TestStep testStepCopy = null;
      XmlObjectTreeModel model = null;
      List<SecurityCheckedParameter> scpList = getParameterHolder().getParameterList();
      StringToStringMap stsmap = new StringToStringMap();
      for( SecurityCheckedParameter scp : scpList )
      {
View Full Code Here

            "Runs this assertion script against the last messageExchange with a mock testContext" );
      }

      public void actionPerformed( ActionEvent e )
      {
        TestStep testStep = getAssertable().getTestStep();
        MessageExchange exchange = null;

        if( testStep instanceof WsdlTestRequestStep )
        {
          WsdlTestRequestStep testRequestStep = ( WsdlTestRequestStep )testStep;
View Full Code Here

    Project project = securityScan.getTestStep().getTestCase().getTestSuite().getProject();
    TestSuite targetTestSuite = project.getTestSuiteByName( targetTestSuiteName );
    TestCase targetTestCase = targetTestSuite.getTestCaseByName( targetTestCaseName );
    SecurityTest targetSecurityTest = targetTestCase.getSecurityTestByName( targetSecurityTestName );
    TestStep targetTestStep = targetTestCase.getTestStepByName( targetSecurityTestStepName );

    boolean overwrite = dialog.getBooleanValue( CloneParameterDialog.OVERWRITE );

    for( String scanName : targetSecurityScans )
    {
      AbstractSecurityScanWithProperties targetSecurityScan = ( AbstractSecurityScanWithProperties )targetSecurityTest
          .getTestStepSecurityScanByName( targetTestStep.getId(), scanName );

      for( int i : indexes )
      {
        SecurityCheckedParameter scanParameter = securityScan.getParameterAt( i );
        String newParameterLabel = scanParameter.getLabel();
View Full Code Here

            }

            String securityTestName = dialog.getValue( CloneParameterDialog.TARGET_SECURITYTEST );
            SecurityTest securityTest = testCase.getSecurityTestByName( securityTestName );
            String testStepName = dialog.getValue( CloneParameterDialog.TARGET_TESTSTEP );
            TestStep testStep = testCase.getTestStepByName( testStepName );
            String[] securityScanNames = ModelSupport.getNames( securityTest.getTestStepSecurityScanByType(
                testStep.getId(), AbstractSecurityScanWithProperties.class ) );
            dialog.setOptions( CloneParameterDialog.TARGET_SECURITYSCAN, securityScanNames );
          }
          else
          {
            dialog.setOptions( CloneParameterDialog.TARGET_SECURITYTEST, new String[0] );
            dialog.setOptions( CloneParameterDialog.TARGET_TESTSTEP, new String[0] );
            dialog.setOptions( CloneParameterDialog.TARGET_SECURITYSCAN, new String[0] );
          }
        }
        else
        {
          dialog.setOptions( CloneParameterDialog.TARGET_SECURITYTEST, new String[0] );
          dialog.setOptions( CloneParameterDialog.TARGET_TESTSTEP, new String[0] );
        }
      }
    } );
    dialog.getFormField( CloneParameterDialog.TARGET_TESTCASE ).addFormFieldListener( new XFormFieldListener()
    {
      public void valueChanged( XFormField sourceField, String newValue, String oldValue )
      {
        String testSuiteName = dialog.getValue( CloneParameterDialog.TARGET_TESTSUITE );
        TestSuite testSuite = project.getTestSuiteByName( testSuiteName );
        TestCase testCase = testSuite.getTestCaseByName( newValue );

        String[] testStepNames = new String[0];
        String[] securityTestNames = ModelSupport.getNames( testCase.getSecurityTestList() );
        dialog.setOptions( CloneParameterDialog.TARGET_SECURITYTEST, securityTestNames );
        if( securityTestNames.length > 0 )
        {
          testStepNames = getSecurableTestStepsNames( testCase );
        }
        dialog.setOptions( CloneParameterDialog.TARGET_TESTSTEP, testStepNames );

        if( securityTestNames.length > 0 )
        {
          dialog.setValue( CloneParameterDialog.TARGET_SECURITYTEST, securityTestNames[0] );
          if( testStepNames.length > 0 )
          {
            dialog.setValue( CloneParameterDialog.TARGET_TESTSTEP, testStepNames[0] );
          }
          else
          {
            dialog.setOptions( CloneParameterDialog.TARGET_TESTSTEP, new String[0] );
          }

          String securityTestName = dialog.getValue( CloneParameterDialog.TARGET_SECURITYTEST );
          SecurityTest securityTest = testCase.getSecurityTestByName( securityTestName );
          String testStepName = dialog.getValue( CloneParameterDialog.TARGET_TESTSTEP );
          TestStep testStep = testCase.getTestStepByName( testStepName );
          String[] securityScanNames = ModelSupport.getNames( securityTest.getTestStepSecurityScanByType(
              testStep.getId(), AbstractSecurityScanWithProperties.class ) );
          dialog.setOptions( CloneParameterDialog.TARGET_SECURITYSCAN, securityScanNames );
        }
        else
        {
          dialog.setOptions( CloneParameterDialog.TARGET_SECURITYTEST, new String[0] );
          dialog.setOptions( CloneParameterDialog.TARGET_TESTSTEP, new String[0] );
          dialog.setOptions( CloneParameterDialog.TARGET_SECURITYSCAN, new String[0] );
        }
      }
    } );
    dialog.getFormField( CloneParameterDialog.TARGET_TESTSTEP ).addFormFieldListener( new XFormFieldListener()
    {
      public void valueChanged( XFormField sourceField, String newValue, String oldValue )
      {
        String testSuiteName = dialog.getValue( CloneParameterDialog.TARGET_TESTSUITE );
        TestSuite testSuite = project.getTestSuiteByName( testSuiteName );
        String testCaseName = dialog.getValue( CloneParameterDialog.TARGET_TESTCASE );
        TestCase testCase = testSuite.getTestCaseByName( testCaseName );
        String securityTestName = dialog.getValue( CloneParameterDialog.TARGET_SECURITYTEST );
        SecurityTest securityTest = testCase.getSecurityTestByName( securityTestName );
        TestStep testStep = testCase.getTestStepByName( newValue );

        String[] securityScanNames = ModelSupport.getNames( securityTest.getTestStepSecurityScanByType(
            testStep.getId(), AbstractSecurityScanWithProperties.class ) );
        dialog.setOptions( CloneParameterDialog.TARGET_SECURITYSCAN, securityScanNames );
      }
    } );
    dialog.getFormField( CloneParameterDialog.TARGET_SECURITYTEST ).addFormFieldListener( new XFormFieldListener()
    {
      public void valueChanged( XFormField sourceField, String newValue, String oldValue )
      {
        String testSuiteName = dialog.getValue( CloneParameterDialog.TARGET_TESTSUITE );
        TestSuite testSuite = project.getTestSuiteByName( testSuiteName );
        String testCaseName = dialog.getValue( CloneParameterDialog.TARGET_TESTCASE );
        TestCase testCase = testSuite.getTestCaseByName( testCaseName );
        SecurityTest securityTest = testCase.getSecurityTestByName( newValue );
        String testStepName = dialog.getValue( CloneParameterDialog.TARGET_TESTSTEP );
        TestStep testStep = testCase.getTestStepByName( testStepName );

        String[] securityScanNames = ModelSupport.getNames( securityTest.getTestStepSecurityScanByType(
            testStep.getId(), AbstractSecurityScanWithProperties.class ) );
        dialog.setOptions( CloneParameterDialog.TARGET_SECURITYSCAN, securityScanNames );
      }
    } );

    WsdlTestCase wsdlTestCase = ( WsdlTestCase )securityScan.getTestStep().getTestCase();

    dialog.setOptions( CloneParameterDialog.TARGET_TESTSUITE,
        ModelSupport.getNames( wsdlTestCase.getTestSuite().getProject().getTestSuiteList() ) );
    dialog.setValue( CloneParameterDialog.TARGET_TESTSUITE, wsdlTestCase.getTestSuite().getName() );

    List<TestCase> wsdlTestCaseList = wsdlTestCase.getTestSuite().getTestCaseList();
    dialog.setOptions( CloneParameterDialog.TARGET_TESTCASE, ModelSupport.getNames( wsdlTestCaseList ) );
    dialog.setValue( CloneParameterDialog.TARGET_TESTCASE, wsdlTestCase.getName() );

    dialog.setOptions( CloneParameterDialog.TARGET_TESTSTEP, getSecurableTestStepsNames( wsdlTestCase ) );
    dialog.setOptions( CloneParameterDialog.TARGET_SECURITYTEST,
        ModelSupport.getNames( wsdlTestCase.getSecurityTestList() ) );

    String securityTestName = dialog.getValue( CloneParameterDialog.TARGET_SECURITYTEST );
    SecurityTest securityTest = wsdlTestCase.getSecurityTestByName( securityTestName );
    String testStepName = dialog.getValue( CloneParameterDialog.TARGET_TESTSTEP );
    TestStep testStep = wsdlTestCase.getTestStepByName( testStepName );

    String[] securityScanNames = ModelSupport.getNames( securityTest.getTestStepSecurityScanByType( testStep.getId(),
        AbstractSecurityScanWithProperties.class ) );
    dialog.setOptions( CloneParameterDialog.TARGET_SECURITYSCAN, securityScanNames );

    dialog.setOptions( CloneParameterDialog.PARAMETERS, securityScan.getParameterHolder().getParameterLabels() );
View Full Code Here

TOP

Related Classes of com.eviware.soapui.model.testsuite.TestStep

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.