What is a pure in-browser JavaScript test framework? [closed] - javascript

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I want a unit-test framework for JavaScript which runs in the browser. Not with an external browser-automation system as in Selenium, or a non-browser JS environment, but just one .html which loads the test framework and test suite and displays the results in that page. My searches have found only the other two kinds.
I am primarily interested in testing JavaScript code for expected results and not crashing, not DOM/events or visual appearance.
Nice-to-haves:
Performance testing/benchmarking as well as correctness testing.
Optional external automation so a shell command can run the test suite and check if it succeeded.
The motivation for the requirements is:
My application under test is currently itself pure JavaScript, and I'd like to keep it that way (without platform or other-language dependencies).
I am using many newer or bleeding-edge features such as ECMAScript 5, Typed Arrays, WebGL, and Local Storage. I want to test the actual interaction with these facilities, not stubs.

jsunit or Jasmine
You can run Selenium in the browser only. Download Selenium Core 1.01. Upload the unzipped files to the domain you want to test. Open /core/TestRunner.html and start the browser only frontend of Selenium :)
I use this kind of test in several projects. It's perfect to have only one place to store and to run tests. You can trigger those these by cronjobs and capture the results as well. I extended it a lot and I save the results to a Database and take automatically screenshots with JS when errors occur.
If this kind of running Selenium is still supported in version > 2.0, I don't know. Here is a tiny documentation.

I recommend qunit. It's created by the jQuery team (and is used to test the jQuery framework) and it works in both the browser and node. It's really quick to set up tests, with just a single HTML file which has script tags with your tests, and it's well documented.

Besides those already mentioned (qunit & Jasmine) I recommend mocha.js, it adds a little bit more complexity but it's so much more flexible, you need to load the file, add a script tag with the configuration and start testing, the plus is you can use any assertion/expectation library you like if it throws exceptions if the test fails.

Related

