cancel
Showing results for 
Search instead for 
Did you mean: 

Add or Build HTTP Request TestStep to Test Case through Groovy Script

Highlighted
Occasional Contributor

Add or Build HTTP Request TestStep to Test Case through Groovy Script

Hello,

 

I would like to create a new Test Step to an existing Test Case, I would like this to be an HTTP Request type.

 

I've seen and completed examples of creating Groovy Test Steps to an existing Test Case, see below:

 

def project = context.testCase.testSuite.project;
def testSuite = project.getTestSuiteByName("Library");
def testCase = testSuite.getTestCaseByName("Modified Transactions");


def newStep = testCase.addTestStep("groovy", "HelloGroovy").setScript("log.info 'Hello'");

However, I would like to add an HTTP Request type and complete the necessary properties, endpoints and request, etc...

 

It looks like this post is discussing somewhat what I want to do, how can I find the definition of all the step types, it only has EMAIL?

 

Any help is most welcome.

Tags (3)
2 REPLIES 2
Highlighted
Community Hero

Re: Add or Build HTTP Request TestStep to Test Case through Groovy Script

What is your use case? Why do you want to do so while it is easy to add the step in UI?


Regards,
Rao.
Highlighted
Occasional Contributor

Re: Add or Build HTTP Request TestStep to Test Case through Groovy Script

Hello @nmrao,

 

Normally I would, in this case though we are pulling in a undetermined set of records from a Data Source and changes with each cycle.  So, it seems to me in this case it would be a better solution to dynamically generate the request steps based on the return from the datasource for these test cases.


Thanks

New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Compete with community members in the TechCorner Challenge and get into the Leaderboard!

Rank Participant Points Earned
1 msiadak 12
2 nmrao 8
3 HimanshuTayal 3
Top Kudoed Authors