I am trying to run test step using java script and not able to get right code,can anyone help here
You need code to achieve what exactly?
looking for sample code to run test step from scripted assertion or Execute Script(JSR-223) test step.
The step can run with a simple line such as:
The above one liner will run successfully, but it really doesn't do anything interesting. Are there examples of something in particular that you want to see? The "scripting" step is very flexible and can do an endless number of things. What is the problem/challenge you are trying to solve?
In our example project ( DevTestHome/examples) look at the scripting.tst testcase. That has samples on Java script code and bean shell code.. Hope this helps.
i have done some scripting in DevTest but what i am looking is -how to a run test step from another test step.
Only approach that i can see is scripting,but i don't know exact command to run a test step in DevTest(for ex: in Soap Ui we can write groovy script to run a test step-runTestStepByname("scripting"))
Can you explain the need for running a step within another step? If we can better understand your use case we may be able to offer a better approach for what you are trying to accomplish. At this point I'm not sure running a test step from a script sounds like the right solution because you will need to think about how to capture the test results, exceptions, etc. from within the script and this can become quite complex to maintain. Perhaps another approach would be to use execute the step from a sub process step, or maybe another solution that is better supported out of the box than scripting. We'll be able to make a better recommendation after we understand the full scope of your use case.
To add to Willam's response, I am posting the links to Subprocess documentation:
Execute Subprocess - DevTest Solutions - 10.1 - CA Technologies Documentation
Building Subprocesses - DevTest Solutions - 10.1 - CA Technologies Documentation
A subprocess is a test case that is called from another test case instead of run as a stand-alone test case.
The 'Execute Subprocess' step lets you call a subprocess test case as a single step.
This step is used to call a subprocess and receive the outputs. This step is commonly used when a specific function is performed in numerous test cases.
Hope it helps.
i have ten test steps in my test case based on asseration i am calling subprocess on each step,from subprocess again i am continuing to the next step.
Now i have subprocess for every test step like step1->assertion:true->subprocess1->step2->assertion:true->subprocess2->step3.............................. and all subprocess are having same test case
what i am looking is step1->asseration:true;Scripted asseration to run testcase->step2->asseration:true;Scripted asseration to run testcase.............................
having multiple subprocess making my script complex and more duplicates
I didn't see any command to run a test step in scripting.tst,if i am missing please share it here
JSR-223 (Scripting) step purpose is to give the user the flexibility to write custom scripts using any of the supported scripting language. In the workstation you can double click to open this step. At the bottom of the script editor is a Test button which can be used to both validate and execute this step. Remember though if you were executing this step by itself and if you have any unresolved references in your script then those needs to be set prior to the execution. In that situation you may want to choose the option "Replay through here".
It says anserwed where is the answer?