Clarify TDD in Robotlegs. Is my understanding of unit tests correct?

kimcity's Avatar

kimcity

27 Apr, 2012 01:44 AM

Hi there, I bought the ActionScript Oreilly book for Robotlegs

In Chapter 10, Testing

I understand that usually for RL, we test these 4 classes

Models
Services
Commands
Mediators

  Test event dispatched by view results in correct event dispatched on the shared event dispatcher
  Test event received on shared dispatcher results in action on view

1) Am I correct?

2) If I follow those examples and download mockolate library, do I still need to use FlexMonkey or any other unit testing frameworks for Flex?

3) I cannot find via google an example of anyone hooking up jenkins with unit tests for Robotlegs. Does anyone know any examples that I can learn from?

Thank you.

  1. 1 Posted by Stray on 27 Apr, 2012 11:28 AM

    Stray's Avatar

    Hi Kimcity - just a quick response as I am in an airport.

    We use jenkins on the current build of the Robotlegs 2 framework - so it would be worth checking out the repo on Github.

    http://github.com/robotlegs/robotlegs-framework

    DevBoy (dominic graefen) is the main person who handles Jenkins for Robotlegs,

    https://twitter.com/#!/devboy_org

    but Simon Bailey (newtriks on github and twitter) also has some experience I think.

    https://twitter.com/#!/newtriks

    Both are very helpful.

    As I understand it, FlexMonkey is an end-to-end GUI testing tool - that's different from a unit testing framework. Mockolate is a mocking library - we are using it alongside FlexUnit and ASUnit for our tests in the examples in the book. So, you would need FlexUnit 4 or ASUnit 3 to compile the tests in the book. (FlexUnit for the Kanban project, ASUnit for the Mosaic project), plus mockolate for the mocking library.

    hth,

    Stray

  2. 2 Posted by kimcity on 28 Apr, 2012 01:36 AM

    kimcity's Avatar

    Thank you, Stray.

    I have already sent out tweets to DevBoy (dominic graefen) and Simon.

    I looked around the git repo for RL. I cannot find anything that can help me understand how to use Jenkins with FlexUnit for CI in a Flex 4.6 project.

    In any case, I realize that RL uses FlexUnit 4.1, so I will be using that as well. Was looking at ASUnit at first.

    My original question still remains:

    I cannot find via google an example of anyone hooking up jenkins with unit tests for Robotlegs. Does anyone know any examples that I can learn from?

  3. Support Staff 3 Posted by Shaun Smith on 28 Apr, 2012 05:52 PM

    Shaun Smith's Avatar

    Hi Kimcity,

    I can't give a step-by-step guide (as Dominic was kind enough to set everything up for us, so I'm not clear on all the details), but here is my understanding:

    1. Write unit tests for your project
    2. Write a build script (using Ant or Buildr) that runs your tests and provides a report
    3. Configure Jenkins to run that script and read the report
    4. Configure Jenkins to checkout the code and run the tests whenever you do a commit (you can do this with a GitHub hook).

    Jenkins seems to integrate really well with GitHub. Looking at the Jenkins config for Robotlegs I can that it has a field for "GitHub Project" which we have set to:

    https://github.com/robotlegs/robotlegs-framework/

    Further down it has repository settings which have set to:

    https://a:a@github.com/robotlegs/robotlegs-framework.git

    We've also set it to run against the "version2" branch of that repository.

    The "Build Trigger" is set to "Build when a change is pushed to GitHub".

    The "Build Environment" has "Run Xvnc during build" selected. I assume this is to get the Flash player to launch on Linux.

    The Execute Shell Command is set to:

    bundle exec buildr clean test -e test

    This is because Dominic set it up to do the build using Ruby Buildr instead of Ant.

    Finally, under "Post-build Actions" we have "Publish JUnit test result report" set to "reports/flexunit4/TEST-*.xml"

    I hope that helps a bit. Hopefully someone can provide more details.

  4. Ondina D.F. closed this discussion on 27 Aug, 2012 10:37 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac