tdd

Am I mock too much or doing TDD and unit testing the right way?

走远了吗. 提交于 2020-01-05 11:07:06
问题 I'm developing web application by using Laravel and this web app has to connect to internal service. I choose to do TDD in this project and now I'm facing with problem about too much dependencies to mock. In RegisterController , we allow user to login and upgrade their account type, see code below: public function loginForUpgradeAccount() { $data = Input::only('email', 'hashedPassword'); if (!empty($data['email']) && !empty($data['hashedPassword'])) { $email = $data['email']; $hashedPassword

Sending SMS text message using twilio not working

浪尽此生 提交于 2020-01-05 10:25:14
问题 I am trying to send SMS message from c# unit test code but I am not able to receive the text message and I don't know where to debug this. Also, inside my response object, I get the value "Bad Request". What am I doing wrong. Also in while loop, I wait for the response to get processed. Here is my code. [TestMethod] public void TestMethod1() { Assert.IsTrue(SendMessage("+1MYFROMPHONENUMBER", "+1MYTOPHONENUMBER", "sending from code")); } public bool SendMessage(string from, string to, string

NUnit tests being ignored

五迷三道 提交于 2020-01-05 07:11:13
问题 I have the following test fixture class and for reasons beyond me NUnit decides to run all of the test classes around this one but not this one using System.Workflow.Runtime; using System.Workflow.Runtime.Hosting; using MyProject; using NUnit.Framework; namespace MyProject.Test { [TestFixture] public class MyProjectTests { private const string Description = "This is a test Description generated through UNIT Tests"; private ManualWorkflowSchedulerService scheduler; private WorkflowRuntime

Create automated tests for interactive shell based on Python's cmd module

给你一囗甜甜゛ 提交于 2020-01-04 04:13:24
问题 I am building an interactive shell using Python 3 and the cmd module. I have already written simple unit tests using py.test to test the individual functions, such as the do_* functions. I'd like to create more comprehensive tests that actually interact with the shell itself by simulating a user's input. For example, how could I test the following simulated session: bash$ console-app.py md:> show options Available Options: ------------------ HOST The IP address or hostname of the machine to

Angular test error: Cannot read property 'subscribe' of undefined at new RouterLinkWithHref

南楼画角 提交于 2020-01-03 11:03:51
问题 I don't get what I'm doing wrong, I didn't find any link of RouterLinkWithHref to any error in tests, furthermore I'm not using RouterLinkWithHref anywhere, as far as I know :/ Can anyone help me with this: fdescribe('AddItemComponent: ', () => { let cmp: AddItemComponent; let fixture: ComponentFixture<AddItemComponent>; let de: DebugElement; let el: HTMLElement; const mockRouter = { navigate: jasmine.createSpy('navigate') }; const mockCustomCardService = { getItemDeliveryDate: () =>

Angular test error: Cannot read property 'subscribe' of undefined at new RouterLinkWithHref

冷暖自知 提交于 2020-01-03 11:03:12
问题 I don't get what I'm doing wrong, I didn't find any link of RouterLinkWithHref to any error in tests, furthermore I'm not using RouterLinkWithHref anywhere, as far as I know :/ Can anyone help me with this: fdescribe('AddItemComponent: ', () => { let cmp: AddItemComponent; let fixture: ComponentFixture<AddItemComponent>; let de: DebugElement; let el: HTMLElement; const mockRouter = { navigate: jasmine.createSpy('navigate') }; const mockCustomCardService = { getItemDeliveryDate: () =>

Rails - Testing fixtures error NoMethodError: undefined method `type' for nil:NilClass

谁说我不能喝 提交于 2020-01-03 07:27:28
问题 I have a problem running tests that use fixtures with associations between models. Here's the error I get, as soon as I run rake test : ERROR["test_truth", SevenPortfolioTest, 0.005154775] test_truth#SevenPortfolioTest (0.01s) NoMethodError: NoMethodError: undefined method `type' for nil:NilClass ERROR["test_should_destroy_item_video", SevenPortfolio::ItemVideosControllerTest, 0.008887804] test_should_destroy_item_video#SevenPortfolio::ItemVideosControllerTest (0.01s) NoMethodError:

Unit test framework - TestNG using configurable value to define threadPoolSize

岁酱吖の 提交于 2020-01-02 23:45:50
问题 I'm digging little bit the TestNG framework. I'm using annotations to configure thread values in my test case, example: @Test(threadPoolSize = 2, invocationCount = 10) public void testOne() { //some code } The idea is config these values in a config file and this values should be passed to all tests. So I need to change these values from a config entry or pass this value through unitTest constructor, but TestNG is only accepting CONSTANT values. Any tips/ideas? Thanks in advance! 回答1: Use an

Unit testing on “react + react-route” stack

蓝咒 提交于 2020-01-02 16:15:23
问题 I've read many recommendations of how it's possible to render routed via react-router components, but I still can't to make it work. I tried to find it using github codebase search, still no luck. And at this point all I need is one working example. Here is my boilerplate project, but maybe it's not important. I just want to see some react-route unit-testing working example. 回答1: I got mine working after I found the super-secret hidden react-router testing guide. Instead of using Object

Unit testing on “react + react-route” stack

吃可爱长大的小学妹 提交于 2020-01-02 16:15:07
问题 I've read many recommendations of how it's possible to render routed via react-router components, but I still can't to make it work. I tried to find it using github codebase search, still no luck. And at this point all I need is one working example. Here is my boilerplate project, but maybe it's not important. I just want to see some react-route unit-testing working example. 回答1: I got mine working after I found the super-secret hidden react-router testing guide. Instead of using Object