SlideShare una empresa de Scribd logo
1 de 10
Descargar para leer sin conexión
On FxJsJUnit
an idea to test JavaScript codes with JUnit
and JavaFX
Who writes this document?
● Name : mike_neck (Twitter @mike_neck)
● Jobs : No Jobs now!
  ○ If someone provide me a chance to have an
    opportunity, I will try it! So ask me!
● Technologies :
  ○   Groovy
  ○   JavaScript
  ○   Java
  ○   Erlang
● Interested in : Concurrent Programings
What's the Fx-Js-JUnit?
● An library for testing JavaScript with Type
  safe assertion.
● Applied JavaFX's WebEngine as a
  JavaScript Environment.
● Based on these ideas and environment, we
  can test for JavaScript with JUnit, most
  popular testing framework.
Usage of Fx-Js-JUnit - the sample
code. - (1) Preparation for test.

@ClassRule
public static FxJsJUnit fxJsJUnit
  = FxJsJUnit.option(CoreExtension.class)
       .address("http://www.oracle.com")
       .identifiedBy(WebTest.class)
       .get();
Usage of Fx-Js-JUnit - the sample
code. - (2) getting IF for WebEngine.

private JsJUnit jsJUnit;


@Before
public void getTester() {
    jsJUnit = fxJsJUnit.getTester();
}
Usage of Fx-Js-JUnit - the sample
code. - (3) calling JavaScript code.

@Test
public void testStringTest () {
    String result = jsJUnit.callAsString(
         "$('#input').text;"
    );
    assertThat(result, is ("Input Here!"));
}
Off course you can assert Plain Old
JavaScript Object with POJO.
@Test
public void personInitialization () {
    Person person = new Person();
    person.setName("mike");
    person.setAge(35);
    Person mike = jsJUnit.callAs(
       "new Person('mike', 35)", Person.class);
    assertThat(mike, is(person));
}
Architecture of Fx-Js-JUnit
                         4.call-function
                                      Test
   JavaFx
                         4.call-function
                     JsJUnit          Test
               5. call
   WebEngine             4.call-function
                                      Test
        1.Launch         2.Prepare 3.execute

                   JUnit
TODOs and Problems/Difficulties
● Embbed Web Servers (Static Web Server)
  /Servlet Containers (Tomcat / Jetty) /Java
  EE Containers (Glassfish) to test total
  Enterprise Application (TODO)
● Fx-Js-JUnit cannot be applied Concurrent
  Test Execution. Because JavaFX cannot be
  launched simultaneously and multiple times
  without restart JVM(. It requires modification
  of JUnit framework). (Problem/Difficulty)
   ○ to avoid this problem I'm going to develop gradle-
     fxjsjunit-plugin and Jenkins-fsjsjunit-plugin.
Thank you for your attention.
Available resources ...
● GitHub
   ○ https://github.com/mike-neck/FxJsJUnit
