SlideShare ist ein Scribd-Unternehmen logo
1 von 36
Downloaden Sie, um offline zu lesen
@citrus_test#Devoxx #CitrusTwist
Testing Microservices
with a Citrus Twist
Christoph Deppisch
ConSol* Software GmbH
@citrus_test#Devoxx #CitrusTwist
Christoph Deppisch
• Senior software developer
• @ConSol* Munich, Germany
• 10 years of experience in Java
• Passionate about automated software testing
• Founder of the Open Source framework Citrus
• Happy to be here today!





Twitter: @freaky_styley
@citrus_test#Devoxx #CitrusTwist
What is Citrus?
• Open Source integration test framework
• Focus on messaging in distributed software systems
• Automated interface tests
• Ready-to-use endpoint components for message exchange
• Works & integrates with well-known libraries
• TestNG, JUnit
• Apache Camel, Spring, Docker,Arquillian …
@citrus_test#Devoxx #CitrusTwist
Integration
@citrus_test#Devoxx #CitrusTwist
Every project needs
integration tests!
@citrus_test#Devoxx #CitrusTwist
Service A Service B
Interface
REST, JMS, File, SOAP
@citrus_test#Devoxx #CitrusTwist
Service A Service B
Interface
REST, JMS, File, SOAP
Mock?
Simulator?
@citrus_test#Devoxx #CitrusTwist
Service A
Interface
REST, JMS, File, SOAP
@citrus_test#Devoxx #CitrusTwist
Microservices
@citrus_test#Devoxx #CitrusTwist
Service
Service
Service
Service
Service
ServiceServiceService
External
External
@citrus_test#Devoxx #CitrusTwist
Continuous Delivery
@citrus_test#Devoxx #CitrusTwist
Automation!
@citrus_test#Devoxx #CitrusTwist
Citrus
integration twist
@citrus_test#Devoxx #CitrusTwist
import com.consol.citrus.annotations.CitrusTest;
import com.consol.citrus.dsl.testng.TestNGCitrusTestDesigner;
import org.testng.annotations.Test;
@Test

public class SampleCitrusIT extends TestNGCitrusTestDesigner {



@CitrusTest

public void sayHello() {

echo("Hello, Devoxx! This is my first Citrus test!");

}

}
@citrus_test#Devoxx #CitrusTwist
Test actions
@citrus_test#Devoxx #CitrusTwist
• Missing something? Adding custom actions is possible!
Test actions
Test action Description
echo Log message to console
send Sends a message
receive Receives a message
sleep Wait some time
sql Execute SQL statements
parallel Execute actions in parallel
conditional Execute actions based on condition
iterate Execute actions in iteration
repeat-on-error Failsafe action execution
…
@citrus_test#Devoxx #CitrusTwist
@Test

public class MessageExchangeIT extends TestNGCitrusTestDesigner {

@Autowired

private Endpoint orderEndpoint;


@CitrusTest

public void sendAndReceiveMessage() {
send(orderEndpoint)
.payload("...");
receive(orderEndpoint)
.payload("...");

}

}
@citrus_test#Devoxx #CitrusTwist
@CitrusTest

public void sendAndReceiveMessage() {
variable("orderId", Functions.randomNumber(10L));
send(orderEndpoint)
.payload("<order>" +
"<id>${orderId}</id>" +
"</order>")
.header("operation", "placeOrder")
.header("id", "${orderId}");

receive(orderEndpoint)
.payload("<orderResponse>" +
"<timestamp>@ignore@</timestamp>" +
"<id>${orderId}</id>" +
"<success>true</success>" +
"</orderResponse>")
.header("id", "${orderId}");

}
@citrus_test#Devoxx #CitrusTwist
Endpoints
@citrus_test#Devoxx #CitrusTwist
• Missing something? Adding custom components is easy!
Endpoint components
Component Description
citrus-http Http REST client and server
citrus-jms JMS queue or topic destination
citrus-ws SOAP client and server
citrus-mail SMTP mail client and server
citrus-docker Docker container management
citrus-camel Apache Camel endpoint
citrus-ftp FTP client and server
citrus-vertx Vert.x endpoint
citrus-ssh SSH client and server
…
@citrus_test#Devoxx #CitrusTwist
<!-- JMS endpoints -->
<citrus-jms:endpoint id="orderEndpoint"

