Unit Testing a Firefox Addon - firefox

In working on a firefox addon, i've found the task of unit testing to be kinda janky and difficult to setup. Anyone have recommendations on how to setup unit tests for an addon? Any tools or additional addons found to be helpful?
I've found Mozmill [ https://addons.mozilla.org/en-US/firefox/addon/9018 ], which I think will be useful to an extent, but it's more of a high level tool and i'm looking for a tool or approach that works for more low level testing.

How about UxU ( https://addons.mozilla.org/en-US/firefox/addon/6357 ) ?

I used code-level unit testing with Mozmill. I "hooked" resource:// path of Mozmill by programmatically adding testing add-on (Urim) path to it in test initialization (setupModule function). As the result i can test any peace of code of my testing add-on like it is own code of Mozmill. Look here for an example. As i understand, this is you are looking for.

The new JetPack Add-On SDK they are working on for Firefox 4.0 has testing built in. It isn't documented yet though, but it's something to watch. It looks like you run "cfx test" which will run the tests.
Some links:
JetPack - https://jetpack.mozillalabs.com/
Add-On SDK Documentation - https://jetpack.mozillalabs.com/sdk/1.0b2/docs/
Add-On SDK Test Harness - https://builder.addons.mozilla.org/api/test-harness

Also see http://paulgu.com/wiki/Unit_Testing_Framework. I haven't used it, but it seems like a simpler and lighter-weight approach that might be easier to integrate. I think it could be better packaged to make it easier to add to an existing extension, but that is probably a straightforward refactoring.

WebDriver or Selenium?

Related

Using Theory and ClassData to Parametrize Xamarin UITests

I'm currently trying to make UI-Tests in Xamarin, where i want the app to be tested against different server versions.
Originally i wanted to do this like i did in unit-tests with parametrized tests by using [Theory] and [ClassData].
Unfortunately i haven't found anything about this in the web so far regarding this nUnit construct.
Is this even possible? or is there another way to tell my xamarin UI-Test to run all my tests once for each server version?.
Many thanks in advance.
Mav
Soo, the mistake i made was to assume that i could use xunit blocks for nunit tests.
My bad.
The solution is pretty simple and can be looked up here in the gitHub projects documentation:
https://github.com/nunit/docs/wiki/TestFixtureData

Is it possible to take screenshots inside Chutzpah?

Is it possible to take screenshots inside Chutzpah?
I can't seem to get to the underlying phantom object.
I understand now looking through the chutzpahRunner.js that the test itself is called via page.open() so appears to be in a different scope.
In the end I'm hoping to diff svg elements similar to how PhantomCSS does it with casperjs.
I'm new to phantomjs / chutzpah so maybe I'm missing something obvious.
From the co-ordinator of Chutzpah:
This is not something Chutzpah supports. Chutzpah is focused on
running js tests. I think CasperJS is a better fit to what you are
looking for.
Though it would be a cool feature, it's being discussed in the Chutzpah forum: Screenshots via phantomjs

Test Automation Framework

I was wondering what would be a good UI to specify test cases.
Currently we use macros with excel to specify our test cases and generate an xml out of it and export it to the script generator.
Excel is good and really flexible and allows testers to enter their test cases very quickly.
However the xml generated is sometimes not well formed and the system has a huge learning curve.
I want to change the UI from excel to something else that would allow testers to enter test cases quickly and provide flexibility.
A nice TDD tool is SLIM/FitNesse. It is a wiki system which allows to enter special tables and/or commands which trigger test methods. These test methods can be written in Java and .NET (other languages might be supported). Also there are various plug-ins for doing DB testing or Selenium web tests. Here is a first tutorial video.
I've used Test Link for this sort of task. It's an opensource php project.
You might check out Fitnesse, which does a similar thing. http://fitnesse.org/

What is the ruby test tool called that 'breaks' your code to see how tight your tests are?

A wee while ago I ended up on a page which hosted several ruby tools, which had 'crazy' names like 'mangler' or 'executor' or something. The tool's job was to modify you production code (at runtime) in order to prove that your tests were precise.
Unfortunately I would now like to find that tool again, but can't remember what it was called. Any ideas?
I think you're thinking about Heckle, which flips your code to make sure your tests are accurate. Here:
http://seattlerb.rubyforge.org/heckle/
Maybe you're thinking of the Flay project and related modules:
http://ruby.sadi.st/Ruby_Sadist.html
Also you can try my mutant. Its AST based and currently runs under MRI and RBX in > 2.0 mode. It only has a killer for rspec3, but others are possible also.

Continuous Integration setup for ruby projects on linux server

I would like to use open source tools if possible.
here are 2 links I found but haven't tried them -
http://pivots.pivotallabs.com/users/chad/blog/articles/471-continuous-integration-in-a-box-exploring-tsttcpw
http://laurentbois.com/category/continuous-integration/
Try this CruiseControl.rb
http://cruisecontrolrb.thoughtworks.com/
CruiseControl.rb is written in Ruby and designed for ruby.
Another one is Hudson, it is built in Java, but it has a plugin for ruby
https://hudson.dev.java.net/
Give Cinabox a try (I'm the author). It is intended to make this as simple as possible, and uses cruisecontrol.rb. There is a screencast and readme. If you have problems, open a ticket using the LightHouse link in the readme.
Good Luck!
There is a lightweight CI server written in Sinatra called Integrity which you might want to take a look at. I mainly used it because it supports git.
Git Reference

Resources