jeudi 1 octobre 2015

Rails undefined method 'full_name'

I have this error, when I'am testing my controller

ActionView::Template::Error: undefined method `full_name' for nil:NilClass

My tests:

class PostsControllerTest < ActionController::TestCase
include Devise::TestHelpers

setup do
    @post = Post.create!(title: "my title", content: "bla bla bla")
    user = User.create!(email: "example@mail.com", first_name: "name", last_name: "surename",
                    password: "password", password_confirmation: "password")
    sign_in user
end

test "should show post" do
    get :show, id: @post
    assert_response :success
end

full_name method in model:

def full_name
  "#{first_name} #{last_name}"
end

and my view:

Wrote by
  = @post.user.full_name

Thanks for help

In JMETER CMD console window-Issue on while Adding Components under Threadgroup using mouse scrolling except Listeners

While Adding Components under Threadgroup using mouse scroll it will simply hangs and in jmeter CMD windows displaying exception like :

Uncaught Exception java.lang.ArrayIndexOutOfBoundsException: -1. See log file for details. Uncaught Exception java.lang.ArrayIndexOutOfBoundsException: -1. See log file for details. Uncaught Exception java.lang.ArrayIndexOutOfBoundsException: -16. See log file for details. Uncaught Exception java.lang.ArrayIndexOutOfBoundsException: -16. See log file for details. Uncaught Exception java.lang.ArrayIndexOutOfBoundsException: -19. See log file for details. Uncaught Exception java.lang.ArrayIndexOutOfBoundsException: -19. See log file for details.

Why Jmeter CMD showing me this

How to make `sbt test` to run tests in main project and all subprojects (or some selected set)

I have a main project and a few subprojects. When I want to run tests, currently I have to do sbt test and sbt subProjectName/test. Is there any way of making sbt run all tests or for example all tests in the main project and one of the subprojects.

I am using Build.scala configurations, but can't find a way of setting this.

Thanks!

Override Django cache settings in tests

I'm using django.core.cache.backends.dummy.DummyCache in my tests, however, there is one test which requires actual caching so using DummyCache is not good there.
Is there a clean way to override the general Django settings for a certain scope? Preferably using a decorator.

In [2]: django.__version__
Out[2]: '1.8.4'

I have created a script in selenium for odoo framework in python , so can I use it for a load testing ? if yes then how?

I have created a script in selenium in odoo framework in python , now I want to test it for load testing then which tool is best ? should I have to make another script for load testing again or I can use the same script for a load testing , if yes then how can I use it

How to get the child of a view which is not having an id in android test

I want to open the navigation drawer with a click on the Hamburger menu icon during a test.

Currently the Hierarchy of the action bar is as follows:

...
Toolbar (@id/action_bar)
  TextView (no-id)
  ImageButton (no-id) <-- this is the hamburger menu
  ...
...

using Espresso there is only Matchers for withId, withText, etc. which doesn't serves my purpose here.

How to access Icons on Mobile screen using TestComplete

I am new to TestComplete and I have started to work on Mobile Testing. I am trying to access the Icons present on the (Android)Mobile home screen using Object spy. Object spy is detecting the objects of a Java application but not the icons on mobile home screen.

Is there any possible ways to detect them or not.? Please suggest me on this.

Best Regards, Guru Raja.