Sencha vs Wavemaker [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm trying to decide between Sencha Architect 2 and Wavemaker. They both seem very similar. Of course Wavemaker is completely open source, and Sencha is only partially open source. For this reason I'm leaning towards Wavemaker, but given the learning curve with either, I'd hate to find myself with less options later on, just because I tried to save some money. Here are my main concerns.
1- I want to be able to sell my application without giving away my source code.
2- Productivity of course is paramount. Are they both about the same?
3- Database development tools.
4- Easy of deployment and hosting options.
Opinions either way are much appreciated.
wavemaker is for me best tool for now..
1.on javascript can use some tools for obfuscate code
2.WYSIWYG..visual tool with cool ajax widgets drag and drop and offcourse all free
3.have is model part for can create your db
4.cloudfoundry
Full disclosure: I work for VMware on WaveMaker.
I felt compelled to correct a few things from Rene’s post. WaveMaker is not strictly a backend framework. WaveMaker is a visual, drag-and-drop development tool. Applications created with WaveMaker contain a backend framework (Java, Spring) and a frontend framework (JavaScript, Dojo). Developers enhance their UI by writing JavaScript code.
The comparison to GWT implies that UI development in WaveMaker is done using Java. Although Java is part of the WaveMaker framework, developers do not use Java code to enhance UI functionality. The back-end code is Java, which is used to access databases and other backend services. In most cases WaveMaker developers do not need to modify the Java code. Since WaveMaker produces standard Java/Spring applications it’s easy for a Java developer to extend the backend functionality.
This question doesn't make much sense to me. Are you comparing just the IDE-s?
Anyway, your options look like very different things. One is primarily a front-end framework and another one a back-end framework. One produces Java apps, another one JavaScript. Maybe you should compare Wavemaker against Ext GWT instead, which is Java-based.
Given your point 3, your choice should be straight-forward as there are no database development tools in any of those Sencha front-end development tools that you seem to be referring to. There might be something in Ext GWT, but I'm not at all familiar with that.

Using WebKit for a desktop application [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I need to make a desktop application using CSS/HTML5/JavaScript. This application should work cross-platform (Linux/Mac/Windows) and will be distributed as a simple executable (not an installer), where the user simply opens it and can start using it right away. It also needs to work offline, on machines where internet is not accessible.
So I thought WebKit would be the perfect choice. In fact I went ahead, installed Xcode, and in little time I had an executable that opened a window and loaded some CSS/HTML/JavaScript.
However, my issue is that I don't have Linux/Windows machines. I can't afford buying a Windows copy and I don't want to go through the effort of having to install the OS and installing the Visual Studio or whatever thing, and trying to make an executable for those platforms as well.
I was wondering if there was a pre-built executable for each platform that comes with WebKit. So that all I have to do is change the icon of the application, the name and tell it where to get the html/css/javascript and it would make an executable for the platforms I need.
Is this possible? What are my best alternatives?
You can use node-webkit.
It uses webkit to render the webpage and execute the Javascript, and you will have access to all the Node.js javascript API (reading/writing files, …)
Update: Titanium Desktop is an open sourced project nowadays and named "TideSDK"
http://www.tidesdk.org/
You may try both of below. I have used Titanium Desktop: It is webkit based and also becoming an open source project.
http://www.appcelerator.com/products/titanium-desktop-application-development/
You can also use Embedded Chromium project, but this might require some knowledge on other then HTML/CSS/JS
http://code.google.com/p/chromiumembedded/
There is certainly some way to do this with Qt / QtWebkit / QWebview. But, it is certainly involved.
There is also a Gtk Webkit.
You would still need an installer, but you can look into Adobe Air. You can build apps that even leverage AS3 libraries as well as make them entirely with HTML5/CSS3 and your flavor of Javascript. Best of luck to you.

Reliable and convenient JavaScript minifier [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I occasionally write JavaScript code. I am interested in minifying it for better performance, but I don't plan to spend to much time on that, especially in testing the minified result.
I found this online service:
http://www.lotterypost.com/js-compress.aspx
So a couple questions:
Is it reliable?
Microsoft AJAX minifier vs. YUI Compressor, what's the best option?
Any other similar online tool to recommend (and why is it better than the above link)?
Google's Closure Compiler
is an excellent Javascript minifier and compiler. It analyzes the code and reports the detectable errors. It removes redundant space and unreferenced code, and renames objects to shortest possible names. You just need to compile together all Javascript files that belong to one HTML page.
That link you post happens to be the one that I use too.
Use the MS AJAX Minifer. It's way better than the yui one. besides:
http://stephenwalther.com/blog/archive/2009/10/16/using-the-new-microsoft-ajax-minifier.aspx:
The Microsoft Ajax team (I work on
this team) has been using this tool
internally for a number of years. For
example, we use the Microsoft Ajax
Minifier to minify the Microsoft Ajax
Library before publishing it.
Well if you don't trust me, run your source code (if you don't have an actual source code to test, just grab the source at http://code.jquery.com/jquery-1.6.2.js) through both and see which is more "minified".
==
Google has the Google Closure Compiler but it analyzes your code and removes unreferenced code (to furthur reduce the size of the resultant file). However usually this is not what you want because even though the functions/variables are not referenced within that file, it may be referenced from your other js files that make up your site)

Which Javascript / Chrome Extension IDE are you using? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 9 years ago.
I'm currently develloping a Chrome Extension and i'm searching for more ergonomy by finding a good IDE who can manage javascript and also Chrome Extension API.
Thanks in advance.
Use Aptana Studio and add the following scripts to File references.
chrome_extensions.js
webkit_dom.js
Congratulations! You now have a very capable javascript editor with autocomplete support for chrome APIs
EDIT
You can have the same functionality in Visual Studio, which has (in my opinion) even better support for javascript. In fact I think it's the best javascript editor around (quiet an achievement for microsoft :))
Just add the following comment to your js files:
/// <reference path="MyExternalFile.js" />
And you get:
I got this to work on IntelliJ by using this API stub (to make the chrome object appear in auto completion)
https://github.com/linux-china/chrome_js_api_stub
In combination with the chrome extension.js
https://code.google.com/p/closure-compiler/source/browse/contrib/externs/chrome_extensions.js
I then added the stub chrome_js_api_stub library and the chrome extension library by following the below directions
http://www.jetbrains.com/idea/webhelp/configuring-javascript-libraries.html
It's not for everyone, but if by ergonomy you mean moving your hands around as little as possible, not reaching for the mouse, VIM is very much designed to keep your fingers on the keyboard and as close to the asdf/jkl; positions as much as possible. It's a pretty steep learning curve, but the payoff is extremely quick workflow.
With the right addons, it's a very decent javascript editor, with syntax highlighting (including jsdoc comments), code completion, jslint integration, etc
For Aptana Studio 3: (plugin for Eclipse tested)
Find a library you are interested in...Save it to your disk, and then drag it into your project. It does not matter where in the project it sits, so you can create a new folder for files like this if you like.
!! The project must be some type of web project: Web, PHP, Python, Ruby, Rails.
http://wiki.appcelerator.org/display/tis/Using+JavaScript+Libraries

Javascript, Intellisense and compiler notification [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 12 years ago.
Being a C# developer, I cannot grasp why in the world one would spend time designing a perfect class in javascript, when you can't get any editor today with intellisense that will fully show you your class rules. There is only one way to maintain a well designed class in JS by documenting everything, and requiring a developer that uses the class to always refer back to its documentation.
For me - trying to become a professional javascript developer - it's so frustrating, I feel so unproductive. why is that? why can't we get an editor that will work just like C#. or maybe we would be better off if browsers starts to support a normal OOP language?
Visual Studio works quite well considering the fact that Javascript is a very dynamic language where certain functionality/fields can be added removed from an object at any moment. And Javascript isn't really OOP in a sense you know in C#. It's prototyped which is different.
Think of such an engine and you'll see that Visual Studio is doing quite well with its Javascript intellisense support.
How to enable intellisense in certain file
You have to reference other javascript files in yours to get intellisense for their functionality of course...
/// <reference path="jquery-1.4.1-vsdoc.js" />
Paths are relative to your file. This will make it possible to get intellisense for jQuery in any of your files that will have this directive right at the top of the file. References must be used to actually enable particular file's intellisense. This makes sense of course since you can have multi-faceted functions defined in various files and only one of them is used per page. Each using a different one.
Your plugins and VS JS Intellisense documentation
And when you want your code to be reused you can always add XML documentation to your code file and others will get intellisense as well while using your Javascript code file. If you don't know how to do this check the plugin on this blog post of mine and check the .toDictionary() function that has the documentation that Visual Studio is able to use for intellisense purposes.
The OOP design around javascript is more for creating a clean, maintainable, code base. You'll have seams you can use to write QUnit tests for. You can easily identify errors and rewrite code without fear of breaking stuff. You can create namespaces and closures as well. OOP is not about code completion is more about a way to write your code and not have your code written for you ;)

Categories