Run two test in different files

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Run two test in different files

antonela destito
Hi!
I've run this RunAll function with the idea of running two tests that are in separate files (SampleJavaIT and SampleJavaIT2) and with two profile context (xmlJobFeed and empi9).

@ActiveProfiles(value = "xmlJobFeed")
@Test
public class RunAll extends TestNGCitrusTestDesigner {
    @CitrusTest
    @Parameters("context")
    public void SampleJavaITR(@Optional @CitrusResource com.consol.citrus.context.TestContext context) throws InterruptedException  {
        SampleJavaIT s = new SampleJavaIT();
        s.xmlJobFeedPmi_test(context);
    }
}

This test works with variable context, but not with autowired variables (they are null)
I show you a piece of my files (context and SampleJavaIT):

citrus-context.xml

<beans
       [...]>
  <beans profile="xmlJobFeed">
       
        <citrus:namespace-context>
            <citrus:namespace prefix="xmlJobFeed"/>
        </citrus:namespace-context>
        <context:property-placeholder location="classpath:citrus.properties"/>

      <citrus-docker:client id="dockerClient2"
                              url="<a href="<a href="http://localhost:2375&amp;quot;&quot;">http://localhost:2375&quot;">http://localhost:2375"
                              version="1.12"
                              username=""
                              password=""
                              email=""
                              cert-path=""
                              server-address="https://index.docker.io/v1/"
                              config-path="/var/integrations/integrations-cell-configs/localhost/xmljobfeed/"/>

    </beans>
</beans>

@ActiveProfiles(value = "xmlJobFeed")
@Test
public class SampleJavaIT extends TestNGCitrusTestDesigner {
    @Autowired
    HttpServer todoListServer2;
    @Autowired
    DockerClient dockerClient2; ----> this is set as null
[....]
   @CitrusTest
    @Parameters("context")
    public void xmlJobFeedPmi_test(@Optional @CitrusResource TestContext context) throws InterruptedException {
        imageName = context.getVariable("imageName"); ----> this are in correct value
        backupPath = context.getVariable("backupPath");
[....]
}



Thanks in advanced.