● Another documents
   ○ http://www.slideshare.net/mikeneck/unit-testing-
     java-script-with-javafx
      ■ (I'm sorry this document is written in Japanese.)

Más contenido relacionado

La actualidad más candente

GTAC Boosting your Testing Productivity with Groovy
GTAC Boosting your Testing Productivity with GroovyGTAC Boosting your Testing Productivity with Groovy
GTAC Boosting your Testing Productivity with Groovy
Andres Almiray
 
Mis Conceptions About The Tiny Java
Mis Conceptions About The Tiny JavaMis Conceptions About The Tiny Java
Mis Conceptions About The Tiny Java
Sultan Jokhio
 
Mockito vs JMockit, battle of the mocking frameworks
Mockito vs JMockit, battle of the mocking frameworksMockito vs JMockit, battle of the mocking frameworks
Mockito vs JMockit, battle of the mocking frameworks
EndranNL
 
Introduction to AndroidMock
Introduction to AndroidMockIntroduction to AndroidMock
Introduction to AndroidMock
Li-Wei Cheng
 

La actualidad más candente (20)

Meta Programming in Groovy
Meta Programming in GroovyMeta Programming in Groovy
Meta Programming in Groovy
 
Groovy intro
Groovy introGroovy intro
Groovy intro
 
Javascript under the hood 2
Javascript under the hood 2Javascript under the hood 2
Javascript under the hood 2
 
Android testing
Android testingAndroid testing
Android testing
 
GTAC Boosting your Testing Productivity with Groovy
GTAC Boosting your Testing Productivity with GroovyGTAC Boosting your Testing Productivity with Groovy
GTAC Boosting your Testing Productivity with Groovy
 
Mis Conceptions About The Tiny Java
Mis Conceptions About The Tiny JavaMis Conceptions About The Tiny Java
Mis Conceptions About The Tiny Java
 
Javaone2008 Bof 5101 Groovytesting
Javaone2008 Bof 5101 GroovytestingJavaone2008 Bof 5101 Groovytesting
Javaone2008 Bof 5101 Groovytesting
 
Mockito vs JMockit, battle of the mocking frameworks
Mockito vs JMockit, battle of the mocking frameworksMockito vs JMockit, battle of the mocking frameworks
Mockito vs JMockit, battle of the mocking frameworks
 
Introduction to AndroidMock
Introduction to AndroidMockIntroduction to AndroidMock
Introduction to AndroidMock
 
JMockit
JMockitJMockit
JMockit
 
Test Driven Development iOS에 적용해보기
Test Driven Development  iOS에 적용해보기Test Driven Development  iOS에 적용해보기
Test Driven Development iOS에 적용해보기
 
Session 13 - Exception handling - continued
Session 13 - Exception handling - continuedSession 13 - Exception handling - continued
Session 13 - Exception handling - continued
 
Unit Testing Android Application
Unit Testing Android ApplicationUnit Testing Android Application
Unit Testing Android Application
 
Groovy AST Demystified
Groovy AST DemystifiedGroovy AST Demystified
Groovy AST Demystified
 
Working With Legacy Code
Working With Legacy CodeWorking With Legacy Code
Working With Legacy Code
 
Ast transformation
Ast transformationAst transformation
Ast transformation
 
Javascript under the hood 1
Javascript under the hood 1Javascript under the hood 1
Javascript under the hood 1
 
Mockito with a hint of PowerMock
Mockito with a hint of PowerMockMockito with a hint of PowerMock
Mockito with a hint of PowerMock
 
Writing testable code
Writing testable codeWriting testable code
Writing testable code
 
Groovy AST Transformations
Groovy AST TransformationsGroovy AST Transformations
Groovy AST Transformations
 

Destacado

Study guidechap03
Study guidechap03Study guidechap03
Study guidechap03
As Sastry
 
Kemiskinan Multidimensi
Kemiskinan MultidimensiKemiskinan Multidimensi
Kemiskinan Multidimensi
Munzami Hs
 
Acctg Information systems for PG StudentsPresentation1
Acctg Information systems for PG StudentsPresentation1Acctg Information systems for PG StudentsPresentation1
Acctg Information systems for PG StudentsPresentation1
As Sastry
 
Tolak BBM atau Terima BLT?
Tolak BBM atau Terima BLT?Tolak BBM atau Terima BLT?
Tolak BBM atau Terima BLT?
Munzami Hs
 
Aceh Butuh ''Sekolah''
Aceh Butuh ''Sekolah''Aceh Butuh ''Sekolah''
Aceh Butuh ''Sekolah''
Munzami Hs
 
World sparrows day mar 20, 2011
World sparrows day mar 20, 2011World sparrows day mar 20, 2011
World sparrows day mar 20, 2011
As Sastry
 

Destacado (14)

Study guidechap03
Study guidechap03Study guidechap03
Study guidechap03
 
Kemiskinan Multidimensi
Kemiskinan MultidimensiKemiskinan Multidimensi
Kemiskinan Multidimensi
 
Presentasi Biro Hukum Setda Aceh Prolega 2011 & Rencana Prolega 2012
Presentasi Biro Hukum Setda Aceh   Prolega 2011 & Rencana Prolega 2012Presentasi Biro Hukum Setda Aceh   Prolega 2011 & Rencana Prolega 2012
Presentasi Biro Hukum Setda Aceh Prolega 2011 & Rencana Prolega 2012
 
Chapt II-Acctg Information Systems
Chapt II-Acctg Information SystemsChapt II-Acctg Information Systems
Chapt II-Acctg Information Systems
 
World Heart Day 2011
World Heart Day 2011World Heart Day 2011
World Heart Day 2011
 
013
013013
013
 
Acctg Information systems for PG StudentsPresentation1
Acctg Information systems for PG StudentsPresentation1Acctg Information systems for PG StudentsPresentation1
Acctg Information systems for PG StudentsPresentation1
 
Tolak BBM atau Terima BLT?
Tolak BBM atau Terima BLT?Tolak BBM atau Terima BLT?
Tolak BBM atau Terima BLT?
 
20110426
2011042620110426
20110426
 
Aceh Butuh ''Sekolah''
Aceh Butuh ''Sekolah''Aceh Butuh ''Sekolah''
Aceh Butuh ''Sekolah''
 
How Well Are You
How Well Are YouHow Well Are You
How Well Are You
 
Ruu ap final (2010)
Ruu ap   final (2010)Ruu ap   final (2010)
Ruu ap final (2010)
 
Pemimpin STAF
Pemimpin STAFPemimpin STAF
Pemimpin STAF
 
World sparrows day mar 20, 2011
World sparrows day mar 20, 2011World sparrows day mar 20, 2011
World sparrows day mar 20, 2011
 

Similar a On fx jsj unit - an idea to test javascript codes with junit and javafx

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
 
The Power of the JVM: Applied Polyglot Projects with Java and JavaScript
The Power of the JVM: Applied Polyglot Projects with Java and JavaScriptThe Power of the JVM: Applied Polyglot Projects with Java and JavaScript
The Power of the JVM: Applied Polyglot Projects with Java and JavaScript
Hazelcast
 

Similar a On fx jsj unit - an idea to test javascript codes with junit and javafx (20)

Junit_.pptx
Junit_.pptxJunit_.pptx
Junit_.pptx
 
ikp321-04
ikp321-04ikp321-04
ikp321-04
 
Junit and testNG
Junit and testNGJunit and testNG
Junit and testNG
 
Lesson 2
Lesson 2Lesson 2
Lesson 2
 
Introduction to JUnit testing in OpenDaylight
Introduction to JUnit testing in OpenDaylightIntroduction to JUnit testing in OpenDaylight
Introduction to JUnit testing in OpenDaylight
 
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...
 
Alexey Buzdin "Maslow's Pyramid of Android Testing"
Alexey Buzdin "Maslow's Pyramid of Android Testing"Alexey Buzdin "Maslow's Pyramid of Android Testing"
Alexey Buzdin "Maslow's Pyramid of Android Testing"
 
Jest
JestJest
Jest
 
Java Course 6: Introduction to Agile
Java Course 6: Introduction to AgileJava Course 6: Introduction to Agile
Java Course 6: Introduction to Agile
 
Groovy Testing
Groovy TestingGroovy Testing
Groovy Testing
 
Whitebox testing of Spring Boot applications
Whitebox testing of Spring Boot applicationsWhitebox testing of Spring Boot applications
Whitebox testing of Spring Boot applications
 
The Power of the JVM: Applied Polyglot Projects with Java and JavaScript
The Power of the JVM: Applied Polyglot Projects with Java and JavaScriptThe Power of the JVM: Applied Polyglot Projects with Java and JavaScript
The Power of the JVM: Applied Polyglot Projects with Java and JavaScript
 
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
 
S314168 - What's New in Enterprise Java Bean Technology @ JavaOne Brazil 2010
S314168 - What's New in Enterprise Java Bean Technology @ JavaOne Brazil 2010S314168 - What's New in Enterprise Java Bean Technology @ JavaOne Brazil 2010
S314168 - What's New in Enterprise Java Bean Technology @ JavaOne Brazil 2010
 
Developer Test - Things to Know
Developer Test - Things to KnowDeveloper Test - Things to Know
Developer Test - Things to Know
 
Java Concurrency and Asynchronous
Java Concurrency and AsynchronousJava Concurrency and Asynchronous
Java Concurrency and Asynchronous
 
An Introduction To Unit Testing and TDD
An Introduction To Unit Testing and TDDAn Introduction To Unit Testing and TDD
An Introduction To Unit Testing and TDD
 
Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010
Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010
Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010
 
E2E testing con nightwatch.js - Drupalcamp Spain 2018
E2E testing con nightwatch.js  - Drupalcamp Spain 2018E2E testing con nightwatch.js  - Drupalcamp Spain 2018
E2E testing con nightwatch.js - Drupalcamp Spain 2018
 
Spock
SpockSpock
Spock
 

Más de Shinya Mochida

gradle2.4のルールベースモデルコンフィギュレーション
gradle2.4のルールベースモデルコンフィギュレーションgradle2.4のルールベースモデルコンフィギュレーション
gradle2.4のルールベースモデルコンフィギュレーション
Shinya Mochida
 

Más de Shinya Mochida (20)

サーバーサイド Kotlin のテストフレームワーク事情
サーバーサイド Kotlin のテストフレームワーク事情サーバーサイド Kotlin のテストフレームワーク事情
サーバーサイド Kotlin のテストフレームワーク事情
 
IntelliJ IDEA を完全にマスターする話
IntelliJ IDEA を完全にマスターする話IntelliJ IDEA を完全にマスターする話
IntelliJ IDEA を完全にマスターする話
 
クリーンアーキテクチャーを強制する方法を考えてみた(N番煎じ) #すえなみチャンス暑気払い
クリーンアーキテクチャーを強制する方法を考えてみた(N番煎じ) #すえなみチャンス暑気払いクリーンアーキテクチャーを強制する方法を考えてみた(N番煎じ) #すえなみチャンス暑気払い
クリーンアーキテクチャーを強制する方法を考えてみた(N番煎じ) #すえなみチャンス暑気払い
 
jjug-ccc 2019 Spring 発表資料 Collections Framework 入門 #jjug #jjug_ccc #ccc_c1
jjug-ccc 2019 Spring 発表資料 Collections Framework 入門 #jjug #jjug_ccc #ccc_c1jjug-ccc 2019 Spring 発表資料 Collections Framework 入門 #jjug #jjug_ccc #ccc_c1
jjug-ccc 2019 Spring 発表資料 Collections Framework 入門 #jjug #jjug_ccc #ccc_c1
 
swift-log について
swift-log についてswift-log について
swift-log について
 
Vim 入門
Vim 入門Vim 入門
Vim 入門
 
Java プログラマーのための Swift 入門 #中央線Meetup
Java プログラマーのための Swift 入門 #中央線MeetupJava プログラマーのための Swift 入門 #中央線Meetup
Java プログラマーのための Swift 入門 #中央線Meetup
 
swift-nio のアーキテクチャーと RxHttpClient
swift-nio のアーキテクチャーと RxHttpClientswift-nio のアーキテクチャーと RxHttpClient
swift-nio のアーキテクチャーと RxHttpClient
 
JJUG CCC 2018 Spring - I-7 (俺が)はじめての Netty
JJUG CCC 2018 Spring - I-7 (俺が)はじめての NettyJJUG CCC 2018 Spring - I-7 (俺が)はじめての Netty
JJUG CCC 2018 Spring - I-7 (俺が)はじめての Netty
 
JJUG CCC 2018 Spring LT Spring Boot アプリケーションの起動を速くする 108 の Tips #jjug_ccc #jjug
JJUG CCC 2018 Spring LT Spring Boot アプリケーションの起動を速くする 108 の Tips #jjug_ccc #jjugJJUG CCC 2018 Spring LT Spring Boot アプリケーションの起動を速くする 108 の Tips #jjug_ccc #jjug
JJUG CCC 2018 Spring LT Spring Boot アプリケーションの起動を速くする 108 の Tips #jjug_ccc #jjug
 
Spring Boot アプリケーションの起動をほんの少し気持ちだけ速くしてみた
Spring Boot アプリケーションの起動をほんの少し気持ちだけ速くしてみたSpring Boot アプリケーションの起動をほんの少し気持ちだけ速くしてみた
Spring Boot アプリケーションの起動をほんの少し気持ちだけ速くしてみた
 
Javaモジュールシステム雑なまとめ
Javaモジュールシステム雑なまとめJavaモジュールシステム雑なまとめ
Javaモジュールシステム雑なまとめ
 
Kotlin as an AltJS
Kotlin as an AltJSKotlin as an AltJS
Kotlin as an AltJS
 
JavaのStreamで学ぶ遅延処理実装パターン
JavaのStreamで学ぶ遅延処理実装パターンJavaのStreamで学ぶ遅延処理実装パターン
JavaのStreamで学ぶ遅延処理実装パターン
 
gradle2.4のルールベースモデルコンフィギュレーション
gradle2.4のルールベースモデルコンフィギュレーションgradle2.4のルールベースモデルコンフィギュレーション
gradle2.4のルールベースモデルコンフィギュレーション
 
On stream-lazy-computation
On stream-lazy-computationOn stream-lazy-computation
On stream-lazy-computation
 
Stream脳の作り方
Stream脳の作り方Stream脳の作り方
Stream脳の作り方
 
Java8のstreamをダラダラまとめてみる
Java8のstreamをダラダラまとめてみるJava8のstreamをダラダラまとめてみる
Java8のstreamをダラダラまとめてみる
 
ドラクエの金銭感覚
ドラクエの金銭感覚ドラクエの金銭感覚
ドラクエの金銭感覚
 
30億のデバイスで走るjavaを支えるjavaエコシステム
30億のデバイスで走るjavaを支えるjavaエコシステム30億のデバイスで走るjavaを支えるjavaエコシステム
30億のデバイスで走るjavaを支えるjavaエコシステム
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Último (20)

MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
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
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
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
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 

On fx jsj unit - an idea to test javascript codes with junit and javafx

  • 1. On FxJsJUnit an idea to test JavaScript codes with JUnit and JavaFX
  • 2. Who writes this document? ● Name : mike_neck (Twitter @mike_neck) ● Jobs : No Jobs now! ○ If someone provide me a chance to have an opportunity, I will try it! So ask me! ● Technologies : ○ Groovy ○ JavaScript ○ Java ○ Erlang ● Interested in : Concurrent Programings
  • 3. What's the Fx-Js-JUnit? ● An library for testing JavaScript with Type safe assertion. ● Applied JavaFX's WebEngine as a JavaScript Environment. ● Based on these ideas and environment, we can test for JavaScript with JUnit, most popular testing framework.
  • 4. Usage of Fx-Js-JUnit - the sample code. - (1) Preparation for test. @ClassRule public static FxJsJUnit fxJsJUnit = FxJsJUnit.option(CoreExtension.class) .address("http://www.oracle.com") .identifiedBy(WebTest.class) .get();
  • 5. Usage of Fx-Js-JUnit - the sample code. - (2) getting IF for WebEngine. private JsJUnit jsJUnit; @Before public void getTester() { jsJUnit = fxJsJUnit.getTester(); }
  • 6. Usage of Fx-Js-JUnit - the sample code. - (3) calling JavaScript code. @Test public void testStringTest () { String result = jsJUnit.callAsString( "$('#input').text;" ); assertThat(result, is ("Input Here!")); }
  • 7. Off course you can assert Plain Old JavaScript Object with POJO. @Test public void personInitialization () { Person person = new Person(); person.setName("mike"); person.setAge(35); Person mike = jsJUnit.callAs( "new Person('mike', 35)", Person.class); assertThat(mike, is(person)); }
  • 8. Architecture of Fx-Js-JUnit 4.call-function Test JavaFx 4.call-function JsJUnit Test 5. call WebEngine 4.call-function Test 1.Launch 2.Prepare 3.execute JUnit
  • 9. TODOs and Problems/Difficulties ● Embbed Web Servers (Static Web Server) /Servlet Containers (Tomcat / Jetty) /Java EE Containers (Glassfish) to test total Enterprise Application (TODO) ● Fx-Js-JUnit cannot be applied Concurrent Test Execution. Because JavaFX cannot be launched simultaneously and multiple times without restart JVM(. It requires modification of JUnit framework). (Problem/Difficulty) ○ to avoid this problem I'm going to develop gradle- fxjsjunit-plugin and Jenkins-fsjsjunit-plugin.
  • 10. Thank you for your attention. Available resources ... ● GitHub ○ https://github.com/mike-neck/FxJsJUnit ● Another documents ○ http://www.slideshare.net/mikeneck/unit-testing- java-script-with-javafx ■ (I'm sorry this document is written in Japanese.)