Forum Discussion
Mason
15 years agoFrequent Contributor
This doesn't work either. The property does not get expanded (the string ${#TestSuite#subscriber.NTT} is inserted into the header. The reason for this, we suspect, is because a TestSuite variable will not work in the Event handler area of SoapUI since the scope is at the context level (the TestSuite script hasn't run yet, it runs after the script in the Event handler area). We used the following code to populate the header:
def subscriber_c = context.getProperty("subscriber.c");
log.info ("subscriber_c = " + subscriber_c);
def c_id_header = context.getProperty("postMethod")
c_id_header.setRequestHeader("c_id", subscriber_c);
We populate the property of subscriber.c in the setup script of the project so that it is available to the context scope.
This has caused a problem however, because we need to be able to modify headers at the TestSuite and/or TestCase level as well. Having the headers populated at the Project level does not allow us to send two requests with different values for the headers. For instance if we wanted to send one request with a c_id header with a value of "123" and in the same project, later in the test sequence, send a request with a c_id header and a value of "321".
Is there any way to dynamically insert headers at the TestSuite and/or TestCase level?
def subscriber_c = context.getProperty("subscriber.c");
log.info ("subscriber_c = " + subscriber_c);
def c_id_header = context.getProperty("postMethod")
c_id_header.setRequestHeader("c_id", subscriber_c);
We populate the property of subscriber.c in the setup script of the project so that it is available to the context scope.
This has caused a problem however, because we need to be able to modify headers at the TestSuite and/or TestCase level as well. Having the headers populated at the Project level does not allow us to send two requests with different values for the headers. For instance if we wanted to send one request with a c_id header with a value of "123" and in the same project, later in the test sequence, send a request with a c_id header and a value of "321".
Is there any way to dynamically insert headers at the TestSuite and/or TestCase level?
Related Content
- 5 years agoComputingFroggy
- 13 years agogordillo_ramon
Recent Discussions
- 3 days agogroovyguy