testing

How can I test different environments (e.g. development|test|production) in Cucumber?

一笑奈何 提交于 2020-01-02 07:59:42
问题 Take this scenario. I have a Google Analytics tracking code, and I only want it to show up in Production mode. So I might have two scenarios like this: Scenario: Don't embed tracking code in development or test mode Given the app is not in production mode When I go home Then I should really not see the tracking code Scenario: Embed tracking code in production mode Given the app is in production mode When I go home Then I should really see the tracking code So although I know how to check what

How to conciliate TDD with SUT interface's contracts?

删除回忆录丶 提交于 2020-01-02 07:28:23
问题 Assuming we are implementing using TDD a Stack class, we would need, for each bit of functionality of our Stack class, to add a new test that exercises it: [TestMethod] public void Should_Be_Empty_After_Instantiation() [TestMethod] public void Should_Not_Be_Empty_After_Pushing_One_Item() ... Now, on the other hand, when doing Unit-Tests, one should focus on what external behaviour our class is supposed to provide, so the set of Unit-Tests check that all the expected contracts for my Stack

Writing tests for Python Eve RESTful APIs against a real MongoDB

匆匆过客 提交于 2020-01-02 07:26:12
问题 I am developing my API server with Python-eve, and would like to know how to test the API endpoints. A few things that I would like to test specifically: Validation of POST/PATCH requests Authentication of different endpoints Before_ and after_ hooks working property Returning correct JSON response Currently I am testing the app against a real MongoDB, and I can imagine the testing will take a long time to run once I have hundreds or thousands of tests to run. Mocking up stuff is another

Selenium in -browserSessionReuse mode launchs a new browser

别来无恙 提交于 2020-01-02 07:09:20
问题 I'm trying the -browserSessionReuse Selenium mode to speed up my tests but i've noticed a strange behaviour. The purpose of this mode is avoid the time wasted opening browsers between tests, and this is how it works. But not always, if i run tests continuously they are run in the same browser, correct. But if between each test run pass some minutes, it will forget it has an already opened browser and it opens a new one. I suppose there is a timeout to discard the "old" browser, but i don't

How do I test localization in a winforms application?

拟墨画扇 提交于 2020-01-02 07:05:37
问题 Is there a way to test different languages in a Windows application without changing the localization of the OS or adding code to the application to forcibly change the current culture? Perhaps some type of a launcher that will launch the application with a specified culture? 回答1: There is this AppLocale Utility for XP, which can also be installed on vista. AppLocale automatically detects language for non-Unicode program and simulates a corresponding system locale for code-page to/from

Protractor - get browser title as string

这一生的挚爱 提交于 2020-01-02 06:53:11
问题 I'd like to store initial device title, which is accessible via GUI in browser as page title, and reuse it later in the code. E.g. I want to change name of device if it is set to some particular name only, and to store an old device name in browser console log. Code might look like this: var some_name = 'Some Name'; var title = browser.getTitle(); console.log(title); if (title.equals('Some Name')){ some_name = 'Some Other Name'; } setDeviceName(some_name); unfortunately, to that protractor

Angular 2 — Mocking - No Provider for HTTP

↘锁芯ラ 提交于 2020-01-02 06:39:26
问题 Angular 2.0.0 - Ionic 2 RC0 - Npm 3.10.8 - Node v4.5.0 - Karma 1.3.0 - Jasmine 2.5.2 I'm trying to test my application with Karma & Jasmine. Now I got to the point where I followed some guides (I'm new to these testing frameworks). But sadly enough I'm getting an error when trying to execute my test. I'm trying to test EventsPage which doesn't have an Http import but it calls my APICaller.service which does use Http. That's why I created a MockAPICaller but it seems to still want Http (maybe

Functional test and nested resource

混江龙づ霸主 提交于 2020-01-02 06:18:53
问题 I have a Story resource nested in a User resource. How do I fix this generate functional test? test "should create story" do assert_difference('Story.count') do post :create, story: @story.attributes end assert_redirected_to story_path(assigns(:story)) end DGM solution still have the story_url problem 回答1: You need to provide the user id it is nested in: post :create, story: @story.attributes, user_id: @user.id The path may be something like, user_story_path(@user.id, assigns(:story)) 来源:

Functional test and nested resource

好久不见. 提交于 2020-01-02 06:18:31
问题 I have a Story resource nested in a User resource. How do I fix this generate functional test? test "should create story" do assert_difference('Story.count') do post :create, story: @story.attributes end assert_redirected_to story_path(assigns(:story)) end DGM solution still have the story_url problem 回答1: You need to provide the user id it is nested in: post :create, story: @story.attributes, user_id: @user.id The path may be something like, user_story_path(@user.id, assigns(:story)) 来源:

PlayFramework Testing: Uploading File in Fake Request Errors

ⅰ亾dé卋堺 提交于 2020-01-02 05:50:09
问题 I want to test my method, which requires uploading a file. It is initialized like this: val tempFile = TemporaryFile(new java.io.File("/home/ophelia/Desktop/students")) val part = FilePart[TemporaryFile]( key = "students", filename = "students", contentType = Some("text/plain"), ref = tempFile) val files = Seq[FilePart[TemporaryFile]](part) val formData = MultipartFormData( dataParts = Map(), files = Seq(part), badParts = Seq(), missingFileParts = Seq()) I pass it into the FakeRequest: val