destination-name="factory.order.inbound"/>


<citrus-jms:sync-endpoint id="errorEndpoint"

destination-name="base.error.service"

timeout="${global.receive.timeout}"/>
<!-- JMS connection factory and message broker -->

<bean id="connectionFactory"

class="org.apache.activemq.ActiveMQConnectionFactory">

<property name="brokerURL" value="tcp://localhost:61616" />

</bean>
Endpoints: citrus-jms
@citrus_test#Devoxx #CitrusTwist
<!-- REST Http client -->
<citrus-http:client id="reportingClient"
request-method="GET"
timeout="5000"

request-url="http://localhost:8080/services/report"/>
<!-- REST Http server -->

<citrus-http:server id="reportingServer"

port="8080"

auto-start="true"/>
Endpoints: citrus-http
@citrus_test#Devoxx #CitrusTwist
Example
@citrus_test#Devoxx #CitrusTwist
Cookie factory sample
worker
worker
worker
webapp reporting
2x 4x 1x
@citrus_test#Devoxx #CitrusTwist
Docker infrastructure
brokerwebapp report
worker
worker
worker
@citrus_test#Devoxx #CitrusTwist
brokerwebapp report
worker
worker
worker
@citrus_test#Devoxx #CitrusTwist
Demo
@citrus_test#Devoxx #CitrusTwist
Demo tools
• docker-maven-plugin
• docker:build, docker:start, docker:stop
• https://github.com/rhuss/docker-maven-plugin
• Apache Camel
• Content-based routing, REST endpoints, standalone worker
• http://camel.apache.org/
• Demo Code
• https://github.com/christophd/citrus-demo-devoxx
@citrus_test#Devoxx #CitrusTwist
brokerwebapp report
worker
worker
worker
@citrus_test#Devoxx #CitrusTwist
brokerwebapp report
@citrus_test#Devoxx #CitrusTwist
broker
worker
worker
worker
@citrus_test#Devoxx #CitrusTwist
brokerwebapp report
@citrus_test#Devoxx #CitrusTwist
What else?
@citrus_test#Devoxx #CitrusTwist
What else!?
• Docker integration
• build, start, stop, inspect, …
• Manage Docker containers at test runtime
• Arquillian extension
• Use Citrus in Arquillian test
• @CitrusFramework, @CitrusEndpoint, @CitrusResource
• Apache Camel integration
• Create, start, stop routes at test runtime
@citrus_test#Devoxx #CitrusTwist
Information
• Homepage
• http://citrusframework.org
• Blog
• http://labs.consol.de/tags/citrus/
• User Guide
• http://citrusframework.org/reference/html/index.html
• Mailing List
• user@citrusframework.org
@citrus_test#Devoxx #CitrusTwist
Questions!?

Weitere ähnliche Inhalte

Was ist angesagt?

Android webservices
Android webservicesAndroid webservices
Android webservices
Krazy Koder
 

Was ist angesagt? (18)

Android and REST
Android and RESTAndroid and REST
Android and REST
 
The Berkshelf Way
The Berkshelf WayThe Berkshelf Way
The Berkshelf Way
 
Controller Testing: You're Doing It Wrong
Controller Testing: You're Doing It WrongController Testing: You're Doing It Wrong
Controller Testing: You're Doing It Wrong
 
Android webservices
Android webservicesAndroid webservices
Android webservices
 
Python Code Camp for Professionals 4/4
Python Code Camp for Professionals 4/4Python Code Camp for Professionals 4/4
Python Code Camp for Professionals 4/4
 
Scalable web application architecture
Scalable web application architectureScalable web application architecture
Scalable web application architecture
 
Python Code Camp for Professionals 3/4
Python Code Camp for Professionals 3/4Python Code Camp for Professionals 3/4
Python Code Camp for Professionals 3/4
 
Grails Plugins
Grails PluginsGrails Plugins
Grails Plugins
 
PowerShell: Through the SharePoint Looking Glass
PowerShell: Through the SharePoint Looking GlassPowerShell: Through the SharePoint Looking Glass
PowerShell: Through the SharePoint Looking Glass
 
Writing Software not Code with Cucumber
Writing Software not Code with CucumberWriting Software not Code with Cucumber
Writing Software not Code with Cucumber
 
