30 Days of Automation in Testing Day 15: Find and share your thoughts on Java Script Testing tool

10 Java -Script Testing Tool

  1. Blue Ridge – JavaScript Testing Framework-The Plugin adds support for command-line and in-browser JS unit tests to your Rails app.

  2. SugarTest – JavaScript Testing makes it easy to write elegant and understandable JavaScript tests. Its API is inspired by both RSpec, Shoulda and jQuery. It works as a DSL running on top of JsUnitTest.

  3. FireUnit – FireUnit is Java Script Unit Testing Extension provides a simple JavaScript API for doing simple test logging and viewing within a new tab of Firebug. FireUnit is a Firefox/Firebug extension.

  4. JSLint – JSLint is JavaScript Code Quality Tool takes a JavaScript source and scans it – if it finds a problem, it returns a message describing the problem and an approximate location within the source.

  5. QUnit – QUnit is an easy-to-use JavaScript test suite. It’s used by the jQuery project to test its code and plugins but is capable of testing any generic JavaScript code.

  6. JSpec-Is an extremely small, yet very powerful testing framework. Utilizing its own custom grammar and pre-processor, JSpec can operate in ways that no other JavaScript testing framework can.

  7. JSLitmus-Is a lightweight tool for creating ad-hoc JavaScript benchmark tests.

  8. Selenium – JavaScript Web Application Security Testing Tool Is a test tool for web applications that tests run directly in a browser just as real users do. Supports Internet Explorer, Mozilla and Firefox on Windows, Linux, and Macintosh.

  9. Watir (pronounced water)-Is an open-source (BSD) family of Ruby libraries for automating web browsers. It allows you to write tests that are easy to read and maintain. It is simple and flexible.

  10. Sahi -Is a mature, business-ready tool for automation of web application testing. Sahi runs on any modern browser which supports JavaScript.

As you know JavaScript is used in almost all web applications. As the applications grow, JavaScript also increases in size and complexity. In such case, it becomes a difficult task for Testers to test the web application for various scenarios.

Sometimes it is difficult to capture the web elements in AngularJS applications using JUnit orSelenium WebDriver.

Protractor is a NodeJS program which is written in JavaScript and runs with Node to identify the web elements in AngularJS applications, and it also uses WebDriver to control the browser with user actions.

It’s easy to use. Let’s try Protractor in the first time at: https://www.guru99.com/protractor-testing.html

1 Like

JS tool - Sahi (https://sahipro.com).I like using Sahi as it doesn’t require all the webdriver fuctions calls. It uses in-built API calls so in minutes your first UI tests are up and running.
Also, its more stable and hardly fails for element not found and requires no additional wait statements. It has got record-play to quickly write the tests and also provides API calls for scripting making it interesting for programmers as well.

Adding the twitter participants:

@vic said:

It’s easy to use. Let’s try Protractor in the first time at: Protractor Testing Tutorial: Automation Tool Framework

This is great, because I was also unfamiliar with node, which I am always hearing about. Scratch that off my “things I need to know about” list. I am also learning JS right now, so this is perfect.

So, downloaded, installed node. Did my first “Hello World!” and yay!

Already had selenium. Installed protractor. DONE.

[Some problems with JAVA_HOME variable and some swearing and rebooting happened here]

And, per the tutorial, I ran my first test!

image

Well, that’s not much to look at. There’s more depth including reporting I can get into. But I at least begin to feel I’ve been exposed to a new tool.

Thanks again @vic for the suggestion.

-Dave K

1 Like

Not a space I’m that strong in, however, I’ve paired with Mark on building some interesting things for our AiT class.

My context for these suggestions, is creating automated checks at the JS layer.
The tools we used to do this:

  • Jest - Delightful JavaScript Testing. A JS testing framework created by Facebook for specifically testing React applications. You can see an example in our Restful Booker Platform solution.
  • Enyzme - Another React tool this time created by the folk at AirBnb.
  • Jasmine - Built by Pivotal Labs it brings Gherkin syntax to the world of JS testing
  • JSDOM - It provides a virtual dom, allowing you to inject files and libraries, and test JS methods away from a browser.
  • Chai - Chai is an assertion library written in JS. Think of it like Hamcrest in the Java world.
  • Mocha - Mocha is a test framework/runner for JS. Think of it like JUnit/Nunit for JS.

It’s a really exciting time to be testing at the Javascript seam. I strongly encourage folk who haven’t dabble in it yet to do so. A great mnemonic for finding where you can utilise these JS testing tools is TuTTu, created by Mark. TuTTu stands for ‘Testing the UI, or testing through the UI’. Often we are testing things on the UI that could be done lower, ask this of your checks and see what opportunities you come across.

I’ve written about this in another post Find-use-and-share-your-thoughts-on-a-web-ui-testing-tool … but I have found codeceptJS to be a very simple, flexible, and reliable JS tool to use.

  • The syntax is written in a simple BDD-type of language. Your test will read something like,

When I open (web page),
I see (some text),
I click (some button)

  • Set up for a project takes mere minutes and tests run at lightning speed compared with other frameworks I’ve used.
  • You can collect all the page objects as a list of objects in an array and reference the page and the object accordingly.
  • On the same page as the page objects, you can create simple functions then call them later, in the test which makes the code easier to read, and easier to maintain.
  • The learning-curve is minimal, and virtually non-existent for those of you versed in JS or other flavors like PhantomJS or Mocha/Chai.

As a noOb I found codeceptJS to be super-intuitive and after getting acclimated to some of the commands (and there are so many), I found the framework to be very reliable.

Devs liked it as it requires minimal overhead with regards to integrating into the build pipeline (compared with some other frameworks I’ve researched).

can’t recommend this enough

I had a chance to work in couple weeks on Protrator which is a NodeJS program and written in JavaScript and runs with Node to identify the web elements
Testing guide: https://www.guru99.com/protractor-testing.html

Why and when do we use protractor when we already have Selenium WebDriver?

Angular JS applications have some extra HTML attributes like ng-repeater, ng-controller, ng-model…, etc. which are not included in Selenium locators. Selenium is not able to identify those web elements using Selenium code. So, Protractor on the top of Selenium can handle and controls those attributes in Web Applications.

The protractor is an end to end testing framework for Angular JS based applications. While most frameworks focus on conducting unit tests for Angular JS applications, Protractor focuses on testing the actual functionality of an application.

Checkout this link to learn more about protractor: https://qakumar.wordpress.com/2018/07/22/day-15-find-and-share-your-thoughts-on-java-script-testing-tool/

When you thinking of automating using Javascript then the first thing comes to mind is Selenium Webdriver. But wait, let’s take a minute and think its with other option is Protractor.

Check it out here: https://www.protractortest.org/#/tutorial