SlideShare a Scribd company logo
1 of 15
Testy obciążeniowe

Testy funkcjonalne

Wsparcie dla popularnych
protokołów

Tworzenie testów metodą
Drag and Drop

Testy bezpieczeostwa

Wbudowane statystyki
Możliwośd używania
skryptów

Wsparcie dla SSL
Automatyzacja

Nagrywanie HTTP
Symulacja usług
sieciowych

Wsparcie społeczności
Sprawdzanie zgodności
ze standardami
Agenda
• Acceptance Test-Driven Development
FEATURE:
IN ORDER to manage contacts from various applications
AS an international corporation
I WANT a service with REST API
• Some examples of soapUI usage
• Some examples of Groovy scripts

Resources: http://bit.ly/16FdgyK
REST

GET http://localhost:8080/testwarez/contacts?q=Steve
REQUEST METHOD GET
RESOURCE BASE http://localhost:8080/testwarez
RESOURCE PATH /contacts
QUERY STRING q=Steve
CONTENT-TYPE ...
HEADER...
Scenario 1: Fetching all contacts

GIVEN service available at base url
AND database containing 5 contacts
WHEN I send GET request for /contacts resource
THEN I should receive response with code 200
AND 5 entity tags containing contact details
Displaying information in soapUI
// Static text
log.info "Displaying text in soapUI script log"
// Dynamic text
def query = "q=Jacek"
log.info "Parameter query: ${query}"
log.info "Parameter query: " + query
// soapUI related variables
log.info "Request for ${mockRequest.path}"
log.info "method: ${mockRequest.httpRequest.method}"
log.info "with params: ${mockRequest.httpRequest.queryString}"
def dir = context.expand('${projectDir}');
log.info "Project saved in ${dir}"
Scenario 2: Fetching filtered contacts

GIVEN service available at base url
AND database provisioned according to the example
WHEN I send GET request for /contacts?q=<query>
THEN I should receive response containing <#> contacts
Example:
| query
| rysiek
| Steve
| XNAS

|#
|1
|2
|0

|
|
|
|
Returning file content in response

import com.eviware.soapui.impl.wsdl.mock.WsdlMockResult
def docRoot = mockRunner.mockService.docroot
if ( queryString == "q=Steve" ) {
mockRunner.returnFile (
mockRequest.httpResponse,
new File("${docRoot}contacts-q-Steve")
)
mockRequest.httpResponse.status = 200
return new WsdlMockResult( mockRequest )
}
Regular expressions

// Let's define sample variables
def testedString = "q=Steve&updated=2013-10-14"
def pattern = /q=([^&]*.*)/

// ==~ tests, if String matches the pattern
assert testedString ==~ pattern
assert !("holla" ==~ pattern)
// =~ return Matchers
qParams = ( testedString =~ pattern )
assert qParams[0] =-[q=Steve, Steve]
assert qParams[0][1] == 'Steve'
Scenario 3: Fetching contact by contactId

GIVEN service available at base url
WHEN I send GET request for /contacts/<contactId>
THEN I should receive response with <code>
AND content of message should contain <details>
Example:
| contactId | code
| 103fbd
| 200
| 000000 | 500

| details
|
| Bill Gates |
| Fault
|
soapUI API
http://www.soapui.org/apidocs
// Getting reference to project object
def tc = testRunner.testCase
def testStep = tc.testSteps["TestStep name"]
// Setting or getting properties
tc.setPropertyValue("contactId", "103fbd" )
testStep.getPropertyValue("ResponseAsXml")
// Executing test step
def result = testStep.run( testRunner, context )
//if( result.status == TestStepStatus.OK ){}
// Running in load context
if( context.LoadTestContext != null )
no = context.RunCount as Integer
Groovy lists

// Defining lists
def queries = ['rysiek', 'Steve', 'none']
def queriesAndNo = [['rysiek','1'], ['Steve', '2'], ['none', '0']]

// Accessing list elements
log.info queries[0]
log.info "${queriesAndNo [0][0]}: ${queriesAndNo [0][1]}"
log.info "${queriesAndNo [-1][0]}: ${queriesAndNo [-1][1]}"
// Iterating over collection elements
queriesAndNo.each { log.info "${it[0]}: ${it[1]}" }
tc.metaClass.properties*.name
Groovy and XML

// Parsing text
def rootNode = new XmlSlurper().parseText(
'<root><one a1="uno!"/><two>Some text!</two></root>'
)
// Reading elements
assert rootNode.name() == 'root'
assert rootNode.one[0].@a1 == 'uno!'
assert rootNode.two.text() == 'Some text!'
rootNode.children().each { assert it.name() in ['one','two'] }
Scenario 4: Adding contact

GIVEN service available at base url
AND having contactId 103fbd in the database
WHEN I send PUT request containing <contactId>
THEN I should receive response with <status code>
AND I should be able to get added
Example:
| contact details
| 103fbf
| 103fbd

| status code
| 200
| 403

|
|
|
Groovy and files

// Opening file
def file = new File("tmp")
//Writing content of request to file
file << mockRequest.httpRequest.inputStream
// Reading from file
file.readLines()

// Other methods
file.exists()
file.renameTo("newFIleName")
Groovy and XML

<entry>
<id>103fbd60efd5725</id>
<category>CEO</category>
<title type="text">Bill Gates</title>
<firstname>Bill</firstname>
<lastname>Gates</lastname>
</entry>

// Opening xml file
def entry = new XmlSlurper().parse(file)
// Reading elements
def id = entry.id.text()
def category = entry.category as String
det titleType = entry.title.@type.text()

More Related Content

What's hot

Anay - Fluent interfaces in testing
Anay - Fluent interfaces in testingAnay - Fluent interfaces in testing
Anay - Fluent interfaces in testingvodQA
 
node.js practical guide to serverside javascript
node.js practical guide to serverside javascriptnode.js practical guide to serverside javascript
node.js practical guide to serverside javascriptEldar Djafarov
 
Unit Testing Express Middleware
Unit Testing Express MiddlewareUnit Testing Express Middleware
Unit Testing Express MiddlewareMorris Singer
 
Dropwizard Introduction
Dropwizard IntroductionDropwizard Introduction
Dropwizard IntroductionAnthony Chen
 
Amazon Web Service - Basics
Amazon Web Service - BasicsAmazon Web Service - Basics
Amazon Web Service - BasicsSang-Min Park
 
Python tools for testing web services over HTTP
Python tools for testing web services over HTTPPython tools for testing web services over HTTP
Python tools for testing web services over HTTPMykhailo Kolesnyk
 
RSpec 3.0: Under the Covers
RSpec 3.0: Under the CoversRSpec 3.0: Under the Covers
RSpec 3.0: Under the CoversBrian Gesiak
 
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to MissJava Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to MissAndres Almiray
 
Wonderful csom sps barcelona
Wonderful csom sps barcelonaWonderful csom sps barcelona
Wonderful csom sps barcelonaSonja Madsen
 
Making the Most of Your Gradle Build
Making the Most of Your Gradle BuildMaking the Most of Your Gradle Build
Making the Most of Your Gradle BuildAndres Almiray
 
Swift LA Meetup at eHarmony- What's New in Swift 2.0
Swift LA Meetup at eHarmony- What's New in Swift 2.0Swift LA Meetup at eHarmony- What's New in Swift 2.0
Swift LA Meetup at eHarmony- What's New in Swift 2.0Claire Townend Gee
 
Take Control of your Integration Testing with TestContainers
Take Control of your Integration Testing with TestContainersTake Control of your Integration Testing with TestContainers
Take Control of your Integration Testing with TestContainersNaresha K
 
Connecting to Web Services on Android
Connecting to Web Services on AndroidConnecting to Web Services on Android
Connecting to Web Services on Androidsullis
 
Making the Most of Your Gradle Build
Making the Most of Your Gradle BuildMaking the Most of Your Gradle Build
Making the Most of Your Gradle BuildAndres Almiray
 
Evolution of the REST API
Evolution of the REST APIEvolution of the REST API
Evolution of the REST APIJeremyOtt5
 
Testing the Grails Spring Security Plugins
Testing the Grails Spring Security PluginsTesting the Grails Spring Security Plugins
Testing the Grails Spring Security PluginsBurt Beckwith
 
Building domain-specific testing tools : lessons learned from the Apache Slin...
Building domain-specific testing tools : lessons learned from the Apache Slin...Building domain-specific testing tools : lessons learned from the Apache Slin...
Building domain-specific testing tools : lessons learned from the Apache Slin...Robert Munteanu
 
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss Andres Almiray
 

What's hot (19)

Anay - Fluent interfaces in testing
Anay - Fluent interfaces in testingAnay - Fluent interfaces in testing
Anay - Fluent interfaces in testing
 
node.js practical guide to serverside javascript
node.js practical guide to serverside javascriptnode.js practical guide to serverside javascript
node.js practical guide to serverside javascript
 
Unit Testing Express Middleware
Unit Testing Express MiddlewareUnit Testing Express Middleware
Unit Testing Express Middleware
 
Dropwizard Introduction
Dropwizard IntroductionDropwizard Introduction
Dropwizard Introduction
 
Amazon Web Service - Basics
Amazon Web Service - BasicsAmazon Web Service - Basics
Amazon Web Service - Basics
 
Python tools for testing web services over HTTP
Python tools for testing web services over HTTPPython tools for testing web services over HTTP
Python tools for testing web services over HTTP
 
RSpec 3.0: Under the Covers
RSpec 3.0: Under the CoversRSpec 3.0: Under the Covers
RSpec 3.0: Under the Covers
 
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to MissJava Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss
 
Wonderful csom sps barcelona
Wonderful csom sps barcelonaWonderful csom sps barcelona
Wonderful csom sps barcelona
 
Making the Most of Your Gradle Build
Making the Most of Your Gradle BuildMaking the Most of Your Gradle Build
Making the Most of Your Gradle Build
 
Swift LA Meetup at eHarmony- What's New in Swift 2.0
Swift LA Meetup at eHarmony- What's New in Swift 2.0Swift LA Meetup at eHarmony- What's New in Swift 2.0
Swift LA Meetup at eHarmony- What's New in Swift 2.0
 
Take Control of your Integration Testing with TestContainers
Take Control of your Integration Testing with TestContainersTake Control of your Integration Testing with TestContainers
Take Control of your Integration Testing with TestContainers
 
Connecting to Web Services on Android
Connecting to Web Services on AndroidConnecting to Web Services on Android
Connecting to Web Services on Android
 
Making the Most of Your Gradle Build
Making the Most of Your Gradle BuildMaking the Most of Your Gradle Build
Making the Most of Your Gradle Build
 
Evolution of the REST API
Evolution of the REST APIEvolution of the REST API
Evolution of the REST API
 
Testing the Grails Spring Security Plugins
Testing the Grails Spring Security PluginsTesting the Grails Spring Security Plugins
Testing the Grails Spring Security Plugins
 
Building domain-specific testing tools : lessons learned from the Apache Slin...
Building domain-specific testing tools : lessons learned from the Apache Slin...Building domain-specific testing tools : lessons learned from the Apache Slin...
Building domain-specific testing tools : lessons learned from the Apache Slin...
 
Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss Java Libraries You Can’t Afford to Miss
Java Libraries You Can’t Afford to Miss
 
The JavaFX Ecosystem
The JavaFX EcosystemThe JavaFX Ecosystem
The JavaFX Ecosystem
 

Viewers also liked (8)

Testing hardware
Testing hardwareTesting hardware
Testing hardware
 
Testowanie w parach - Testwarez 2016
Testowanie w parach - Testwarez 2016Testowanie w parach - Testwarez 2016
Testowanie w parach - Testwarez 2016
 
Tester.pl - Numer 6
Tester.pl - Numer 6Tester.pl - Numer 6
Tester.pl - Numer 6
 
Mistrzostwa w testowaniu oprogramowania - prezentacja z TestWarez 2012
Mistrzostwa w testowaniu oprogramowania - prezentacja z TestWarez 2012Mistrzostwa w testowaniu oprogramowania - prezentacja z TestWarez 2012
Mistrzostwa w testowaniu oprogramowania - prezentacja z TestWarez 2012
 
Tester.pl - Numer 1
Tester.pl - Numer 1Tester.pl - Numer 1
Tester.pl - Numer 1
 
Google Testing Testwarez
Google Testing TestwarezGoogle Testing Testwarez
Google Testing Testwarez
 
Testowanie eksploracyjne - warsztat testerzy.pl na TestWarez 2011
Testowanie eksploracyjne - warsztat testerzy.pl na TestWarez 2011Testowanie eksploracyjne - warsztat testerzy.pl na TestWarez 2011
Testowanie eksploracyjne - warsztat testerzy.pl na TestWarez 2011
 
ONTOLOGIES – HOW TO AVOID MESS AND TRULY DESIGN YOUR CUCUMBER SCENARIOS
ONTOLOGIES – HOW TO AVOID MESS AND TRULY DESIGN YOUR CUCUMBER SCENARIOSONTOLOGIES – HOW TO AVOID MESS AND TRULY DESIGN YOUR CUCUMBER SCENARIOS
ONTOLOGIES – HOW TO AVOID MESS AND TRULY DESIGN YOUR CUCUMBER SCENARIOS
 

Similar to Testwarez 2013 - Warsztat SoapUI

API Days Paris - Automatic Testing of (RESTful) API Documentation
API Days Paris - Automatic Testing of (RESTful) API DocumentationAPI Days Paris - Automatic Testing of (RESTful) API Documentation
API Days Paris - Automatic Testing of (RESTful) API DocumentationRouven Weßling
 
Automating Cloud Operations: Everything You Wanted to Know about cURL and REST
Automating Cloud Operations: Everything You Wanted to Know about cURL and RESTAutomating Cloud Operations: Everything You Wanted to Know about cURL and REST
Automating Cloud Operations: Everything You Wanted to Know about cURL and RESTRevelation Technologies
 
Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Mario Cardinal
 
API Days Australia - Automatic Testing of (RESTful) API Documentation
API Days Australia  - Automatic Testing of (RESTful) API DocumentationAPI Days Australia  - Automatic Testing of (RESTful) API Documentation
API Days Australia - Automatic Testing of (RESTful) API DocumentationRouven Weßling
 
Taking Advantage of the SharePoint 2013 REST API
Taking Advantage of the SharePoint 2013 REST APITaking Advantage of the SharePoint 2013 REST API
Taking Advantage of the SharePoint 2013 REST APIEric Shupps
 
Lets have some fun with twilio open tok
Lets have some fun with   twilio open tokLets have some fun with   twilio open tok
Lets have some fun with twilio open tokmirahman
 
Security enforcement of Java Microservices with Apiman & Keycloak
Security enforcement of Java Microservices with Apiman & KeycloakSecurity enforcement of Java Microservices with Apiman & Keycloak
Security enforcement of Java Microservices with Apiman & KeycloakCharles Moulliard
 
RESTful services
RESTful servicesRESTful services
RESTful servicesgouthamrv
 
TechDays 2013 Jari Kallonen: What's New WebForms 4.5
TechDays 2013 Jari Kallonen: What's New WebForms 4.5TechDays 2013 Jari Kallonen: What's New WebForms 4.5
TechDays 2013 Jari Kallonen: What's New WebForms 4.5Tieturi Oy
 
Pentesting web applications
Pentesting web applicationsPentesting web applications
Pentesting web applicationsSatish b
 
An Introduction to Tornado
An Introduction to TornadoAn Introduction to Tornado
An Introduction to TornadoGavin Roy
 
Web Services Automated Testing via SoapUI Tool
Web Services Automated Testing via SoapUI ToolWeb Services Automated Testing via SoapUI Tool
Web Services Automated Testing via SoapUI ToolSperasoft
 
Infrastructure as Code: Manage your Architecture with Git
Infrastructure as Code: Manage your Architecture with GitInfrastructure as Code: Manage your Architecture with Git
Infrastructure as Code: Manage your Architecture with GitDanilo Poccia
 
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaYevgeniy Brikman
 
Introduction to the SharePoint Client Object Model and REST API
Introduction to the SharePoint Client Object Model and REST APIIntroduction to the SharePoint Client Object Model and REST API
Introduction to the SharePoint Client Object Model and REST APIRob Windsor
 
REST APIs in the context of single-page applications
REST APIs in the context of single-page applicationsREST APIs in the context of single-page applications
REST APIs in the context of single-page applicationsyoranbe
 

Similar to Testwarez 2013 - Warsztat SoapUI (20)

API Days Paris - Automatic Testing of (RESTful) API Documentation
API Days Paris - Automatic Testing of (RESTful) API DocumentationAPI Days Paris - Automatic Testing of (RESTful) API Documentation
API Days Paris - Automatic Testing of (RESTful) API Documentation
 
Automating Cloud Operations: Everything You Wanted to Know about cURL and REST
Automating Cloud Operations: Everything You Wanted to Know about cURL and RESTAutomating Cloud Operations: Everything You Wanted to Know about cURL and REST
Automating Cloud Operations: Everything You Wanted to Know about cURL and REST
 
Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.Best Practices for Architecting a Pragmatic Web API.
Best Practices for Architecting a Pragmatic Web API.
 
API Days Australia - Automatic Testing of (RESTful) API Documentation
API Days Australia  - Automatic Testing of (RESTful) API DocumentationAPI Days Australia  - Automatic Testing of (RESTful) API Documentation
API Days Australia - Automatic Testing of (RESTful) API Documentation
 
Taking Advantage of the SharePoint 2013 REST API
Taking Advantage of the SharePoint 2013 REST APITaking Advantage of the SharePoint 2013 REST API
Taking Advantage of the SharePoint 2013 REST API
 
Lets have some fun with twilio open tok
Lets have some fun with   twilio open tokLets have some fun with   twilio open tok
Lets have some fun with twilio open tok
 
Security enforcement of Java Microservices with Apiman & Keycloak
Security enforcement of Java Microservices with Apiman & KeycloakSecurity enforcement of Java Microservices with Apiman & Keycloak
Security enforcement of Java Microservices with Apiman & Keycloak
 
Web api
Web apiWeb api
Web api
 
RESTful services
RESTful servicesRESTful services
RESTful services
 
TechDays 2013 Jari Kallonen: What's New WebForms 4.5
TechDays 2013 Jari Kallonen: What's New WebForms 4.5TechDays 2013 Jari Kallonen: What's New WebForms 4.5
TechDays 2013 Jari Kallonen: What's New WebForms 4.5
 
Pentesting web applications
Pentesting web applicationsPentesting web applications
Pentesting web applications
 
An Introduction to Tornado
An Introduction to TornadoAn Introduction to Tornado
An Introduction to Tornado
 
Web Services Automated Testing via SoapUI Tool
Web Services Automated Testing via SoapUI ToolWeb Services Automated Testing via SoapUI Tool
Web Services Automated Testing via SoapUI Tool
 
Web Services Security
Web Services SecurityWeb Services Security
Web Services Security
 
Palestra VCR
Palestra VCRPalestra VCR
Palestra VCR
 
Infrastructure as Code: Manage your Architecture with Git
Infrastructure as Code: Manage your Architecture with GitInfrastructure as Code: Manage your Architecture with Git
Infrastructure as Code: Manage your Architecture with Git
 
Play Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and ScalaPlay Framework: async I/O with Java and Scala
Play Framework: async I/O with Java and Scala
 
Django Tastypie 101
Django Tastypie 101Django Tastypie 101
Django Tastypie 101
 
Introduction to the SharePoint Client Object Model and REST API
Introduction to the SharePoint Client Object Model and REST APIIntroduction to the SharePoint Client Object Model and REST API
Introduction to the SharePoint Client Object Model and REST API
 
REST APIs in the context of single-page applications
REST APIs in the context of single-page applicationsREST APIs in the context of single-page applications
REST APIs in the context of single-page applications
 

Recently uploaded

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
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...Martijn de Jong
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
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...Igalia
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
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.pdfUK Journal
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
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 textsMaria Levchenko
 

Recently uploaded (20)

Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
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...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
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...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
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
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
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
 

Testwarez 2013 - Warsztat SoapUI

  • 1. Testy obciążeniowe Testy funkcjonalne Wsparcie dla popularnych protokołów Tworzenie testów metodą Drag and Drop Testy bezpieczeostwa Wbudowane statystyki Możliwośd używania skryptów Wsparcie dla SSL Automatyzacja Nagrywanie HTTP Symulacja usług sieciowych Wsparcie społeczności Sprawdzanie zgodności ze standardami
  • 2. Agenda • Acceptance Test-Driven Development FEATURE: IN ORDER to manage contacts from various applications AS an international corporation I WANT a service with REST API • Some examples of soapUI usage • Some examples of Groovy scripts Resources: http://bit.ly/16FdgyK
  • 3. REST GET http://localhost:8080/testwarez/contacts?q=Steve REQUEST METHOD GET RESOURCE BASE http://localhost:8080/testwarez RESOURCE PATH /contacts QUERY STRING q=Steve CONTENT-TYPE ... HEADER...
  • 4. Scenario 1: Fetching all contacts GIVEN service available at base url AND database containing 5 contacts WHEN I send GET request for /contacts resource THEN I should receive response with code 200 AND 5 entity tags containing contact details
  • 5. Displaying information in soapUI // Static text log.info "Displaying text in soapUI script log" // Dynamic text def query = "q=Jacek" log.info "Parameter query: ${query}" log.info "Parameter query: " + query // soapUI related variables log.info "Request for ${mockRequest.path}" log.info "method: ${mockRequest.httpRequest.method}" log.info "with params: ${mockRequest.httpRequest.queryString}" def dir = context.expand('${projectDir}'); log.info "Project saved in ${dir}"
  • 6. Scenario 2: Fetching filtered contacts GIVEN service available at base url AND database provisioned according to the example WHEN I send GET request for /contacts?q=<query> THEN I should receive response containing <#> contacts Example: | query | rysiek | Steve | XNAS |# |1 |2 |0 | | | |
  • 7. Returning file content in response import com.eviware.soapui.impl.wsdl.mock.WsdlMockResult def docRoot = mockRunner.mockService.docroot if ( queryString == "q=Steve" ) { mockRunner.returnFile ( mockRequest.httpResponse, new File("${docRoot}contacts-q-Steve") ) mockRequest.httpResponse.status = 200 return new WsdlMockResult( mockRequest ) }
  • 8. Regular expressions // Let's define sample variables def testedString = "q=Steve&updated=2013-10-14" def pattern = /q=([^&]*.*)/ // ==~ tests, if String matches the pattern assert testedString ==~ pattern assert !("holla" ==~ pattern) // =~ return Matchers qParams = ( testedString =~ pattern ) assert qParams[0] =-[q=Steve, Steve] assert qParams[0][1] == 'Steve'
  • 9. Scenario 3: Fetching contact by contactId GIVEN service available at base url WHEN I send GET request for /contacts/<contactId> THEN I should receive response with <code> AND content of message should contain <details> Example: | contactId | code | 103fbd | 200 | 000000 | 500 | details | | Bill Gates | | Fault |
  • 10. soapUI API http://www.soapui.org/apidocs // Getting reference to project object def tc = testRunner.testCase def testStep = tc.testSteps["TestStep name"] // Setting or getting properties tc.setPropertyValue("contactId", "103fbd" ) testStep.getPropertyValue("ResponseAsXml") // Executing test step def result = testStep.run( testRunner, context ) //if( result.status == TestStepStatus.OK ){} // Running in load context if( context.LoadTestContext != null ) no = context.RunCount as Integer
  • 11. Groovy lists // Defining lists def queries = ['rysiek', 'Steve', 'none'] def queriesAndNo = [['rysiek','1'], ['Steve', '2'], ['none', '0']] // Accessing list elements log.info queries[0] log.info "${queriesAndNo [0][0]}: ${queriesAndNo [0][1]}" log.info "${queriesAndNo [-1][0]}: ${queriesAndNo [-1][1]}" // Iterating over collection elements queriesAndNo.each { log.info "${it[0]}: ${it[1]}" } tc.metaClass.properties*.name
  • 12. Groovy and XML // Parsing text def rootNode = new XmlSlurper().parseText( '<root><one a1="uno!"/><two>Some text!</two></root>' ) // Reading elements assert rootNode.name() == 'root' assert rootNode.one[0].@a1 == 'uno!' assert rootNode.two.text() == 'Some text!' rootNode.children().each { assert it.name() in ['one','two'] }
  • 13. Scenario 4: Adding contact GIVEN service available at base url AND having contactId 103fbd in the database WHEN I send PUT request containing <contactId> THEN I should receive response with <status code> AND I should be able to get added Example: | contact details | 103fbf | 103fbd | status code | 200 | 403 | | |
  • 14. Groovy and files // Opening file def file = new File("tmp") //Writing content of request to file file << mockRequest.httpRequest.inputStream // Reading from file file.readLines() // Other methods file.exists() file.renameTo("newFIleName")
  • 15. Groovy and XML <entry> <id>103fbd60efd5725</id> <category>CEO</category> <title type="text">Bill Gates</title> <firstname>Bill</firstname> <lastname>Gates</lastname> </entry> // Opening xml file def entry = new XmlSlurper().parse(file) // Reading elements def id = entry.id.text() def category = entry.category as String det titleType = entry.title.@type.text()

Editor's Notes

  1. 103fbd60