The "Functional testing with a tabs widget” section shows you what a sample test runner file looks like. You’ll need to have an HTML file like that one to run tests in your browser; note how it contains references to jQuery/QUnit/FuncUnit script files, and then runs a testing script (the last script reference).It sounds like you haven’t written unit tests either, so if you need a guideline on where to put tests, make a “test” folder and write all your test scripts in files under that folder. If you’re working on a site that has a build process, you should exclude the test folder when building to deploy to production.Then you just need to add script references to all the files in your test folder in your runner HTML file.If you’re using StealJS (or any other AMD) along with FuncUnit, you can add a script reference to it in your runner and make your tests into a module.The way FuncUnit works is that it launches a new browser window with your full site and automates the interactions with the site from the page running FuncUnit. This is why you need a separate HTML file (for running FuncUnit) and don’t need to add anything to your existing site’s pages.HTH
Hi, does funcunit support jasmine 2.1? I really love both of them.
I tried it both ways. The strange thing is that it does not work straight from the file.
I think there's a way to arbitrarily set the FuncUnit window. Alexis?
Working on itYes, the app itself works fine but when the test runs, you visually see the button click but the click handler block of code is not run.
everyone at bitovi uses funcunit because selenium is terrible ..
FuncUnit users and newcomers, We've had a few exciting developments in the past few months and I think it is time to clarify what exactly is happening with FuncUnit.js. For those of you that are familiar with FuncUnit, you may have become accustomed to the following features: - Simple, event simulation syntax with jQuery selectors - CLI tools to run tests in PhantomJS - CLI tools to trigger browser running - Test coverage integration for Steal users These were all features we desired when we started the project back in early 2010. At the time, NodeJS had just started development, but wasn't yet released or in the public view, so our main focus was rhino integration(eg: the ./js script). Mainly due to NodeJS's release and popularity, we've had an explosion of innovation in JS tools, such as GruntJS. Rather than try to be an all-in-one testing solution, we decided in favor of modularity. This is akin to when we broke up JMVC last year to be individual pieces. jQueryMX was split into CanJS & jQuery++ and StealJS has upcoming stable releases for node & bower support, respectively. The new direction for FuncUnit is to be the best at one thing: Simple, event simulation with jQuery style selectors. We've reduced using FuncUnit from downloading a larger project, to a single file, ~145k uncompressed. We've added full Jasmine support and are in the process of supporting other testing frameworks. There are a growing number of test runners on the market and we've chosen to favor TesteeJS to run our tests. This is not to say you must use TesteeJS, but you should be free to integrate any parts you may or may not have with FuncUnit going forward. We may provide a Yeoman generator for our scaffold of a testing setup, however that's a talking point on the roadmap currently. Repo direction: Now, with any drastic project redirection, there are some growing pains. In our case, this will reside in the repos. We just released JMVC 3.3 recently and chose not to prohibit 3.3 users from using the older FuncUnit. This is currently: bitovi/funcunit. bitovi/funcunit.js is the new library, focusing only on the testing syntax itself. Overview: bitovi/funcunit - v3.2.3 tagged, follows revolution.major.minor versioning(matches JMVC) - includes runners(rhino, selenium, phantomjs support) - includes test coverage for steal - requires steal - requires jquery bitovi/funcunit.js - v2.0.x tagged, follows semantic versioning(original FuncUnit was 1.x from inception) - requires jquery - bower support There is plans to consolidate the repositories with bitovi/funcunit being the final destination. Roadmap: - Setup a github redirect from bitovi/funcunit.js -> bitovi/funcunit - Setup an orphan branch for v3.2.3 users - We'll be overriding the history in the master branch of bitovi/funcunit due to the size of the repo(~200Mb of older jar references) Feel free to respond to this thread or on GitHub with any questions/issues you may have! Developer Bitovi
Using the ouput option to generate an xml file with test result sometimes create broken xml files. The command I use to generate the results xml is:
- ./js funcunit/open/phantomjs myapp/myapp_test.html -out myapp/docs/funcunit.xml
The problems is related to an invalid tag "testcase" inside the "testsuite"(s) record during the process. All the tests are executed but somtimes the report process just add only a closing "</testcase>" tag, this breaks my build when it runs with our CI server (jenkings + xunit plugin). The test script contents is something like:
- // test modules
- // etc ...
All tests pass, no errors inside them, no java exceptions, nothing wrong except for broken xml files.
- Ubuntu 12.04 64bit (tested even with 13.04 64bit)
- PhantomJS 1.9.1 (for 64bit platform)
- Jenkins 1.505
- XUnit 1.6.1
I'm starting to integrate funcunit in our building process, but I'm little bit confused about "How to output tests result running those tests with nodejs?"
- node funcunit/node/run.js myapp/test.html
Everything is ok with that, every test passed and at the end the result are displayed.
However now i need to export that result as xml to be parsed with Jenkins (xUnit). The problem is that the command above doesn't seems to work adding:
- node funcunit/node/run.js myapp/test.html -out results.xml
If i try to execute instead
- ./js funcunit/open/phantomjs myapp/test.html
It execute all the tests but at the ends it will give me this java exception
and also give me
- kill: invalid argument -- "9"
followed by the usage of kill command.
What i can do to use nodejs + phantomjs + funcunit to export my results? Tnx in advance.
Ok, found that there was a change to a recent version and the command now looks like:
./js funcunit/open/phantomjs funcunit/test/autosuggest/funcunit.html
PhantomJS now works for me but not selenium due to file access restrictions:
That makes sense -- my seems-to-work solution appears to be using FuncUnit's internal jQuery. I initial tried using Syn directly, but (as you suggest) I couldn't get it to send synthetic events.
It looks like I'm using jQuery 1.9.1 in both the qunit page and the test window. (I can remove jQuery from the test window without any problems, though, as it was only needed for that .trigger())
Thanks for the reply. I am going to give this some thought and then I'll share my ideas.
To integrate with CI I am using QUnit with funcunit to create xml
When the xml is produced it is often not valid as the testsuites tag has closed when it likes.This results in the stream being closed before the tests have finished this also seems to be the case for modules.
- steal/js funcunit/open/phantomjs localhost/test.html -out text.xml
It appears to be the case that the testcase and testsuite and testsuites could all suffer from the same problem.
- <testsuite time="0.204" tests="1" errors="0" failures="0" assertions="8" name="Example Module">
Hi,I am currently trying to test an extjs application using func unit. Works well and i like the api much better than e.g. siesta. However i am wondering if it is possible to show mouse movements and cursors while executing a test. While this is certainly not for everybody i like the idea that you can follow what is being performed. Siesta does that and it makes it easier for someone to follow the testing actions. A feature like this might open the world of training and interactive online help for funcunit.A point to start with might be the ability to hook in callbacks in between the actions, which pause the execution and resume it later e.g. when a cursor animation was performed, or an info box was dismissed.
PLEASE DELETE MY ACCOUNT
Yes, something went wrong with the deploy when we moved the repositories over. Working on fixing it.
I am getting somewhere with this I used as you suggested
This has some problems though
- steal/js funcunit/open/phantomjs <url>
Checking the server logs shows that the interactions are happening but the console output is not appearing.This is not a constant problem some times it works more than others.I have tried with some different versions of phantom but get mostly the same behaviour.
- at script(steal/browser/utils/rhinoServer.js:45)
- at script(steal/browser/utils/rhinoServer.js:81)
- at java.lang.Thread.run(Thread.java:722)
- Caused by: java.net.SocketException: Connection reset
- at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:113)
- at java.net.SocketOutputStream.write(SocketOutputStream.java:132)
- at java.io.DataOutputStream.writeBytes(DataOutputStream.java:276)
- at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
- at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
- at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
- at java.lang.reflect.Method.invoke(Method.java:601)
- ... 12 more
As far as I know it is not be possible as the js command would have to come from steal or JMVC implementation of rhino.Unless you can just run phantom on the test.html page and get the feedback through the console.I am looking to do something similar myself I will let you know how I get on.Please let me know if you have any luck too!
asked by kbh1983 • 4 years ago
what it says / what most xUnit tests do, indicate a failure and continue the rest of the tests.(edited to add:)For example,Say I ran through the demo and created a new Recipe Model for my cookbook and added a new test for findAll. That test would fail until I've coded the work (ala TDD) but I still want to run Create, Update, and Delete in case I do something else along the way that breaks them.
Which monday? There are so many… :)
- « Newer
- Older »