testing

Mockito get all mocked objects

强颜欢笑 提交于 2021-02-10 12:07:29
问题 I want to get the list of all mocked objects. Using a previous version of Mockito I could do this: List<Object> createdMocks = new LinkedList<Object>(); MockingProgress progress = new ThreadSafeMockingProgress(); progress.setListener(new CollectCreatedMocks(createdMocks)); These listeners are removed in the latest 2.8 version of Mockito, is there any alternative for it? 回答1: Since Mockito 2.x this has been replaced by implementations of org.mockito.listeners.MockitoListener which you engage

Android testing preferences fragment by Expresso

ぐ巨炮叔叔 提交于 2021-02-10 05:21:24
问题 I have got a problem with testing my code by Expresso. I wrote this code: public class SettingsActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getFragmentManager().beginTransaction() .replace(android.R.id.content, new SettingsFragment()) .commit(); } public class SettingsFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

Android testing preferences fragment by Expresso

放肆的年华 提交于 2021-02-10 05:19:45
问题 I have got a problem with testing my code by Expresso. I wrote this code: public class SettingsActivity extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getFragmentManager().beginTransaction() .replace(android.R.id.content, new SettingsFragment()) .commit(); } public class SettingsFragment extends PreferenceFragment { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

What is a correct approach to manage test data using pytest?

半世苍凉 提交于 2021-02-09 08:59:49
问题 I need to create automated tests for several related apps and faced one problem with test data management between tests. The problem is that same data must be shared between several apps and/or different APIs. Now I have next structure with pytest that working good for me but I doubt that use test data managment in conftest.py is correct approach: Overall structure looks like: tests/ conftest.py app1/ conftest.py test_1.py test_2.py app2/ conftest.py test_1.py test_2.py test_data/ test_data

How are the trigonometric functions tested in the GNU C Library?

时间秒杀一切 提交于 2021-02-09 06:59:07
问题 I'm trying to figure out how to best write unit tests for scientific and/or mathematical functions. I searched the source code for the GNU C Library for unit tests for the sin() and cos() functions and came across the atest-sincos.c source file, reproduced below. (It can be found here) Can someone walk me through this file and give a rough idea what is being tested here? I see what looks very much like the Runge-Kutta algorithm for numerically solving differential equations, and also possibly

Rails testing - Fixtures for has_many associations

℡╲_俬逩灬. 提交于 2021-02-08 18:38:39
问题 I am new to unit testing and have a simple use case. There are 2 models: City , Resident . A City has_many Residents. I created 2 fixture yml files: cities.yml, residents.yml. residents.yml resident1: name: resident1 resident2: name: resident2 resident3: name: resident3 cities.yml city1: name: city1 residents: resident1, resident2, resident3 When I run a trivial test that should always pass, I get an error : Minitest::UnexpectedError: ActiveRecord::StatementInvalid: Mysql2::Error: Unknown

Rails testing - Fixtures for has_many associations

眉间皱痕 提交于 2021-02-08 18:30:51
问题 I am new to unit testing and have a simple use case. There are 2 models: City , Resident . A City has_many Residents. I created 2 fixture yml files: cities.yml, residents.yml. residents.yml resident1: name: resident1 resident2: name: resident2 resident3: name: resident3 cities.yml city1: name: city1 residents: resident1, resident2, resident3 When I run a trivial test that should always pass, I get an error : Minitest::UnexpectedError: ActiveRecord::StatementInvalid: Mysql2::Error: Unknown

Make execution stop on error in RStudio / Interactive R session

不打扰是莪最后的温柔 提交于 2021-02-08 12:19:49
问题 When executing a block of code in RStudio, execution doesn't actually stop when an error occurs. For example, if I have the following code in the open editor: x <- 'test' stopifnot(is.numeric(x)) print('hello world') And run it (either with command-return or by clicking the "Run" button), it prints the error but then marches on and executes the print statement. Is there a way to configure RStudio to not proceed past the error? i.e. make it stop at line 2 above and not proceed to the print

Make execution stop on error in RStudio / Interactive R session

人盡茶涼 提交于 2021-02-08 12:18:53
问题 When executing a block of code in RStudio, execution doesn't actually stop when an error occurs. For example, if I have the following code in the open editor: x <- 'test' stopifnot(is.numeric(x)) print('hello world') And run it (either with command-return or by clicking the "Run" button), it prints the error but then marches on and executes the print statement. Is there a way to configure RStudio to not proceed past the error? i.e. make it stop at line 2 above and not proceed to the print

How to install the Selenium IDE(selenium-ide-2.9.0.xpi) in Firefox 45.0?

时间秒杀一切 提交于 2021-02-08 10:25:57
问题 Unable to install the Selenium IDE (selenium-ide-2.9.0.xpi), after hitting the allow button, it begins the downloading part and even after completing the downloading the Install button is disabled. [ ] 回答1: I solved this by installing legacy version of Firefox. You have to uninstall the current one then download the old version from https://ftp.mozilla.org/pub/firefox/releases/41.0/win32/en-US/. 回答2: Record and play tests are very hard to maintain. Please consider developing a test automation