![]() ![]() Everything you can do with JUnit and TestNG test cases you can do with Citrus tests also. Users might already know one of these frameworks and the chances are good that they are familiar with at least one of them. continuous build, build lifecycle, development IDE). Both the JUnit and TestNG Java APIs offer various ways of execution and both frameworks are widely supported by other tools (e.g. So why is Citrus related to Unit tests although it is intended to be a framework for integration testing? The answer to this question is quite simple: This is because Citrus wants to benefit from both JUnit and TestNG for Java test execution. There are basically three options available: testng and junit. ![]() During creation, Citrus asks you which execution framework should be used for this test. With the creation of this test we have already made a very important decision. ![]() In case you are familiar with writing Java code you may just skip the test template generation via Maven or ANT and preferably just create new Citrus Java test classes on your own. If you prefer to just write Java code you can throw away the XML part immediately and continue working with the Java part only. Src/it/java/com/consol/citrus/MyFirstCitrusTest.java For example: if you create a new test named MyFirstCitrusTest you will find these two files as a result: src/it/tests/com/consol/citrus/MyFirstCitrusTest.xml If you create new test cases in Citrus - for instance via Maven plugin or ANT build script - Citrus generates both parts in your test directory. In the following sections we concentrate on the Java part and the test execution mechanism. The Java part will then just be responsible for test execution and is not likely to be changed at all. In this case the XML part holds all actions to tell Citrus what should happen in the test case. This is for those of you that do not want to code in Java. As optional add on a Citrus test can have a XML test declaration file. Each Citrus test therefore relates to a Java class representing a JUnit or TestNG unit test. Citrus test cases are nothing but Java classes that get executed within a Java runtime environment. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |