testing

Label references for associations

两盒软妹~` 提交于 2021-02-07 18:11:11
问题 Rails provides label references for associations in fixtures like this: ### in pirates.yml reginald: name: Reginald the Pirate monkey: george ### in monkeys.yml george: name: George the Monkey pirate: reginald This works great for not-namedspaced models, but I'm using namespaces, and so Rails gets confused, and want to insert the labels instead of the label references. Any workaround or fix known? 回答1: Fixtures.identify seems to be the only solution, not really beautiful but better than ids.

Label references for associations

北城余情 提交于 2021-02-07 18:06:40
问题 Rails provides label references for associations in fixtures like this: ### in pirates.yml reginald: name: Reginald the Pirate monkey: george ### in monkeys.yml george: name: George the Monkey pirate: reginald This works great for not-namedspaced models, but I'm using namespaces, and so Rails gets confused, and want to insert the labels instead of the label references. Any workaround or fix known? 回答1: Fixtures.identify seems to be the only solution, not really beautiful but better than ids.

Why use OWIN TestServer?

点点圈 提交于 2021-02-07 12:53:52
问题 This article shows how to host an entire web API stack in memory for testing using OWIN: http://www.davidwhitney.co.uk/Blog/2015/01/07/testing-an-asp-net-webapi-app-in-memory/ Whereas this article shows using the OWIN TestServer to unit test controllers: https://blog.jcorioland.io/archives/2014/04/01/using-owin-to-test-your-web-api-controllers.html The difference I see is between the use of TestServer.Create and WebApp.Start<Startup> What is the key difference and why would you choose one

Angular service testing: Cannot find name 'asyncData'

点点圈 提交于 2021-02-07 11:17:47
问题 So I'm learning how to test services in Angular and I tried to copy the below example in the Angular docs. let httpClientSpy: { get: jasmine.Spy }; let heroService: HeroService; beforeEach(() => { // TODO: spy on other methods too httpClientSpy = jasmine.createSpyObj('HttpClient', ['get']); heroService = new HeroService(<any> httpClientSpy); }); it('should return expected heroes (HttpClient called once)', () => { const expectedHeroes: Hero[] = [{ id: 1, name: 'A' }, { id: 2, name: 'B' }];

How to show warnings in py.test

独自空忆成欢 提交于 2021-02-07 11:14:01
问题 I just ran py.test on my code and got the following output: ================== 6 passed, 2 pytest-warnings in 40.79 seconds ======================= However, I cannot see what py.test would like to warn me about. How can I turn on warning output to the console? py.test --help offers me the --strict flag: --strict run pytest in strict mode, warnings become errors. However I just want to see the output, not make my tests fail. I checked pytest.org and this question but they are only concerned

How can I run a Xamarin.UITest from the commandline?

放肆的年华 提交于 2021-02-07 09:10:57
问题 I would like to run tests (made using Xamarin.UITest) on my build server, which runs TeamCity on OS X. I have searched online on how to do this, but I am only able to find how these tests can be submitted to Xamarin Test Cloud. This is not what I want, I want to run the tests I wrote directly on devices (and/or simulators) connected to the build server. 回答1: according to the docs (requires NUnit 2.6.3) $ mono <path-to>/Nunit-2.6.3/bin/nunit-console.exe <path/to/uitest-assembly.dll> 回答2: Here

How can I run a Xamarin.UITest from the commandline?

被刻印的时光 ゝ 提交于 2021-02-07 09:10:20
问题 I would like to run tests (made using Xamarin.UITest) on my build server, which runs TeamCity on OS X. I have searched online on how to do this, but I am only able to find how these tests can be submitted to Xamarin Test Cloud. This is not what I want, I want to run the tests I wrote directly on devices (and/or simulators) connected to the build server. 回答1: according to the docs (requires NUnit 2.6.3) $ mono <path-to>/Nunit-2.6.3/bin/nunit-console.exe <path/to/uitest-assembly.dll> 回答2: Here

Can't mock final class in test using Mockito with Kotlin

旧城冷巷雨未停 提交于 2021-02-07 08:45:10
问题 I'm trying to run a simple instrumentation test: class DefaultTest { private val networkHelper = Mockito.mock(NetworkHelperImpl::class.java) @Test fun inter() { given(networkHelper.isConnectedToNetwork()).willReturn(true) assertFalse { networkHelper.isConnectedToNetwork(false) } } } But i cant bacause of error: Mockito cannot mock/spy because : - final class How can i avoid it? As this guide says: https://antonioleiva.com/mockito-2-kotlin/ I'm create file: With this line: mock-maker-inline

Can't mock final class in test using Mockito with Kotlin

给你一囗甜甜゛ 提交于 2021-02-07 08:44:38
问题 I'm trying to run a simple instrumentation test: class DefaultTest { private val networkHelper = Mockito.mock(NetworkHelperImpl::class.java) @Test fun inter() { given(networkHelper.isConnectedToNetwork()).willReturn(true) assertFalse { networkHelper.isConnectedToNetwork(false) } } } But i cant bacause of error: Mockito cannot mock/spy because : - final class How can i avoid it? As this guide says: https://antonioleiva.com/mockito-2-kotlin/ I'm create file: With this line: mock-maker-inline

Find commit that broke a test without running every test on every commit

耗尽温柔 提交于 2021-02-07 08:19:30
问题 I am trying to find a tool that can solve the following problem: Our entire test suite takes hours to runs which often makes it difficult or at least very time consuming to find out which commit broke a specific test since there may be 50 to 200 commits in between test runs. At any given time there are only very few broken tests, so rerunning only the broken tests is very fast compared to running the entire test suite. Is there a tool, e.g. a continuous integration server, that can rerun