testing

Forcing packet loss

邮差的信 提交于 2020-01-02 05:46:14
问题 For testing purposes, to determine how a protocol implementation behaves in the presence of packet loss, I would like to force packet loss on one of my network devices. Specifically, I would like to be able to tune the packet loss anywhere between 0% and 100%. I have a little experience with iptables and it seems to me I should be able to achieve it using that, but I haven't been able to. Achieving 100% packet loss is not a problem though ;). Any ideas on how to do this? 回答1: Look into

Separate integration test task on gradle with android

别等时光非礼了梦想. 提交于 2020-01-02 04:53:26
问题 I want to run tests that have the 'integration' word in the path to be excluded with the default test run, but I want to run them all together in a separate task. Currently I have a basic test configuration: sourceSets { androidTest.setRoot('src/test') integrationTest.setRoot('src/test') } ... androidTestCompile 'junit:junit:4.11' androidTestCompile 'com.jayway.android.robotium:robotium-solo:5.1' androidTestCompile files('libs/android-junit-report-1.5.8.jar') androidTestCompile 'com.squareup

How to interact with components rendered by ReactTestRenderer / Jest

拥有回忆 提交于 2020-01-02 04:48:29
问题 I'm working with Jest and snapshot testing. What I'd like to do is render a component with ReactTestRenderer , then simulate clicking a button inside it, then verify the snapshot. The object returned by ReactTestRenderer's create call has a getInstance function that allows me to call its methods directly, but it does not seem to work with any of the find/scry methods in ReactTestUtils. I can manually traverse the tree and click the button, but it seems like there must be a better way: import

Check if one of divs contains my values in nightwatch

醉酒当歌 提交于 2020-01-02 04:41:08
问题 I have problem with testing my webapp with nightwatch.js. I need to iterate over all div elements on the page to check if there is the one who contains all child elements I added before. For example I have: <div className = 'myclass'> <h2> text1 </h2> <h3> second_text1 </h3> </div> <div className = 'myclass'> <h2> text2 </h2> <h3> second_text2 </h3> </div> And I want to check if one of divs contains both: 'text2' and 'second_text2'. I tried to add iter function like here: Assert text value of

Unable to find a SpringBootConfiguration in Spring Boot Test 1.4

被刻印的时光 ゝ 提交于 2020-01-02 04:40:11
问题 I'm not able to run a simple test in spring boot 1.4. I followed the tutorial from the official site testing-the-spring-mvc-slice but I didn't get it to work. every time i get the following error: java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test any ideas, hints? Thanks in advance Edit: this is the controller @Controller public class UserManagementController { @GetMapping(value = "

Jenkins multiconfiguration project handle concurrent device usage

故事扮演 提交于 2020-01-02 04:39:08
问题 Case I have a Jenkins slave witch run's calabash tests on mobile devices (android, ios). To separate on which machines (the mac for iOS or Linux for Android) the tests is run, I also use the Throttle Concurrent Builds Plug-in . This way I separate between the Android or Mac Jenkins slaves the devices are hooked to. I use a mapping table and a self written bash script to call a device by name and execute a test on this specific slave. The mapping table map's the name to the device id (or IP

Testing a Class inside of a Module with RSpec

Deadly 提交于 2020-01-02 04:34:32
问题 So, I have a module in my ruby code which looks something like this: module MathStuff class Integer def least_factor # implementation code end end end and I have some RSpec tests in which I would like to test that my Integer#least_factor method works as expected. we'll say that the tests are in the same file for simplicity. The tests look something like this: describe MathStuff do describe '#least_factor' do it 'returns the least prime factor' do expect(50.least_factor).to eq 2 end end end

Using Mocks inside Doctests?

吃可爱长大的小学妹 提交于 2020-01-02 03:45:09
问题 I am using doctests. I am wondering what is the correct way to doctest a function that performs an external action (e.g. sends email, connects to a server, etc)? Using Mock seems like the answer but it will muddy up the doc string of the function. For example: class SSHConnection(BaseConnection): """Provides basic SSH functions. >>> host = '127.0.0.1' >>> port = 22 >>> username = 'user' >>> password = 'password' >>> ssh = SSHConnection(host, username, password, port) >>> ssh.execute('uname -a

How to test angular decorator functionality

Deadly 提交于 2020-01-02 03:28:07
问题 I have a decorator in Angular that is going to extend the functionality of the $log service and I would like to test it, but I don't see a way to do this. Here is a stub of my decorator: angular.module('myApp') .config(function ($provide) { $provide.decorator('$log', ['$delegate', function($delegate) { var _debug = $delegate.debug; $delegate.debug = function() { var args = [].slice.call(arguments); // Do some custom stuff window.console.info('inside delegated method!'); _debug.apply(null,

How do you reliably wait for page idle in cypress.io test

ぐ巨炮叔叔 提交于 2020-01-02 03:04:14
问题 When using cypress.io to test an angular web page, whats the best / most reliable way to detect when the page is fully loaded and idle. Not just the onload event. Needs to include all XHR requests, angular digest cycles complete and all rendering complete including all animations complete. The reason is that at this point I want to test that the page does NOT contain an element and cant test that until all the above is fully complete. 回答1: You can make Cypress wait for any request to complete