www.webdeveloper.com
Results 1 to 4 of 4

Thread: Unit testing tool for Javascript applications

  1. #1
    Join Date
    Sep 2013
    Posts
    3

    Unit testing tool for Javascript applications

    Hello..
    Could someone please tell me whether I can use Java Language to develop an automatic unit testing tool for Javascript functions or whether I should go for Javascript itself?
    And may I please know all difficulties I might face if I would be using Java instead of Javascript itself to develop the testing tool.

    Many many thanks

  2. #2
    Join Date
    Feb 2003
    Location
    Michigan, USA
    Posts
    5,755
    The decision to unit test your JavaScript application with Java or JavaScript really depends on how the JavaScript application is architected.

    The technically correct answer is "No, you cannot unit test JavaScript with Java" because they are different languages and platforms. You can use Java to perform functional testing on your JavaScript application, though. Check out Selenium, which allows you to programmatically control a web browser with Java code.

    If you want to do true unit testing, where you isolate one component in your JavaScript application, then check out Jasmine. It is an RSpec style unit testing framework for JavaScript. I've used it quite a bit and I really like it.

  3. #3
    Join Date
    Sep 2013
    Posts
    3
    Hi dear, thanks for the reply.


    My project is to develop an automatic unit testing tool for JavaScript and I was thinking of developing the tool on an another language like Java since all the existing ones are in JavaScript itself. It would not be of anything new if I was to do it in JavaScript itself.

    But is there any specific reason why all existing unit testing tools like Jasmine, QUnit and all have been developed in JavaScript itself and not any other language?

    Since JavaScript is a client-side it might be better and/or easier to write the Unit tests in another language. I also found out that I'll at least need to use Javascript to do the Submits and function calls.

  4. #4
    Join Date
    Feb 2003
    Location
    Michigan, USA
    Posts
    5,755
    The purpose of a unit test is to test code. You cannot verify JavaScript is functioning properly by writing Java.

    If you want to test JavaScript code, you need to write tests in JavaScript.

    If you want to test PHP, you need to write your tests in PHP.

    It would be like validating that an airplane can fly by throwing a rock. They are completely different things.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles