skillsoft
16 years agoFrequent Contributor
runTestStepByName not updating excel if Datasink disabled
Hi,
If the datasink step is disabled, the properties that you set are being set, but the datasink is not running if using runTestStepByname. By running I mean, the excel spreadsheet is not updated. It is updated if I then run the datasink manually. It looks like other's have had the same issue (see link below).
viewtopic.php?f=5&t=4362&p=14647&hilit=datasink+groovy#p14647
I am running the datasink inside a datasource loop. If a value in a certain field of the datasource is blank, I run a testcase through groovy which generates a subid and inserts that subid into the datasink property. Then it should run the datasink. As other's have had the same issue following your instructions to disable the datasink step, it looks like it's probably a bug. If that's the case, when will this be addressed? If not, what am I doing wrong? I'm running 3.6 (released version). Code is below:
if(testRunner.testCase.testSteps["companies"].getPropertyValue("BooksSubscriptionID")=="")
{
testRunner.testCase.testSuite.getTestCaseByName("Generate SubID").setPropertyValue("BooksGroupCode",testRunner.testCase.testSteps["companies"].getPropertyValue("BooksGroupCode"))
testRunner.testCase.testSuite.getTestCaseByName("Generate SubID").run(properties, false )
def strBooksSubID=testRunner.testCase.testSuite.getTestCaseByName("Generate SubID").getPropertyValue("BooksSubscriptionID")
def holder = groovyUtils.getXmlHolder("editBooks24x7 RequestSub#Request" );
holder.setNodeValue( "//subscriptionId/value", strBooksSubID);
holder.updateProperty(true);
def holder2 = groovyUtils.getXmlHolder("importBooksSubscription Request#Request" );
holder2.setNodeValue( "//booksSubscriptionID", strBooksSubID);
holder2.updateProperty(true);
testRunner.testCase.testSteps["update sub id in spreadsheet"].setPropertyValue("BooksSubscriptionID",strBooksSubID)
testRunner.runTestStepByName("update sub id in spreadsheet")
}
else
{
def holder = groovyUtils.getXmlHolder("editBooks24x7 RequestSub#Request" );
holder.setNodeValue( "//subscriptionId/value", '${companies#BooksSubscriptionID}');
holder.updateProperty(true);
def holder2 = groovyUtils.getXmlHolder("importBooksSubscription Request#Request" );
holder2.setNodeValue( "//booksSubscriptionID", '${companies#BooksSubscriptionID}');
holder2.updateProperty(true);
}
Thanks,
Mary
If the datasink step is disabled, the properties that you set are being set, but the datasink is not running if using runTestStepByname. By running I mean, the excel spreadsheet is not updated. It is updated if I then run the datasink manually. It looks like other's have had the same issue (see link below).
viewtopic.php?f=5&t=4362&p=14647&hilit=datasink+groovy#p14647
I am running the datasink inside a datasource loop. If a value in a certain field of the datasource is blank, I run a testcase through groovy which generates a subid and inserts that subid into the datasink property. Then it should run the datasink. As other's have had the same issue following your instructions to disable the datasink step, it looks like it's probably a bug. If that's the case, when will this be addressed? If not, what am I doing wrong? I'm running 3.6 (released version). Code is below:
if(testRunner.testCase.testSteps["companies"].getPropertyValue("BooksSubscriptionID")=="")
{
testRunner.testCase.testSuite.getTestCaseByName("Generate SubID").setPropertyValue("BooksGroupCode",testRunner.testCase.testSteps["companies"].getPropertyValue("BooksGroupCode"))
testRunner.testCase.testSuite.getTestCaseByName("Generate SubID").run(properties, false )
def strBooksSubID=testRunner.testCase.testSuite.getTestCaseByName("Generate SubID").getPropertyValue("BooksSubscriptionID")
def holder = groovyUtils.getXmlHolder("editBooks24x7 RequestSub#Request" );
holder.setNodeValue( "//subscriptionId/value", strBooksSubID);
holder.updateProperty(true);
def holder2 = groovyUtils.getXmlHolder("importBooksSubscription Request#Request" );
holder2.setNodeValue( "//booksSubscriptionID", strBooksSubID);
holder2.updateProperty(true);
testRunner.testCase.testSteps["update sub id in spreadsheet"].setPropertyValue("BooksSubscriptionID",strBooksSubID)
testRunner.runTestStepByName("update sub id in spreadsheet")
}
else
{
def holder = groovyUtils.getXmlHolder("editBooks24x7 RequestSub#Request" );
holder.setNodeValue( "//subscriptionId/value", '${companies#BooksSubscriptionID}');
holder.updateProperty(true);
def holder2 = groovyUtils.getXmlHolder("importBooksSubscription Request#Request" );
holder2.setNodeValue( "//booksSubscriptionID", '${companies#BooksSubscriptionID}');
holder2.updateProperty(true);
}
Thanks,
Mary