Forum Discussion
Lucian
8 years agoCommunity Hero
I have the following code:
if ( it.getClass() == com.eviware.soapui.impl.wsdl.teststeps.HttpTestRequestStep ) {
reportFile.text = '''<!DOCTYPE html><html><head><style>html,body{margin:0;padding:0;}html{height:100%;}body{height:98%;}h1{font-size:20px;}h2{font-size:16px;}.column{float:left;border:solid gray 1px;height:90%;margin-left:4px;padding:5px;}.assertion_container{margin:4px;background-color:white;border:solid gray 1px;width:95%;padding:4px;}.assertion_details{margin-left:60px;}#content_wrapper{width:100%;height:60%;}#request{background-color:#F0F0F0;width:48%;height:100%;overflow:auto;}#response{background-color:#F0F0F0;width:48%;height:100%;overflow:auto;}#assertions_wrapper_container{background-color:#F0F0F0;float:left;margin-top:4px;margin-left:4px;padding:5px;border:solid gray 1px;height:30%;width:97%;overflow:scroll;}</style></head><body>
<h1>''' + it.getName() + '''</h1><div id="content_wrapper"><div id="request" class="column"><div id="request_title"><h2>Request</h2></div><div id="request_content"><pre>''' +
new String(it.getTestStep().testRequest.messageExchange.rawRequestData) + '''</pre></div></div><div id="response" class="column"><div id="response_title"><h2>Response</h2></div><div id="response_content"><pre>''' +
new String(it.getTestStep().testRequest.messageExchange.rawResponseData) + '''</pre></div></div></div><div id="assertions_wrapper_container"><div id="assertions_title"><h2>Assertions</h2></div>'''
if ( it.getAssertionList().size() == 0 ) {
reportFile << '''<div><i>There are no assertions in this test step<i></div>'''
}
else {
it.getAssertionList().each() {
reportFile << '''<div class="assertion_container"><div class="assertion_name"'''
if ( it.getStatus().toString() == "PASS" ) {
reportFile << ''' style="color:green"'''
} else if ( it.getStatus().toString() == "FAIL" ) {
reportFile << ''' style="color:red"'''
}
reportFile << '''><b>''' + it.getStatus() + '''</b> - ''' + it.getName() + '''</div>'''
if (it.getErrors())
reportFile << '''<div class="assertion_details"><t/><i>''' + it.getErrors()[0].getMessage() + '''</i></div>'''
reportFile << '''</div>'''
}
}
reportFile << '''</div></body></html>'''
} else if ( it.getClass() == com.eviware.soapui.impl.wsdl.teststeps.DebuggableWsdlGroovyScriptTestStep ) {
reportFile.text = '''<!DOCTYPE html><html><head><style>html,body{margin:0;padding:0;}html{height:100%;}body{height:98%;}h1{font-size:20px;}h2{font-size:16px;}#script{background-color:#F0F0F0;width:97%;height:60%;overflow:scroll;border:solid gray 1px;padding:4px}#log_container{margin-top:4px;background-color:#F0F0F0;border:solid gray 1px;width:97%;height:30%;padding:4px;}</style></head><body><h1>TestStep2 from TestCaseA from TestSuiteA</h1><div id="script">''' +
'''<h2>Script content</h2><pre>''' + it.scriptText + '''</pre></div><div id="log_container"><h2>Script log</h2>The script log is not yet available @TODO</div></body></html>'''
}
I am iterating through each step. If the step is of type HTTP step then the report is already done. I am trying now to do the same for Soap steps.
Olga_T
Alumni
8 years agoCommunity, any ideas on how to modify this code so that it could work for Soap steps?