addressalign-toparrow-leftarrow-leftarrow-right-10x10arrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcredit-cardcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobe--smallglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1languagelaunch-new-window--smalllight-bulblightning-boltlinklocation-pinlockm-swarmSearchmailmediummessagesminusmobilemoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstar-shapestartickettrashtriangle-downtriangle-uptwitteruserwarningyahooyoutube

Re: [jsmn] JavaScript Unit Testing?

From: Cjad E.
Sent on: Monday, July 27, 2015, 6:28 PM

I have an implementation that works well for our needs. Before we go full boat across our applications, I wanted to bounce it off others to see if there was a better, or more simplified approach.
In reading Testable JavaScript over the weekend, the author is implementing something very similar so I feel I am not far off a solid approach.
So here's an info dump on our implementation...

Our implementation for unit testing is:
QUnit scripts being injected in to our dynamic pages, Jenkins with Selenium Grid plugin as our test runner (opens browsers, logs in to app, navigates to pages and waits for textarea element to be populated, takes those results and creates XML files which Selenium sends to Jenkins and Jenkins automagically renders then on a Test Results page).
I have run YUITest, QUnit, and Mocha/Chai in this environment. - Mocha will not let me get JUnit results in a variable, only to the console, which is not useful and I cannot get both displayed and XML formats without writing my own logic off the 'suite end' event. I didn't feel like writing my own plugin for Mocha to do that and QUnit will display and allow me to save off the results easily.
The implementation handles the following types of tests: Unit, Functional, Integration, and by default Regression.

Here's our tech stack: Enterprise Java web app, Spring MVC, Apache Tiles, JSP's with JSTL's, YUI framework (switching to jQuery).

Our needs are:
1. Test in browser with all JSP's creating the pages. And web drivers often emulate browser functionality, but are not perfect.
2. Pre-commit testing - while developer is running code, tests should be able to run.
3. Post-commit/Post-deploy testing - after deploying to our enterprise development environment, test should be able to be run on demand.
4. #2 and #3 need to be the same set of scripts. Our skill-set is JavaScript for our front-end team.
5. We need to report out our unit tests to a web/wiki page or Jenkins for auditing.
6. Must run in IE11.

As far as do I have any code samples? Not right now, and my code is internal. I was thinking about creating a github or two sometime down the road which is also why I was checking to see if my solution is of value to the community.

Thoughts?
Hope this helps. Sorry for the long post.
-Chad

On Jul 27,[masked]:26 PM, "robert tomb" <[address removed]> wrote:
Chad:

Sorry, I don't know of any groups focused on JS unit testing, but unit testing would be great topic at this meetup! Do you have small, encapsulated bits of logic you want to test or are you looking for more of an integration test to see how your JS executes within the web page? Your mention of JSPs led me to think you're really looking for a way to test in browser, which probably means you have to have that servlet container running. (Which... in turn means a lot of sitting around waiting for things to start up.)

We should talk at the next meeting. I like to talk about the advantages and disadvantages of testing at various levels and how different architectures contribute to or resolve those problems.  :-)

--rt


 -------- __@ 
 ----- _`\<,_ 
 ---- (*)/ (*)
 ~~~~~~~~~~~~~~
robert tomb
[address removed]
twitter: @bikeonastick
http://bikeonastick.blogspot.com/


On Fri, Jul 24, 2015 at 10:35 PM, Cjad Elstad <[address removed]> wrote:

Anyone know of a good JS unit test group? In MN would be even better, but I'll take a good one anywhere.
I am looking to hear how others are handling JS unit testing with JSP's as well as hear what others are doing in a more enterprise space.
Thanks in advance,
-Chad





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Cjad Elstad ([address removed]) from JavaScriptMN.
To learn more about Cjad Elstad, visit his/her member profile
To report this message or block the sender, please click here
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, POB 4668 #37895 NY NY USA 10163 | [address removed]





--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by robert tomb ([address removed]) from JavaScriptMN.
To learn more about robert tomb, visit his/her member profile
To report this message or block the sender, please click here
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, POB 4668 #37895 NY NY USA 10163 | [address removed]

People in this
group are also in: