Service Virtualization

Expand all | Collapse all

how to run a test step with java script

Jump to Best Answer
  • 1.  how to run a test step with java script

    Posted 09-06-2017 04:18 AM

    I am trying to run test step using java script and not able to get right code,can anyone help here



  • 2.  Re:  how to run a test step with java script

    Posted 09-06-2017 06:14 AM

    You need code to achieve what exactly?



  • 3.  Re:  how to run a test step with java script

    Posted 09-06-2017 06:46 AM

    looking for sample code to run test step from scripted assertion or Execute Script(JSR-223) test step.



  • 4.  Re:  how to run a test step with java script

    Posted 09-06-2017 01:26 PM

    Vishnu,

     

    The step can run with a simple line such as:

     

    return true;

     

    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?



  • 5.  Re:  how to run a test step with java script

    Posted 09-06-2017 09:37 AM

    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.  

     

    Thanks

     

    Shiney 



  • 6.  Re:  how to run a test step with java script

    Posted 09-07-2017 04:54 AM

    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"))

     

    Thanks

    Jaya



  • 7.  Re:  how to run a test step with java script

    Posted 09-07-2017 12:57 PM

    Vishnu,

     

    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.



  • 8.  Re:  how to run a test step with java script

    Posted 09-07-2017 02:33 PM

    Hello Jayavardhana,

     

    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.

    Heloisa



  • 9.  Re:  how to run a test step with java script

    Posted 09-08-2017 02:36 AM

    Hi,

     

    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

     

    Thanks

    Jaya



  • 10.  Re:  how to run a test step with java script

    Posted 09-07-2017 04:56 AM

    I didn't see any command to run a test step in scripting.tst,if i am missing please share it here



  • 11.  Re:  how to run a test step with java script
    Best Answer

    Posted 09-22-2017 03:26 AM

    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".

     

    Scripting Step Execution



  • 12.  Re:  how to run a test step with java script

    Posted 09-14-2018 07:57 AM

    It says anserwed where is the answer?