Package com.eviware.soapui.model.testsuite

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


    }

    @Override
    protected String internalAssertResponse(MessageExchange messageExchange, SubmitContext context)
            throws AssertionException {
        TestStep testStep = (TestStep) context.getProperty(CrossSiteScriptingScan.TEST_STEP);
        testStep = SecurityTestRunnerImpl.cloneTestStepForSecurityScan((WsdlTestStep) testStep);
        SecurityTestRunner securityTestRunner = (SecurityTestRunner) context
                .getProperty(CrossSiteScriptingScan.TEST_CASE_RUNNER);

        List<String> urls = submitScript(messageExchange, context);
View Full Code Here


            ((WsdlRunTestCaseTestStep) currentStep).addTestRunListener(this);
        }
    }

    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

        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();
                if (securityScan.getParameterByLabel(scanParameter.getLabel()) != null) {
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

    }

    @Override
    public void afterStep(TestCaseRunner testRunner, TestCaseRunContext runContext, TestStepResult result) {
        super.afterStep(testRunner, runContext, result);
        TestStep currentStep = runContext.getCurrentStep();

        if (currentStep instanceof Assertable) {
            Assertable requestStep = (Assertable) currentStep;
            for (int c = 0; c < requestStep.getAssertionCount(); c++) {
                TestAssertion assertion = requestStep.getAssertionAt(c);
                log.info("Assertion [" + assertion.getName() + "] has status " + assertion.getStatus());
                if (assertion.getStatus() == AssertionStatus.FAILED) {
                    for (AssertionError error : assertion.getErrors()) {
                        log.error("ASSERTION FAILED -> " + error.getMessage());
                    }

                    assertions.add(assertion);
                    assertionResults.put(assertion, (WsdlTestStepResult) result);
                }

                testAssertionCount++;
            }
        }

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

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

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

                TestCase tc = currentStep.getTestCase();
                String nameBase = 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(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() == TestStepStatus.FAILED) {
                    log.error(currentStep.getName() + " failed, exporting to [" + fileName + "]");
                }

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

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

        if( context instanceof WsdlTestRunContext)
        {
            TestRunner runner = ((WsdlTestRunContext) context).getTestRunner();
            if( runner instanceof AbstractTestCaseRunner) {
                List<TestStepResult> resultList = ((AbstractTestCaseRunner) runner).getResults();
                TestStep currentStep = ((WsdlTestRunContext) context).getCurrentStep();

                int ix = 0;
                for( TestStepResult result : resultList )
                    if( result.getTestStep().getId().equals( currentStep.getId()))
                        ix++;

                return String.valueOf( ix );
            }
        }
View Full Code Here

    }

    private String getScopedProperty(PropertyExpansionContext context, String pe, boolean globalOverride) {
        ModelItem modelItem = context.getModelItem();

        TestStep testStep = null;
        TestCase testCase = null;
        TestSuite testSuite = null;
        Project project = null;
        MockService mockService = null;
        AbstractMockResponse mockResponse = null;
        SecurityTest securityTest = null;

        if (modelItem instanceof WsdlTestStep) {
            testStep = (WsdlTestStep) modelItem;
            testCase = testStep.getTestCase();
            testSuite = testCase.getTestSuite();
            project = testSuite.getProject();
        } else if (modelItem instanceof WsdlTestCase) {
            testCase = (WsdlTestCase) modelItem;
            testSuite = testCase.getTestSuite();
            project = testSuite.getProject();
        } else if (modelItem instanceof WsdlLoadTest) {
            testCase = ((WsdlLoadTest) modelItem).getTestCase();
            testSuite = testCase.getTestSuite();
            project = testSuite.getProject();
        } else if (modelItem instanceof WsdlTestSuite) {
            testSuite = (WsdlTestSuite) modelItem;
            project = testSuite.getProject();
        } else if (modelItem instanceof WsdlInterface) {
            project = ((WsdlInterface) modelItem).getProject();
        } else if (modelItem instanceof WsdlProject) {
            project = (WsdlProject) modelItem;
        } else if (modelItem instanceof WsdlMockService) {
            mockService = (WsdlMockService) modelItem;
            project = mockService.getProject();
        } else if (modelItem instanceof TestRequest) {
            testStep = ((TestRequest) modelItem).getTestStep();
            testCase = testStep.getTestCase();
            testSuite = testCase.getTestSuite();
            project = testSuite.getProject();
        } else if (modelItem instanceof AbstractHttpRequestInterface<?>) {
            project = ((AbstractHttpRequest<?>) modelItem).getOperation().getInterface().getProject();
        } else if (modelItem instanceof RestResource) {
View Full Code Here

        for (String value : cssConfig.getParameterExposureStringsList()) {
            // 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

    public XPathReference[] getXPathReferences() {
        List<XPathReference> result = new ArrayList<XPathReference>();

        for (SecurityCheckedParameter param : getParameterHolder().getParameterList()) {
            TestStep t = getTestStep();
            if (t instanceof WsdlTestRequestStep) {
                if (param != null) {
                    result.add(new XPathReferenceImpl("SecurityScan Parameter " + param.getLabel() + " in \""
                            + getTestStep().getName() + "\"", ((WsdlTestRequestStep) t).getOperation(), true, param,
                            "xpath"));
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 + "]");
                }

                File file = new File(fileName);
                file.getParentFile().mkdirs();
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.