Yii mocking model - yii

I try to build a project using the Yii framework.
Are there any possibility to mock a model object during functional tests?

I think your looking for this:
http://www.yiiframework.com/doc/guide/1.1/en/test.fixture
Functional testing in Yii is stupendously simple. Create fixtures, Construct models, make assertions, Go.

Related

Form Creation and Validation in Slim Framework

I gonna develop a form using slim framework. I know we can develop REST API's using SLIM. I need to know whether we can design forms and validate those.
Thanks in advance.
Slim doesn't give you these kind of utils. You could use external libraries to validate forms like Respect/Validation or you could use rapyd-framework (Notice that its development is now stopped),
a microframework built on top of Slim Framework, Twig, Symfony Forms,
Illuminate/Database, Twitter Bootstrap
that supports Symfony Forms.

What is the standard way of Incorporating Jasmine in Enyo Applications

I have been trying to incorporate Jasmine Test descriptions in my Enyo Applications. Is there any standard way to do this ?
Edit: Forgive me, I should ask for A workable way instead of a "standard" way. Neither of the sites have enough docs on this thing.
Typically, you'll only be testing your models and other such non-UI logic with Jasmine. What you'll want to do is create a test suite that loads Jasmine and the Enyo framework. Then, in your tests you'll create the necessary Enyo objects on the fly. The Enyo team uses Mocha for our testing and you can take a look at the enyo/tools/mocha-tests directory to see how we incorporated unit tests for the framework.
For UI testing you'll want to look at something like Nightwatch or WD.js

Grails functional test dependency injection

I am quite new to Grails, but I am using this plugin for functional testing:
http://www.grails.org/Grails%20Functional%20Testing
I am wondering how to inject a service such as the messageSource or or the applicationContext so I can have access to different resources. A simple example would be that I want to write a functional test to check if the text on the website is equal to the message string in the messages.properties file. Right now I cant seem to find an out of the box way of doing that. Can you advice on something? Also is that the best functional testing framework for grails since its quite limited?
You may want to try Geb instead it is a good framework that has nice support and good docs. But the one items to remember is that functional tests are running against the full stack so some tests you may find work better as integration or unit tests.
You can use the remote control plugin in grails to modify your grails application on the fly. It uses the groovy remote control mechanism and serializes results for functional tests

How would I test controllers in Rhomobile in a BDD style?

I am using the Rhomobile framework to develop an application that is supposed to run on different mobile phones. The tutorial mentions how to write tests for the example model: Person. In fact, the framework provides a command-line tool rhogen spec to generate the dummy tests for the models. How would I go about writing tests for the controller class: PersonController? I was thinking of something similar to how one would do it in Rails, but rspec is unknown to me, and the methods post and redirect_to doesn't seem to work.
In BDD when you want to specify the behavior of the application (this is what controllers are responsible for) - you would normally aproach that with a StoryBDD framework - use for example Cucumber . Rspec is SpecBDD and regards a different level of abstraction - it is for specifying how classess communicate with each other and what they do.
You can find many tutorials on Cucumber's github page. This one could be helpful

Has anyone used Minitest::Spec withing a Rails functional test?

The spec library in Minitest is great. I've been able to use it within Rails unit tests no problem. However, Rails functional test inherit from ActionController::TestCase which provides instance variables like #controller in it's setup.
Has anyone been using the Minitest::Spec lib for their Rails functional tests?
If not, I'm considering creating a small library to do just that. I'm not too keen on rspec, and shoulda is starting to shift it's focus to rspec. It would be nice to have something lightweight and built on tools already provided.
Thoughtbot have now split shoulda into shoulda_contexts and shoulda_matchers so the worry about a shift to rspec for thoughtbot doesn't mean shoulda contexts are going away. Just being maintained in the community.
Here's a simple test_helper rig to run functional & integration tests in Rails using spec syntax. Based on a gist by tenderlove, this excellent article about MiniTest with Capybara, & a lot of tinkering & source-poring.
https://gist.github.com/1607879
Maybe try http://metaskills.net/2011/03/26/using-minitest-spec-with-rails/.