SlideShare a Scribd company logo
© 2014, Conversant, Inc. All rights reserved.
PRESENTED BY
6/1/15
Ultimate Automation - ScalaTest
Software Test Automation on JVM
Platform
lRajesh Thanavarapu
© 2014, Conversant, Inc. All rights reserved.
Software Test Automation
“In software testing, test automation is the use of special software (separate
from the software being tested) to control the execution of
tests and the comparison of actual outcomes
with predicted outcomes.[1] Test automation can automate
some repetitive but necessary tasks in a formalized testing process already
in place, or add additional testing that would be difficult to perform manually.”
- From Wikipedia, the free encyclopedia
© 2014, Conversant, Inc. All rights reserved.
Test Automation Classification
* Code-driven Test Automation
* GUI Test Automation
* API Test Automation <- Topic of discussion
© 2014, Conversant, Inc. All rights reserved.
Ultimate Automation Tool
* Associate Tests with Specs
* Facilitates simplistic Test design
* Provides complete Data abstraction
* Documentation that is up to date
* Allows for easy enhancements
* Provides visibility to all teams – Business,
Prod, Dev, QA & The Management
© 2014, Conversant, Inc. All rights reserved.
Too Many Names
TDD
ATDD
BDD
FDD
DDD
MDD
R2D2
C3PO
© 2014, Conversant, Inc. All rights reserved.
Specification Testing
* One Source - Tests, Specs, Documentation,
Reports
* Everybody wins – Stake holders, Business,
Product, Developers & Testers
© 2014, Conversant, Inc. All rights reserved.
Scala
* Shares the JVM Space
* JIT Compiled and Bytecode
* Supports both OOP & FP
* Higher Order Language
* Aggressive Road map – Java 8
* Complete Maven Integration
* BSD Licensed
© 2014, Conversant, Inc. All rights reserved.
Java => Scala
Improvements: A non-unified type system (primitives vs.
objects), type erasure (polymorphism), and checked
exceptions.
Additions: Functional programming concepts- type
inference, anonymous functions (closures), lazy
initialization etc.
© 2014, Conversant, Inc. All rights reserved.
Scala Is Concise
Java
public class Person
{
private String firstName;
private String lastName;
// Let's not forget the getters and setters OK?
Person(String firstName, String lastName) {
this.firstName=firstName;
this.lastName=lastName;
}
}
Scala
class Person(firstName:String, lastName:String)
© 2014, Conversant, Inc. All rights reserved.
Scala Is Implicit
Java
public class ClassicSingleton {
private static ClassicSingleton instance = null;
protected ClassicSingleton() {
// Exists only to defeat instantiation.
}
public static ClassicSingleton getInstance() {
if(instance == null) {
instance = new ClassicSingleton();
}
return instance;
}
}
Scala
Object ClassicSingleton{
}
© 2014, Conversant, Inc. All rights reserved.
Scala Is True FP
Lambda Expressions
val even = ( x :Int ) => {
X % 2 == 0 }
even(7)
Output: false
Theory
Var res=f(x)
Var res=f(x) + (f(y) + f(z))
Var res=f(x)=f(a) * f(b)
Best Curry(ing) in town...
© 2014, Conversant, Inc. All rights reserved.
Scala better than Java?
Scala will not replace Java, but it truly
Compliments!!
© 2014, Conversant, Inc. All rights reserved.
Big Companies using Scala
© 2014, Conversant, Inc. All rights reserved.
ScalaTest
* API based on Scala – external jar
* Simple and English like DSL
* Traits for everyone (Java 8 mixin)
FeatureSpec
FlatSpec
FunSpec and more...
© 2014, Conversant, Inc. All rights reserved.
Trait FeatureSpec
class SampleClass extends FeatureSpec {
feature("The user can pop an element off the top of the stack") {
scenario("pop is invoked on a non-empty stack") (pending)
scenario("pop is invoked on an empty stack"){
…
}
ignore("pop is invoked on an empty stack") {
…
}
}
}
© 2014, Conversant, Inc. All rights reserved.
Impl. Detailsprotected def feature(description: String)(fun: => Unit) {
try {
registerNestedBranch(Resources.feature(...), fun,...)
}
catch {
case e: exceptions.TestFailedException => throw new exceptions.(...)
...
}
}
protected def scenario(specText: String, testTags: Tag*)(testFun: FixtureParam => Registeration {
engine.registerTest(Resources.scenario(...)
}
protected def ignore(specText: String, testTags: Tag*)(testFun: FixtureParam => Registeration) {
engine.registerIgnoredTest(...)
}
© 2014, Conversant, Inc. All rights reserved.
Trait FunSpec
class SampleClass extends FunSpec {
describe("A Set") {
describe("when empty") {
it("should have size 0") {
assert(Set.empty.size == 0)
}
it("should produce NoSuchElementException when head is invoked") {
intercept[NoSuchElementException] {
Set.empty.head
}
}
}
}
© 2014, Conversant, Inc. All rights reserved.
Trait FlatSpec
class SampleClass extends FlatSpec {
"An empty Set" should "have size 0" in {
assert(Set.empty.size == 0)
}
it should "produce NoSuchElementException when head is invoked" in {
intercept[NoSuchElementException] {
Set.empty.head
}
}
}
© 2014, Conversant, Inc. All rights reserved.
Many Styles to Choose
http://scalatest.org/user_guide
/selecting_a_style
© 2014, Conversant, Inc. All rights reserved.
Test Development
* Define a comprehensive list of test Scenarios
* Initially write all tests as “Pending”
* Incrementally add test code (worker methods)
Language of choice: Scala, Java or Both
* Review test results
* Add more test Scenarios...
© 2014, Conversant, Inc. All rights reserved.
Sample Code
feature("Block user from registering to listed promotion codes") {
scenario("User should be blocked for a listed promo code and listed company") {
var code = blockReg.testPromoBlockCommand(5050, 77)
code should be("22")
}
scenario("User should not be blocked for a unlisted promo code and listed company") {
var code = blockReg.testPromoBlockCommand(5050, 123)
code should not be ("22")
}
scenario("User should not be blocked for a listed promo code and unlisted company") {
var code = blockReg.testPromoBlockCommand(5318, 77)
code should not be ("22")
}
scenario("User should not be blocked for a unlisted promo code and unlisted company") {
var code = blockReg.testPromoBlockCommand(5318, 123)
code should not be ("22")
}
© 2014, Conversant, Inc. All rights reserved.
Scala Runner
$ scala -cp scalatest_2.11-2.2.4.jar org.scalatest.run ExampleSpec
Discovery starting.
Discovery completed in 21 milliseconds.
Run starting. Expected test count is: 2
ExampleSpec:
A Stack
- should pop values in last-in-first-out order
- should throw NoSuchElementException if an empty stack is popped
Run completed in 76 milliseconds.
Total number of tests run: 2
Suites: completed 1, aborted 0
Tests: succeeded 2, failed 0, canceled 0, ignored 0, pending 0
All tests passed.
© 2014, Conversant, Inc. All rights reserved.
Reporting
Note: This report is generated by the FREE Scala Plugin of
Intellij
© 2014, Conversant, Inc. All rights reserved.
References / Links
http://www.scala-lang.org/download/
http://scalatest.org/download
http://doc.scalatest.org/2.2.4/index.html#org.scalatest.package
http://www.scala-lang.org/api/current/#package
http://scala-tools.org/mvnsites/maven-scala-plugin/
Downloads
Guides
Plugin
© 2014, Conversant, Inc. All rights reserved.
Q&A
Pls send your questions and comments
to
rthanavarapu@conversantmedia.com

More Related Content

What's hot

Testing in AngularJS
Testing in AngularJSTesting in AngularJS
Testing in AngularJS
Peter Drinnan
 
Protractor framework architecture with example
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with example
shadabgilani
 
Automated php unit testing in drupal 8
Automated php unit testing in drupal 8Automated php unit testing in drupal 8
Automated php unit testing in drupal 8
Jay Friendly
 
AngularJS Unit Test
AngularJS Unit TestAngularJS Unit Test
AngularJS Unit Test
Chiew Carol
 
Selenium using Java
Selenium using JavaSelenium using Java
Selenium using Java
F K
 
Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8
Sam Becker
 
Dart for Java Developers
Dart for Java DevelopersDart for Java Developers
Dart for Java Developers
Yakov Fain
 
Polyglot automation - QA Fest - 2015
Polyglot automation - QA Fest - 2015Polyglot automation - QA Fest - 2015
Polyglot automation - QA Fest - 2015
Iakiv Kramarenko
 
Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to Protractor
Jie-Wei Wu
 
Breaking free from static abuse in test automation frameworks and using Sprin...
Breaking free from static abuse in test automation frameworks and using Sprin...Breaking free from static abuse in test automation frameworks and using Sprin...
Breaking free from static abuse in test automation frameworks and using Sprin...
Abhijeet Vaikar
 
Automated Smoke Tests with Protractor
Automated Smoke Tests with ProtractorAutomated Smoke Tests with Protractor
Automated Smoke Tests with Protractor
🌱 Dale Spoonemore
 
Single Page Applications with AngularJS 2.0
Single Page Applications with AngularJS 2.0 Single Page Applications with AngularJS 2.0
Single Page Applications with AngularJS 2.0
Sumanth Chinthagunta
 
Painless JavaScript Testing with Jest
Painless JavaScript Testing with JestPainless JavaScript Testing with Jest
Painless JavaScript Testing with Jest
Michał Pierzchała
 
Automated Testing in Angular Slides
Automated Testing in Angular SlidesAutomated Testing in Angular Slides
Automated Testing in Angular Slides
Jim Lynch
 
Automation testing with Drupal 8
Automation testing with Drupal 8Automation testing with Drupal 8
Automation testing with Drupal 8
nagpalprachi
 
Codeception presentation
Codeception presentationCodeception presentation
Codeception presentation
Andrei Burian
 
JavaFX8 TestFX - CDI
JavaFX8   TestFX - CDIJavaFX8   TestFX - CDI
JavaFX8 TestFX - CDI
Sven Ruppert
 
Desktop|Embedded Application API JSR
Desktop|Embedded Application API JSRDesktop|Embedded Application API JSR
Desktop|Embedded Application API JSR
Andres Almiray
 
Unit-testing and E2E testing in JS
Unit-testing and E2E testing in JSUnit-testing and E2E testing in JS
Unit-testing and E2E testing in JS
Michael Haberman
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha Touch
Mats Bryntse
 

What's hot (20)

Testing in AngularJS
Testing in AngularJSTesting in AngularJS
Testing in AngularJS
 
Protractor framework architecture with example
Protractor framework architecture with exampleProtractor framework architecture with example
Protractor framework architecture with example
 
Automated php unit testing in drupal 8
Automated php unit testing in drupal 8Automated php unit testing in drupal 8
Automated php unit testing in drupal 8
 
AngularJS Unit Test
AngularJS Unit TestAngularJS Unit Test
AngularJS Unit Test
 
Selenium using Java
Selenium using JavaSelenium using Java
Selenium using Java
 
Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8Test all the things! Automated testing with Drupal 8
Test all the things! Automated testing with Drupal 8
 
Dart for Java Developers
Dart for Java DevelopersDart for Java Developers
Dart for Java Developers
 
Polyglot automation - QA Fest - 2015
Polyglot automation - QA Fest - 2015Polyglot automation - QA Fest - 2015
Polyglot automation - QA Fest - 2015
 
Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to Protractor
 
Breaking free from static abuse in test automation frameworks and using Sprin...
Breaking free from static abuse in test automation frameworks and using Sprin...Breaking free from static abuse in test automation frameworks and using Sprin...
Breaking free from static abuse in test automation frameworks and using Sprin...
 
Automated Smoke Tests with Protractor
Automated Smoke Tests with ProtractorAutomated Smoke Tests with Protractor
Automated Smoke Tests with Protractor
 
Single Page Applications with AngularJS 2.0
Single Page Applications with AngularJS 2.0 Single Page Applications with AngularJS 2.0
Single Page Applications with AngularJS 2.0
 
Painless JavaScript Testing with Jest
Painless JavaScript Testing with JestPainless JavaScript Testing with Jest
Painless JavaScript Testing with Jest
 
Automated Testing in Angular Slides
Automated Testing in Angular SlidesAutomated Testing in Angular Slides
Automated Testing in Angular Slides
 
Automation testing with Drupal 8
Automation testing with Drupal 8Automation testing with Drupal 8
Automation testing with Drupal 8
 
Codeception presentation
Codeception presentationCodeception presentation
Codeception presentation
 
JavaFX8 TestFX - CDI
JavaFX8   TestFX - CDIJavaFX8   TestFX - CDI
JavaFX8 TestFX - CDI
 
Desktop|Embedded Application API JSR
Desktop|Embedded Application API JSRDesktop|Embedded Application API JSR
Desktop|Embedded Application API JSR
 
Unit-testing and E2E testing in JS
Unit-testing and E2E testing in JSUnit-testing and E2E testing in JS
Unit-testing and E2E testing in JS
 
Testing Ext JS and Sencha Touch
Testing Ext JS and Sencha TouchTesting Ext JS and Sencha Touch
Testing Ext JS and Sencha Touch
 

Viewers also liked

Why vREST?
Why vREST?Why vREST?
Why vREST?
vrest_io
 
Blazing Performance with Flame Graphs
Blazing Performance with Flame GraphsBlazing Performance with Flame Graphs
Blazing Performance with Flame Graphs
Brendan Gregg
 
Algorithmic Music Recommendations at Spotify
Algorithmic Music Recommendations at SpotifyAlgorithmic Music Recommendations at Spotify
Algorithmic Music Recommendations at Spotify
Chris Johnson
 
Music Recommendations at Scale with Spark
Music Recommendations at Scale with SparkMusic Recommendations at Scale with Spark
Music Recommendations at Scale with Spark
Chris Johnson
 
Scala Data Pipelines for Music Recommendations
Scala Data Pipelines for Music RecommendationsScala Data Pipelines for Music Recommendations
Scala Data Pipelines for Music Recommendations
Chris Johnson
 
Introduction to Functional Programming with Scala
Introduction to Functional Programming with ScalaIntroduction to Functional Programming with Scala
Introduction to Functional Programming with Scala
pramode_ce
 

Viewers also liked (6)

Why vREST?
Why vREST?Why vREST?
Why vREST?
 
Blazing Performance with Flame Graphs
Blazing Performance with Flame GraphsBlazing Performance with Flame Graphs
Blazing Performance with Flame Graphs
 
Algorithmic Music Recommendations at Spotify
Algorithmic Music Recommendations at SpotifyAlgorithmic Music Recommendations at Spotify
Algorithmic Music Recommendations at Spotify
 
Music Recommendations at Scale with Spark
Music Recommendations at Scale with SparkMusic Recommendations at Scale with Spark
Music Recommendations at Scale with Spark
 
Scala Data Pipelines for Music Recommendations
Scala Data Pipelines for Music RecommendationsScala Data Pipelines for Music Recommendations
Scala Data Pipelines for Music Recommendations
 
Introduction to Functional Programming with Scala
Introduction to Functional Programming with ScalaIntroduction to Functional Programming with Scala
Introduction to Functional Programming with Scala
 

Similar to Scala for Test Automation

Java Notes by C. Sreedhar, GPREC
Java Notes by C. Sreedhar, GPRECJava Notes by C. Sreedhar, GPREC
Java Notes by C. Sreedhar, GPREC
Sreedhar Chowdam
 
Java Notes
Java Notes Java Notes
Java Notes
Sreedhar Chowdam
 
Beyond Unit Testing
Beyond Unit TestingBeyond Unit Testing
Beyond Unit Testing
Steve Loughran
 
Unit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJSUnit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJS
Knoldus Inc.
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
ciklum_ods
 
SCULPT! YOUR! TESTS!
SCULPT! YOUR! TESTS!SCULPT! YOUR! TESTS!
SCULPT! YOUR! TESTS!
Taras Oleksyn
 
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Paul King
 
Java Performance Tuning
Java Performance TuningJava Performance Tuning
Java Performance Tuning
Minh Hoang
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
Yakov Fain
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
Amit Tyagi
 
2010 07-28-testing-zf-apps
2010 07-28-testing-zf-apps2010 07-28-testing-zf-apps
2010 07-28-testing-zf-apps
Venkata Ramana
 
Java Magazine : The JAVA Virtual Machine alternative languages
Java Magazine : The JAVA Virtual Machine alternative languagesJava Magazine : The JAVA Virtual Machine alternative languages
Java Magazine : The JAVA Virtual Machine alternative languages
Erik Gur
 
Testing And Drupal
Testing And DrupalTesting And Drupal
Testing And Drupal
Peter Arato
 
Java/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCJava/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBC
FAKHRUN NISHA
 
Batch Applications for the Java Platform
Batch Applications for the Java PlatformBatch Applications for the Java Platform
Batch Applications for the Java Platform
Sivakumar Thyagarajan
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
Thierry Wasylczenko
 
What is Java? Presentation On Introduction To Core Java By PSK Technologies
What is Java? Presentation On Introduction To Core Java By PSK TechnologiesWhat is Java? Presentation On Introduction To Core Java By PSK Technologies
What is Java? Presentation On Introduction To Core Java By PSK Technologies
PSK Technolgies Pvt. Ltd. IT Company Nagpur
 
OTN Tour 2013: What's new in java EE 7
OTN Tour 2013: What's new in java EE 7OTN Tour 2013: What's new in java EE 7
OTN Tour 2013: What's new in java EE 7
Bruno Borges
 
Good Practices On Test Automation
Good Practices On Test AutomationGood Practices On Test Automation
Good Practices On Test Automation
Gustavo Labbate Godoy
 
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
jaxLondonConference
 

Similar to Scala for Test Automation (20)

Java Notes by C. Sreedhar, GPREC
Java Notes by C. Sreedhar, GPRECJava Notes by C. Sreedhar, GPREC
Java Notes by C. Sreedhar, GPREC
 
Java Notes
Java Notes Java Notes
Java Notes
 
Beyond Unit Testing
Beyond Unit TestingBeyond Unit Testing
Beyond Unit Testing
 
Unit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJSUnit Testing and Coverage for AngularJS
Unit Testing and Coverage for AngularJS
 
Bring the fun back to java
Bring the fun back to javaBring the fun back to java
Bring the fun back to java
 
SCULPT! YOUR! TESTS!
SCULPT! YOUR! TESTS!SCULPT! YOUR! TESTS!
SCULPT! YOUR! TESTS!
 
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
Industrial Strength Groovy - Tools for the Professional Groovy Developer: Pau...
 
Java Performance Tuning
Java Performance TuningJava Performance Tuning
Java Performance Tuning
 
Intro to JavaScript
Intro to JavaScriptIntro to JavaScript
Intro to JavaScript
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
 
2010 07-28-testing-zf-apps
2010 07-28-testing-zf-apps2010 07-28-testing-zf-apps
2010 07-28-testing-zf-apps
 
Java Magazine : The JAVA Virtual Machine alternative languages
Java Magazine : The JAVA Virtual Machine alternative languagesJava Magazine : The JAVA Virtual Machine alternative languages
Java Magazine : The JAVA Virtual Machine alternative languages
 
Testing And Drupal
Testing And DrupalTesting And Drupal
Testing And Drupal
 
Java/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBCJava/Servlet/JSP/JDBC
Java/Servlet/JSP/JDBC
 
Batch Applications for the Java Platform
Batch Applications for the Java PlatformBatch Applications for the Java Platform
Batch Applications for the Java Platform
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 
What is Java? Presentation On Introduction To Core Java By PSK Technologies
What is Java? Presentation On Introduction To Core Java By PSK TechnologiesWhat is Java? Presentation On Introduction To Core Java By PSK Technologies
What is Java? Presentation On Introduction To Core Java By PSK Technologies
 
OTN Tour 2013: What's new in java EE 7
OTN Tour 2013: What's new in java EE 7OTN Tour 2013: What's new in java EE 7
OTN Tour 2013: What's new in java EE 7
 
Good Practices On Test Automation
Good Practices On Test AutomationGood Practices On Test Automation
Good Practices On Test Automation
 
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
Java EE 7 Platform: Boosting Productivity and Embracing HTML5 - Arun Gupta (R...
 

Recently uploaded

Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
Remote DBA Services
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
Hornet Dynamics
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
XfilesPro
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 
fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.
AnkitaPandya11
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
Sven Peters
 
Liberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptxLiberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptx
Massimo Artizzu
 
zOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL DifferenceszOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL Differences
YousufSait3
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
kalichargn70th171
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
dakas1
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
Marcin Chrost
 
UI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design SystemUI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design System
Peter Muessig
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
Bert Jan Schrijver
 
YAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring detailsYAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring details
NishanthaBulumulla1
 

Recently uploaded (20)

Oracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptxOracle Database 19c New Features for DBAs and Developers.pptx
Oracle Database 19c New Features for DBAs and Developers.pptx
 
E-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet DynamicsE-commerce Development Services- Hornet Dynamics
E-commerce Development Services- Hornet Dynamics
 
Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
Everything You Need to Know About X-Sign: The eSign Functionality of XfilesPr...
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 
fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.fiscal year variant fiscal year variant.
fiscal year variant fiscal year variant.
 
Microservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we workMicroservice Teams - How the cloud changes the way we work
Microservice Teams - How the cloud changes the way we work
 
Liberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptxLiberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptx
 
zOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL DifferenceszOS Mainframe JES2-JES3 JCL-JECL Differences
zOS Mainframe JES2-JES3 JCL-JECL Differences
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
The Key to Digital Success_ A Comprehensive Guide to Continuous Testing Integ...
 
一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理一比一原版(USF毕业证)旧金山大学毕业证如何办理
一比一原版(USF毕业证)旧金山大学毕业证如何办理
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !Enums On Steroids - let's look at sealed classes !
Enums On Steroids - let's look at sealed classes !
 
UI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design SystemUI5con 2024 - Bring Your Own Design System
UI5con 2024 - Bring Your Own Design System
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
 
YAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring detailsYAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring details
 

Scala for Test Automation

  • 1. © 2014, Conversant, Inc. All rights reserved. PRESENTED BY 6/1/15 Ultimate Automation - ScalaTest Software Test Automation on JVM Platform lRajesh Thanavarapu
  • 2. © 2014, Conversant, Inc. All rights reserved. Software Test Automation “In software testing, test automation is the use of special software (separate from the software being tested) to control the execution of tests and the comparison of actual outcomes with predicted outcomes.[1] Test automation can automate some repetitive but necessary tasks in a formalized testing process already in place, or add additional testing that would be difficult to perform manually.” - From Wikipedia, the free encyclopedia
  • 3. © 2014, Conversant, Inc. All rights reserved. Test Automation Classification * Code-driven Test Automation * GUI Test Automation * API Test Automation <- Topic of discussion
  • 4. © 2014, Conversant, Inc. All rights reserved. Ultimate Automation Tool * Associate Tests with Specs * Facilitates simplistic Test design * Provides complete Data abstraction * Documentation that is up to date * Allows for easy enhancements * Provides visibility to all teams – Business, Prod, Dev, QA & The Management
  • 5. © 2014, Conversant, Inc. All rights reserved. Too Many Names TDD ATDD BDD FDD DDD MDD R2D2 C3PO
  • 6. © 2014, Conversant, Inc. All rights reserved. Specification Testing * One Source - Tests, Specs, Documentation, Reports * Everybody wins – Stake holders, Business, Product, Developers & Testers
  • 7. © 2014, Conversant, Inc. All rights reserved. Scala * Shares the JVM Space * JIT Compiled and Bytecode * Supports both OOP & FP * Higher Order Language * Aggressive Road map – Java 8 * Complete Maven Integration * BSD Licensed
  • 8. © 2014, Conversant, Inc. All rights reserved. Java => Scala Improvements: A non-unified type system (primitives vs. objects), type erasure (polymorphism), and checked exceptions. Additions: Functional programming concepts- type inference, anonymous functions (closures), lazy initialization etc.
  • 9. © 2014, Conversant, Inc. All rights reserved. Scala Is Concise Java public class Person { private String firstName; private String lastName; // Let's not forget the getters and setters OK? Person(String firstName, String lastName) { this.firstName=firstName; this.lastName=lastName; } } Scala class Person(firstName:String, lastName:String)
  • 10. © 2014, Conversant, Inc. All rights reserved. Scala Is Implicit Java public class ClassicSingleton { private static ClassicSingleton instance = null; protected ClassicSingleton() { // Exists only to defeat instantiation. } public static ClassicSingleton getInstance() { if(instance == null) { instance = new ClassicSingleton(); } return instance; } } Scala Object ClassicSingleton{ }
  • 11. © 2014, Conversant, Inc. All rights reserved. Scala Is True FP Lambda Expressions val even = ( x :Int ) => { X % 2 == 0 } even(7) Output: false Theory Var res=f(x) Var res=f(x) + (f(y) + f(z)) Var res=f(x)=f(a) * f(b) Best Curry(ing) in town...
  • 12. © 2014, Conversant, Inc. All rights reserved. Scala better than Java? Scala will not replace Java, but it truly Compliments!!
  • 13. © 2014, Conversant, Inc. All rights reserved. Big Companies using Scala
  • 14. © 2014, Conversant, Inc. All rights reserved. ScalaTest * API based on Scala – external jar * Simple and English like DSL * Traits for everyone (Java 8 mixin) FeatureSpec FlatSpec FunSpec and more...
  • 15. © 2014, Conversant, Inc. All rights reserved. Trait FeatureSpec class SampleClass extends FeatureSpec { feature("The user can pop an element off the top of the stack") { scenario("pop is invoked on a non-empty stack") (pending) scenario("pop is invoked on an empty stack"){ … } ignore("pop is invoked on an empty stack") { … } } }
  • 16. © 2014, Conversant, Inc. All rights reserved. Impl. Detailsprotected def feature(description: String)(fun: => Unit) { try { registerNestedBranch(Resources.feature(...), fun,...) } catch { case e: exceptions.TestFailedException => throw new exceptions.(...) ... } } protected def scenario(specText: String, testTags: Tag*)(testFun: FixtureParam => Registeration { engine.registerTest(Resources.scenario(...) } protected def ignore(specText: String, testTags: Tag*)(testFun: FixtureParam => Registeration) { engine.registerIgnoredTest(...) }
  • 17. © 2014, Conversant, Inc. All rights reserved. Trait FunSpec class SampleClass extends FunSpec { describe("A Set") { describe("when empty") { it("should have size 0") { assert(Set.empty.size == 0) } it("should produce NoSuchElementException when head is invoked") { intercept[NoSuchElementException] { Set.empty.head } } } }
  • 18. © 2014, Conversant, Inc. All rights reserved. Trait FlatSpec class SampleClass extends FlatSpec { "An empty Set" should "have size 0" in { assert(Set.empty.size == 0) } it should "produce NoSuchElementException when head is invoked" in { intercept[NoSuchElementException] { Set.empty.head } } }
  • 19. © 2014, Conversant, Inc. All rights reserved. Many Styles to Choose http://scalatest.org/user_guide /selecting_a_style
  • 20. © 2014, Conversant, Inc. All rights reserved. Test Development * Define a comprehensive list of test Scenarios * Initially write all tests as “Pending” * Incrementally add test code (worker methods) Language of choice: Scala, Java or Both * Review test results * Add more test Scenarios...
  • 21. © 2014, Conversant, Inc. All rights reserved. Sample Code feature("Block user from registering to listed promotion codes") { scenario("User should be blocked for a listed promo code and listed company") { var code = blockReg.testPromoBlockCommand(5050, 77) code should be("22") } scenario("User should not be blocked for a unlisted promo code and listed company") { var code = blockReg.testPromoBlockCommand(5050, 123) code should not be ("22") } scenario("User should not be blocked for a listed promo code and unlisted company") { var code = blockReg.testPromoBlockCommand(5318, 77) code should not be ("22") } scenario("User should not be blocked for a unlisted promo code and unlisted company") { var code = blockReg.testPromoBlockCommand(5318, 123) code should not be ("22") }
  • 22. © 2014, Conversant, Inc. All rights reserved. Scala Runner $ scala -cp scalatest_2.11-2.2.4.jar org.scalatest.run ExampleSpec Discovery starting. Discovery completed in 21 milliseconds. Run starting. Expected test count is: 2 ExampleSpec: A Stack - should pop values in last-in-first-out order - should throw NoSuchElementException if an empty stack is popped Run completed in 76 milliseconds. Total number of tests run: 2 Suites: completed 1, aborted 0 Tests: succeeded 2, failed 0, canceled 0, ignored 0, pending 0 All tests passed.
  • 23. © 2014, Conversant, Inc. All rights reserved. Reporting Note: This report is generated by the FREE Scala Plugin of Intellij
  • 24. © 2014, Conversant, Inc. All rights reserved. References / Links http://www.scala-lang.org/download/ http://scalatest.org/download http://doc.scalatest.org/2.2.4/index.html#org.scalatest.package http://www.scala-lang.org/api/current/#package http://scala-tools.org/mvnsites/maven-scala-plugin/ Downloads Guides Plugin
  • 25. © 2014, Conversant, Inc. All rights reserved. Q&A Pls send your questions and comments to rthanavarapu@conversantmedia.com