testing

Fixtures with polymorphic association not working

孤者浪人 提交于 2020-01-06 06:45:22
问题 I'm trying to implement the Rolify gem but have trouble adding fixtures with a scope for it. The last line of the (model) test below fails because currently the moderator role seems to be given to @user globally instead of only for organization one. The fixtures below aren't using resource_id and resource_type , which are mentioned in the gem documentation for fixtures, but I'm not sure how to use them. How should I set the scope for the moderator role to only organization one? roles.yml

Appium WinAppDriver C# Calculator example Error

泄露秘密 提交于 2020-01-06 06:08:16
问题 I'm trying to just run the calculator test C# example (https://github.com/Microsoft/WinAppDriver/tree/master/Samples/C%23/CalculatorTest) inside visual studio 2017. When I download and build the example, it shows several lines as deprecated; DesiredCapabilities appCapabilities = new DesiredCapabilities(); appCapabilities.SetCapability("app", CalculatorAppId); appCapabilities.SetCapability("deviceName", "WindowsPC"); and one as an error that needs to be changed; CalculatorSession.Manage()

How to use user input in prolog to search

有些话、适合烂在心里 提交于 2020-01-06 05:50:29
问题 hello i want to be able to get the user input then store it and use in in my code. body(mercury, 36, small, none, none). body(venus, 67, small, atmosphere, none). body(earth, 93, small, atmosphere, none). body(moon, 93, small, none, none). body(mars, 141, small, atmosphere, none). body(jupiter, 489, large, atmosphere, rings). miles(Body,Miles):-write('Enter the Goal State:'),nl, read(X),nl, body(Body, Miles, _, _, _); Miles > X. 回答1: i switched to GNU prolog firstly which helped. miles(Body

Cargo test cannot reference anything public inside the targeting crate in integration test. Unit tests also cannot find test cases

喜欢而已 提交于 2020-01-06 05:48:06
问题 I am trying to do some test on my no_std module but I cannot make both integration and unit test working. I think the cargo does not make functions and modules visible to others. The project is at: https://github.com/ShisoftResearch/Nulloc/tree/e2e15646da79651ddb8c29e0526bad0d60690bec Run cargo test , I got: ➜ cargo test Compiling nulloc v0.1.0 (/Users/shisoft/Dropbox/Code/OSS Projects/Nulloc) error[E0432]: unresolved import `nulloc::bump_heap` --> tests/bump_heap.rs:3:14 | 3 | use nulloc:

Using TouchUtils in Android testing

谁都会走 提交于 2020-01-06 03:42:44
问题 I'm testing on an actual device, with the screen unlocked. Here's my code: public class TouchUtilsTest extends ActivityInstrumentationTestCase2<MainActivity> { Activity mActivity; Instrumentation mInstrumentation; public TouchUtilsTest() { super(MainActivity.class); } @Override protected void setUp() throws Exception { super.setUp(); setActivityInitialTouchMode(false); mActivity = getActivity(); mInstrumentation = getInstrumentation(); } public void testTapOnView() { View v = mActivity

Selenium server standalone for Internet Explorer

时光总嘲笑我的痴心妄想 提交于 2020-01-06 03:38:08
问题 I'm using selenium server standalone to run some selenium tests on Internet explorer but it opens an embedded Internet Explorer which has 2 drowbacks my sites renders differently (every thing is good in IE but not in embedded IE) it does not use internet explorer settings so even while I've turned off script debugging in IE I still get some errors in Embedded IE. anybody has any idea how can i make selenium standalone server to work with IE, not Embedded IE? I use latest version of both

Test fail with ActionView::Template::Error: undefined method `name' for nil:NilClass

倾然丶 夕夏残阳落幕 提交于 2020-01-06 03:22:05
问题 I have on view show.html.erb <%= @question.user.lesson_id %> and this is on browser a number. my questions_controller.rb is def show @question = Question.find(params[:id]) @comments = @question.comments.all if user_signed_in? @rating_currentuser = @question.ratings.find_by_user_id(current_user.id) unless @rating_currentuser @rating_currentuser = current_user.ratings.new end end and my questions_controller_test.rb test "should show question signed in" do sign_in users(:user2) get :show, :id =>

Resource Access Exception

半腔热情 提交于 2020-01-06 02:30:07
问题 When trying to resolve the test described in Where exactly is the NullPointer Exception?, I used a seemingly simpler approach, being the resource test the next: public class CustomerResourceFunctionalTesting { private static final String SERVER_URL = "http://localhost:8080/api/v0/"; @Rule public ExpectedException thrown = ExpectedException.none(); private int createCustomer(String name) { CustomerDto customerDto = new CustomerDto(name, name + " address"); return new RestBuilder2<Integer>

flag in test causes other tests to fail to run

ぃ、小莉子 提交于 2020-01-06 01:44:59
问题 I have a test file that I want to only run when a bit flag is set. I followed the simple example from golang's testing docs: package mypkg var myFlagSet = flag.Bool("myflag", false, "") func TestMain(m *testing.M) { flag.Parse() if *myFlagSet { os.Exit(m.Run()) } } if I run go test ./mypkg -myflag it runs as expected. However, when I run go test ./... -myflag , all other package tests fail: flag provided but not defined: -myflag I want to be able to run all tests and not have to worry about

Gradle - including resources in tests

拥有回忆 提交于 2020-01-05 17:17:14
问题 I have an android gradle project and java gradle project as its dependency. The second one have separated unit test classes. It contains also resources placed in src/main/resources . Problem is that resources are not being copied to test build directory. I've found that topic: http://forums.gradle.org/gradle/topics/resources_from_src_main_resources_not_included_for_test and adding the snippet from one before last post causes that resources are added and tests are working fine but building