Forum Discussion

Kevin_Slade's avatar
Kevin_Slade
Contributor
15 years ago

How do I over-ride Definition Url when using testrunner

I have a large test suite that has been developed against  one server but when I attempt to use testrunner run the test suite against a second server when the first server is no longer available, I am getting errors since testrunner is attempting to access to original server.

Using the GUI this does not appear to occur and no problems are seen.

How can I force testrunner to use the target server as the source for the Definition URL.

This is going to occur a lot in my environment, as we have several servers that can be running quite different software at any time and the Soap server does not exist on some software systems and even when it does, the Soap versions can be very different.

The  original server was ninjabox27 and it has very different software loaded now that does not have the Soap Server interface. Despite this the testrunner reports loading successfully.

Progress: 1 - Loading Definition from cache                                                                                                     
13:24:29,993 DEBUG [AbstractDefinitionContext] Loading Definition...                                                                             
13:24:30,009 DEBUG [AbstractWsdlDefinitionLoader] Returning baseInputSource [https://ninjabox27/services/fwif?wsdl]                             
Retrieving document at 'https://ninjabox27/services/fwif?wsdl'.                                                                                 
Retrieving schema at 'ninjaprobe.xsd', relative to 'https://ninjabox27/services/fwif?wsdl'.                                                     
13:24:30,080 DEBUG [AbstractWsdlDefinitionLoader] Returning latest import URI [https://ninjabox27/services/ninjaprobe.xsd]                       
13:24:30,123 DEBUG [WsdlInterfaceDefinition] Loaded WSDL: ok                                                                                     

....
13:24:30,178 INFO  [SchemaUtils] Loading schema types from [https://ninjabox27/services/fwif?wsdl] 
13:24:30,178 INFO  [SchemaUtils] Getting schema https://ninjabox27/services/fwif?wsdl 
13:24:30,187 INFO  [SchemaUtils] Getting schema https://ninjabox27/services/ninjaprobe.xsd
13:24:30,420 DEBUG [AbstractDefinitionContext] Loaded Definition: ok

Many of the test assertions fail.


After I reloaded the definitions manually from the new test system appqa04 and then saved the project file, the testrunner console output is:

Progress: 1 - Loading Definition from cache 
13:33:21,665 DEBUG [AbstractDefinitionContext] Loading Definition... 
13:33:21,682 DEBUG [AbstractWsdlDefinitionLoader] Returning baseInputSource [https://appqa04/services/fwif?wsdl] 
Retrieving document at 'https://appqa04/services/fwif?wsdl'.
Retrieving schema at 'ninjaprobe.xsd', relative to 'https://appqa04/services/fwif?wsdl'. 
13:33:21,791 DEBUG [AbstractWsdlDefinitionLoader] Returning latest import URI [https://appqa04/services/ninjaprobe.xsd] 
13:33:21,832 DEBUG [WsdlInterfaceDefinition] Loaded WSDL: ok

......................

13:33:21,978 INFO  [SchemaUtils] Loading schema types from [https://appqa04/services/fwif?wsdl]
13:33:21,978 INFO  [SchemaUtils] Getting schema https://appqa04/services/fwif?wsdl
13:33:21,985 INFO  [SchemaUtils] Getting schema https://appqa04/services/ninjaprobe.xsd
13:33:22,206 DEBUG [AbstractDefinitionContext] Loaded Definition: ok

and now the test assertions succeed.

6 Replies

  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    You need to create a project-level property where you can specify the host and use it in the schemacompliance assertion config.
    You can then override it with the -P option when running from the commandline

    /Nenad
    http://eviware.com
  • Hello Nenad

    I have created a project property called TargetSystem with a value of https://appqa04/services/fwif?wsdl

    I then create the schemacompliance assertion on a test with an assertion value of ${#Project#TargetSystem} which is the same way I access other Project variables.

    The assertion is failing with the following errors:
    ->line 6: Invalid QName value: Localname not a valid NCName in ''
    -> line 6: Element not allowes: Subcode in element faultcode

    I am using a nightly build from the 27th Aug of 3.0.1

    Some more information.

    I changed the property value to "https://appqa04" and the assertion value to "${#Project#TargetSystem}/services/fwif?wsdl" after looking at one of Ole's replies.

    The particular assertion works when the call returns a valid response. however the above error is generated when an error response is returned. Does this imply that the error response is not valid according to the WSDL?

    The fault return is:

     

     
         
           
               
                  wsse:FailedAuthentication
               

                soapenv:Sender
           

            UsernameToken validation failed.
           
                wsse:UsernameToken
           

         

     


    Thanks Kevin
  • After looking at the problem and the above solution carefully, this is not actually addressing my original problem. That is that I simply wish to force the WSDL definition to either use the cached value or to reload it from the specified target, not the original target that was used to create the test suite, or last used to update the WSDL definitions.

    Make no mistake, the above discussion has been very useful as it has exposed another bug in the WSDL definition, where every response should have the option of returning a fault message as well as a valid response.

    A second downside of using this assertion in each test step is that it also causes the axis2c server to crash when the WDL is reloaded for each test step.

    This also has a maked impact on the performance of each teststep regardless of whether the server was crashing, due to the extra data to be retrieved from the server to support this test assertion.

    Regards Kevin
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    As long as the WSDL URL doesn't change, the Schema compliance assertion should not download the WSDL more than once, it should be cached for the remainder of the execution (until the program exits). If it is doing this that seems like a bug to me. Could you perhaps attach or send us your project file so we can take a closer look?

    Regards,
    Dain
    eviware.com
  • SmartBear_Suppo's avatar
    SmartBear_Suppo
    SmartBear Alumni (Retired)
    Hi,

    I managed to reproduce this and spot the bug that was causing it. I have (hopefully) fixed this bug, so if you download the next nightly build it should work without re-downloading the WSDL and XSD each time the assertion is run. Please let me know if the problem persists!

    Regards,
    Dain
    eviware.com