testing

Unit test Android, getString from resource

China☆狼群 提交于 2020-01-01 04:19:47
问题 I am trying to do an unit test for an android app and I need to get a string from res.string resources. The class that I want to test is a POJO class. I am doing the app in two languages, due to this, I need to get a string from resource. The problem is that I cannot get the context or the activity, is possible? I know that with Instrumentation test I can do it, but I need to test some functions (white box test) before to do the instrumentation test (black box test). This is the function that

Unit test Android, getString from resource

本秂侑毒 提交于 2020-01-01 04:19:25
问题 I am trying to do an unit test for an android app and I need to get a string from res.string resources. The class that I want to test is a POJO class. I am doing the app in two languages, due to this, I need to get a string from resource. The problem is that I cannot get the context or the activity, is possible? I know that with Instrumentation test I can do it, but I need to test some functions (white box test) before to do the instrumentation test (black box test). This is the function that

In pytest, how can I figure out if a test failed? (from “request”)

ⅰ亾dé卋堺 提交于 2020-01-01 04:19:11
问题 I'm using Selenium with PYTEST to test a site. I would like to take a screenshot of the page whenever a test fails (and only when it fails). Is there a way that I can do this? The docs are quiet when it comes to this (or I can't find it). I would assume that it would be something like request.function.failed and it would return a boolean or something. This is what I wanted to do: @pytest.fixture() def something(request): if request.function.failed: print "I failed" This would be added to a

Espresso startActivity that depends on Intent

限于喜欢 提交于 2020-01-01 03:58:28
问题 I have the following situation. My activity has a fragment that depends of a Serializable Object. Here is my onCreate: @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); MyObject myObj = (MyObj) getIntent().getSerializableExtra("myobj"); if(myObj != null) { FragmentManager manager = getSupportFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); transaction.add(R.id.container, MyFragment.newInstance(myObj));

Rails How to use FactoryGirl in Seeds.rb?

与世无争的帅哥 提交于 2020-01-01 03:44:05
问题 I want to have the Seeds.rb file run a method in a file from the Rails.root.join('spec') directory which will fill the database with data generated by FactoryGirl. Lets call this file "helpers.rb" with the method "seed_data" Edit: require Rails.root.join('spec','helpers.rb') links the file. source This method I want to use in a before(:all) do seed_data end to seed the test database and rake db:seed for development/production databases with the same effect. 回答1: Seeds.rb require Rails.root

uninstall app before start test

試著忘記壹切 提交于 2020-01-01 03:40:12
问题 We're trying to write instrumentationTest for our app. For example I want to write test for authorization/registration. However before every test I want to be unauthorized? so I need to clean all data, delete db, etc. So is there any way to delete app or app's data before every test? 回答1: Use Annotations eg: @BeforeEach and put your clean up code there. 回答2: Using Android studio, you can create a test configuration that first uninstalls your app before running a test. Create a new External

Groovy for testing an API

最后都变了- 提交于 2020-01-01 03:26:14
问题 I'm writing a series of automated, end-to-end test cases that exercise a RestFUL API. I have several good test scripts, written in Groovy, that provide the sort of tests and build the confidence we need, and we're looking at integrating these into a nightly build, as well as allow the QA team to run them. This is a step above Unit testing, as we are looking at complete end-to-end workflows, rather than atomic steps. The output is currently human readable, with each test condition printing out

Where is the help.py for Android's monkeyrunner

非 Y 不嫁゛ 提交于 2020-01-01 03:03:07
问题 I just can't find the help.py file in order to create the API reference for the monkeyrunner . The command described at the Android references monkeyrunner <format> help.py <outfile> does not work when i call monkeyrunner html help.py /path/to/place/the/doc.html . It's quite obvious that the help.py file is not found and the monkeyrunner also tells me "Can't open specified script file". But a locate on my system doesn't bring me a help.py file that has anything to do with monkeyrunner or

Automated Testing Framework

核能气质少年 提交于 2020-01-01 02:49:07
问题 I am trying build an automated testing framework for some of our internal web services (java) at work. Each service has a set of APIs (3-5), although this could be relatively easy to achieve, the problem comes with some APIs which do not behave as pure functions, ex: something like persistX, this could store something in a database and returns an exception incase of failure. There is no easy way to validate since there is no output here. So I was wondering if this could a a bit generalized,

why mocha in browser throw global leak detected from a url but not from a unc path?

依然范特西╮ 提交于 2020-01-01 02:47:25
问题 I'm creating a javascript library and want to use BDD, so I'm giving a try at mocha and I can't make it work. I want that library to be used on the client, so I'm assuming that it make sense to have it running from a browsable url, to be in a context of web connection, and not just a sandbox from a unc path. here is the dummy starting point file test/test.foobar.js var assert = chai.assert; var foobar = { sayHello: function() { return 'Hello World!'; } }; describe('Foobar', function() {