Your SlideShare is downloading. ×
0
On fx jsj unit - an idea to test javascript codes with junit and javafx
On fx jsj unit - an idea to test javascript codes with junit and javafx
On fx jsj unit - an idea to test javascript codes with junit and javafx
On fx jsj unit - an idea to test javascript codes with junit and javafx
On fx jsj unit - an idea to test javascript codes with junit and javafx
On fx jsj unit - an idea to test javascript codes with junit and javafx
On fx jsj unit - an idea to test javascript codes with junit and javafx
On fx jsj unit - an idea to test javascript codes with junit and javafx
On fx jsj unit - an idea to test javascript codes with junit and javafx
On fx jsj unit - an idea to test javascript codes with junit and javafx
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

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

452

Published on

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
452
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. On FxJsJUnitan idea to test JavaScript codes with JUnitand 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. Whats the Fx-Js-JUnit?● An library for testing JavaScript with Type safe assertion.● Applied JavaFXs 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 samplecode. - (1) Preparation for test.@ClassRulepublic static FxJsJUnit fxJsJUnit = FxJsJUnit.option(CoreExtension.class) .address("http://www.oracle.com") .identifiedBy(WebTest.class) .get();
  • 5. Usage of Fx-Js-JUnit - the samplecode. - (2) getting IF for WebEngine.private JsJUnit jsJUnit;@Beforepublic void getTester() { jsJUnit = fxJsJUnit.getTester();}
  • 6. Usage of Fx-Js-JUnit - the samplecode. - (3) calling JavaScript code.@Testpublic void testStringTest () { String result = jsJUnit.callAsString( "$(#input).text;" ); assertThat(result, is ("Input Here!"));}
  • 7. Off course you can assert Plain OldJavaScript Object with POJO.@Testpublic 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 Im 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 ■ (Im sorry this document is written in Japanese.)

×