how to start java program from citrus?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

how to start java program from citrus?

Laura
Hello,

we want to start our java application (the system under test) after executing the sequence-before-suite. And stop the application before the sequence-after-suite.
Is there an easy way to do so?
We found the chapter 12.5 Java in the documentation, but we are not sure how to implement this in the citrus-context.xml . We get the error message "invalid content was found starting with element 'java' ".

We also searched a solution with a simple command line execute ' java ...jar', but we can't find any command line executer.

Thank you very much for your effort in advance.

Best Regards,
Laura
Reply | Threaded
Open this post in threaded view
|

Re: how to start java program from citrus?

hkoko
Hi Laura,
Citrus is rely on TestNG, so maybe you can use:
 @BeforeSuite
 --some procedure

 @AfterSuite
 -- some procedure

This might help to implement the other part.
http://stackoverflow.com/questions/502494/execute-a-java-program-from-our-java-program

I don`t know that there is something built in Citrus for that.
Hope it helps.

Best regards,
Kornel
Reply | Threaded
Open this post in threaded view
|

Re: how to start java program from citrus?

Laura
Hi Kornel,

thanks for your answer. I would like to start the program in the end of the before-suite. But I don't know how. We write the Testcases and the config in xml, not in java. That's why I don't know how to implement the suggested solutions from stackoverflow. Do you know?

Best regards,
Laura
Reply | Threaded
Open this post in threaded view
|

Re: how to start java program from citrus?

hkoko
Hi Laura,
Unfortunately I don`t know if you have implemented it in xml. For us it was easier to follow the Java DSL thing. Can you show some Java code?
Reply | Threaded
Open this post in threaded view
|

Re: how to start java program from citrus?

Christoph Deppisch
Administrator
Hi Laura,

the before/after suite possibilities are described in here: http://www.citrusframework.org/reference/html/test-suite.html

You can use the BeforeSuiteSupport classes and add these to the Spring application context:

public class MyBeforeSuite extends TestDesignerBeforeSuiteSupport {
    @Override
    public void beforeSuite(TestDesigner designer) {
        designer.echo("This action should be executed before suite");
    }
}

<bean id="myBeforeSuite" class="my.company.citrus.MyBeforeSuite"/>

You can call your custom Java code in the beforeSuite method then. Of course your classes must be part of the Citrus project either by adding a Maven dependency or by adding the classes to the src/main/java directly.
Reply | Threaded
Open this post in threaded view
|

Re: how to start java program from citrus?

VSrao
Hi Chris,

I'm trying to add BeforeSuiteSupport to my existing Citrus tests.
How to configure Suites in citrus-context.xml? Do I need to use testing.xml to configure.

is the below one goes to citrus-context.xml?

<bean id="myBeforeSuite" class="my.company.citrus.MyBeforeSuite"/>

Thanks,