Submit and vote on feature ideas.

Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

How can I store a variable in a data source using groovy

Options
Raxyok
Raxyok Posts: 1

I'm trying to store a Header in a Data Sorce using groovy but I'm not able to do it.
I'm using:

import parasoft.com.*;

String grabHeaderValue (input, context)
{
String headers = input.toString();
int dateIndex = headers.indexOf("Date:");
int endIndex = headers.indexOf('\n', dateIndex);
String desiredHeader = headers.substring(dateIndex, endIndex);
context.setValue("Date",desiredHeader);
return desiredHeader;

}

Tagged:

Answers

  • benken_parasoft
    benken_parasoft Posts: 1,232 ✭✭✭
    edited December 2017
    Options

    This question has come up a few times recently. You can see my earlier responses here and here.

Tagged