Frédérick Capovilla
Frédérick CapovillaFrédérick Capovilla
Frédérick Capovilla
 
Connecting to Web Services on Android
Connecting to Web Services on AndroidConnecting to Web Services on Android
Connecting to Web Services on Android
 
Grails Plugins(Console, DB Migration, Asset Pipeline and Remote pagination)
Grails Plugins(Console, DB Migration, Asset Pipeline and Remote pagination)Grails Plugins(Console, DB Migration, Asset Pipeline and Remote pagination)
Grails Plugins(Console, DB Migration, Asset Pipeline and Remote pagination)
 
Web Automation Testing Using Selenium
Web Automation Testing Using SeleniumWeb Automation Testing Using Selenium
Web Automation Testing Using Selenium
 
dotNetConf2019
dotNetConf2019dotNetConf2019
dotNetConf2019
 
Pieter De Baets - An introduction to React Native
Pieter De Baets - An introduction to React NativePieter De Baets - An introduction to React Native
Pieter De Baets - An introduction to React Native
 
CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009CouchDB for Web Applications - Erlang Factory London 2009
CouchDB for Web Applications - Erlang Factory London 2009
 
Cooking with Chef
Cooking with ChefCooking with Chef
Cooking with Chef
 

Andere mochten auch

Lunch and learn: Cucumber and Capybara
Lunch and learn: Cucumber and CapybaraLunch and learn: Cucumber and Capybara
Lunch and learn: Cucumber and Capybara
Marc Seeger
 

Andere mochten auch (20)

Arquillian & Citrus
Arquillian & CitrusArquillian & Citrus
Arquillian & Citrus
 
Capybara testing
Capybara testingCapybara testing
Capybara testing
 
Bdd (Behavior Driven Development)
Bdd (Behavior Driven Development)Bdd (Behavior Driven Development)
Bdd (Behavior Driven Development)
 
Testing Java EE apps with Arquillian
Testing Java EE apps with ArquillianTesting Java EE apps with Arquillian
Testing Java EE apps with Arquillian
 
Workshop calabash appium
Workshop calabash appiumWorkshop calabash appium
Workshop calabash appium
 
Lunch and learn: Cucumber and Capybara
Lunch and learn: Cucumber and CapybaraLunch and learn: Cucumber and Capybara
Lunch and learn: Cucumber and Capybara
 
Pruebas funcionales de Software
Pruebas funcionales de SoftwarePruebas funcionales de Software
Pruebas funcionales de Software
 
Automated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choiceAutomated Acceptance Tests & Tool choice
Automated Acceptance Tests & Tool choice
 
Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013Rspec and Capybara Intro Tutorial at RailsConf 2013
Rspec and Capybara Intro Tutorial at RailsConf 2013
 
Three Uses Of JIRA Beyond Bug Tracking
Three Uses Of JIRA Beyond Bug TrackingThree Uses Of JIRA Beyond Bug Tracking
Three Uses Of JIRA Beyond Bug Tracking
 
TestLink introduction
TestLink introductionTestLink introduction
TestLink introduction
 
Introduction To Confluence
Introduction To ConfluenceIntroduction To Confluence
Introduction To Confluence
 
Jira as a Tool for Test Management
Jira as a Tool for Test ManagementJira as a Tool for Test Management
Jira as a Tool for Test Management
 
Using JIRA Software for Issue Tracking
Using JIRA Software for Issue TrackingUsing JIRA Software for Issue Tracking
Using JIRA Software for Issue Tracking
 
Introduction To Jira
Introduction To JiraIntroduction To Jira
Introduction To Jira
 
Story Testing Approach for Enterprise Applications using Selenium Framework
Story Testing Approach for Enterprise Applications using Selenium FrameworkStory Testing Approach for Enterprise Applications using Selenium Framework
Story Testing Approach for Enterprise Applications using Selenium Framework
 
Next level of Appium
Next level of AppiumNext level of Appium
Next level of Appium
 
Automate you Appium test like a pro!
Automate you Appium test like a pro!Automate you Appium test like a pro!
Automate you Appium test like a pro!
 
Gerrit is Getting Native with RPM, Deb and Docker
Gerrit is Getting Native with RPM, Deb and DockerGerrit is Getting Native with RPM, Deb and Docker
Gerrit is Getting Native with RPM, Deb and Docker
 
