Search code examples
qtphp-uft

Adjusting JMS settings for HP Service Test from cmdline


We're using HP Service Test 11.50 to run unittests on a Jenkins Buildserver. We'd like to run parallel builds, which means that we must be able to specify a port before executing these tests. This way we can ensure that all tests are isolated from eachother. By executing a couple of queries on the test.db we've been able to change the testSettings, but these changes aren't picked up. Only after (re)compiling the test within the HP Service Test GUI the changes are recognized and used.

Is there a way to do this compilation from commandline? Or is there another way to make this possible? And what does "compile" actually do? Which files are touched?

The wrong answer is to use input variables, because these are not yet evaluated when creating these JMS connections.

Thanks,

Robert


Solution

  • The solution requires .NET SDK 4.0 installed on your machine, in this case version 4.0.30319

    The test contains a Main.cs, which has a method called InitJMSEnv() which looks something like this:

    public static void InitJMSEnv()
    {
        if(!JmsInitialized)
        {
            JMSGlobalProperties props = new JMSGlobalProperties
            {
                connections_per_process = @"1",
                msg_timeout = @"1",
                user_defined_timeout = @"20",
                jndi_provider_url = @"",
                jndi_initial_context_factory = @"com.tibco.tibjms.naming.TibjmsInitialContextFactory",
                jms_connection_factory = @"",
                jms_security_principal = @"",
                jms_security_credentials = @"",
                set_corba_orb = @"",
                auto_generate_selector = @"0",
                enable_TIBCO_SSL_JNDI_lookup = @""
            };
            JMSTransportWrapper.InitJMSProperties(props);
            JmsInitialized = true;
        }
    }
    

    With regular expressions you can fill/adjust the required fields, such as jms_security_principal and jms_security_credentials.

    Now you can rebuild the project like:

    C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319>msbuild C:\path\to\MyTest.csproj /t:rebuild

    The result: a test which is prepared for this environment and ready to be executed.