Introduction to Bdd and cucumber
Introduction to Bdd and cucumberIntroduction to Bdd and cucumber
Introduction to Bdd and cucumber
 

Ähnlich wie Testing Microservices with a Citrus twist

CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
Sven Haiges
 

Ähnlich wie Testing Microservices with a Citrus twist (20)

CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
 
The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014
The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014
The Hitchhicker’s Guide to Windows Azure Mobile Services | FalafelCON 2014
 
2008 - TechDays PT: WCF, JSON and AJAX for performance and manageability
2008 - TechDays PT: WCF, JSON and AJAX for performance and manageability2008 - TechDays PT: WCF, JSON and AJAX for performance and manageability
2008 - TechDays PT: WCF, JSON and AJAX for performance and manageability
 
Droidcon ES '16 - How to fail going offline
Droidcon ES '16 - How to fail going offlineDroidcon ES '16 - How to fail going offline
Droidcon ES '16 - How to fail going offline
 
Dartprogramming
DartprogrammingDartprogramming
Dartprogramming
 
JavaOne Brasil 2016: JavaEE e HTML5: da web/desktop ao mobile
JavaOne Brasil 2016: JavaEE e HTML5: da web/desktop ao mobileJavaOne Brasil 2016: JavaEE e HTML5: da web/desktop ao mobile
JavaOne Brasil 2016: JavaEE e HTML5: da web/desktop ao mobile
 
Kotlin for android 2019
Kotlin for android 2019Kotlin for android 2019
Kotlin for android 2019
 
Android L01 - Warm Up
Android L01 - Warm UpAndroid L01 - Warm Up
Android L01 - Warm Up
 
5 x HTML5 worth using in APEX (5)
5 x HTML5 worth using in APEX (5)5 x HTML5 worth using in APEX (5)
5 x HTML5 worth using in APEX (5)
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenery
 
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...
SharePoint Saturday Ottawa 2015 - Office 365 and PowerShell - A match made in...
 
MicroProfile: A Quest for a Lightweight and Modern Enterprise Java Platform
MicroProfile: A Quest for a Lightweight and Modern Enterprise Java PlatformMicroProfile: A Quest for a Lightweight and Modern Enterprise Java Platform
MicroProfile: A Quest for a Lightweight and Modern Enterprise Java Platform
 
Bare-knuckle web development
Bare-knuckle web developmentBare-knuckle web development
Bare-knuckle web development
 
Webinar - Office 365 & PowerShell : A Match Made in Heaven
Webinar - Office 365 & PowerShell : A Match Made in HeavenWebinar - Office 365 & PowerShell : A Match Made in Heaven
Webinar - Office 365 & PowerShell : A Match Made in Heaven
 
MBL203 Building a Mobile Application Platform on AWS - AWS re: Invent 2012
MBL203 Building a Mobile Application Platform on AWS - AWS re: Invent 2012MBL203 Building a Mobile Application Platform on AWS - AWS re: Invent 2012
MBL203 Building a Mobile Application Platform on AWS - AWS re: Invent 2012
 
2018 03 20_biological_databases_part3
2018 03 20_biological_databases_part32018 03 20_biological_databases_part3
2018 03 20_biological_databases_part3
 
Behavior driven integration with Cucumber & Citrus
Behavior driven integration with Cucumber & CitrusBehavior driven integration with Cucumber & Citrus
Behavior driven integration with Cucumber & Citrus
 
MWLUG 2017 - Elementary!
MWLUG 2017 - Elementary!MWLUG 2017 - Elementary!
MWLUG 2017 - Elementary!
 
Spicy javascript: Create your first Chrome extension for web analytics QA
Spicy javascript: Create your first Chrome extension for web analytics QASpicy javascript: Create your first Chrome extension for web analytics QA
Spicy javascript: Create your first Chrome extension for web analytics QA
 
SharePoint Conference 2018 - Build an intelligent application by connecting i...
SharePoint Conference 2018 - Build an intelligent application by connecting i...SharePoint Conference 2018 - Build an intelligent application by connecting i...
SharePoint Conference 2018 - Build an intelligent application by connecting i...
 

Kürzlich hochgeladen

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 

Kürzlich hochgeladen (20)

Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 

Testing Microservices with a Citrus twist