testing

Is it a bad practice to randomly-generate test data?

纵然是瞬间 提交于 2019-12-21 04:40:50
问题 Since I've started using rspec, I've had a problem with the notion of fixtures. My primary concerns are this: I use testing to reveal surprising behavior. I'm not always clever enough to enumerate every possible edge case for the examples I'm testing. Using hard-coded fixtures seems limiting because it only tests my code with the very specific cases that I've imagined. (Admittedly, my imagination is also limiting with respect to which cases I test.) I use testing to as a form of documentation

Code coverage for people (manual) tests?

时间秒杀一切 提交于 2019-12-21 04:23:10
问题 Are there any code coverage tools for manual testing? For example, if I write 30 new lines of code, compile, then run, is there any way to quickly verify that all 30 lines were run? Also, later, after I've checked the code into an official build, is there any way that I can verify that the test department hit on all 30 lines of code when they conducted their independent testing? I know that there are a lot of tools for verifying that test departments test all requirements, but I haven't found

How to check a log/output in go test?

点点圈 提交于 2019-12-21 04:14:53
问题 I have this function that logs the error in some cases: func readByte(/*...*/){ // ... if err != nil { fmt.Println("ERROR") log.Print("Couldn't read first byte") return } // ... } Now, in the test file, I want to check the output error from this function: c.Assert(OUTPUT, check.Matches, "teste") How can I access the log? I tried to put a buffer but it didn't work. What is the right way to catch this log without change my readByte function code? 回答1: For example, readbyte_test.go : package

Node.js testing RESTful API (vows.js?)

时光总嘲笑我的痴心妄想 提交于 2019-12-21 04:14:05
问题 I could really do with some advice on testing a RESTful api I created in node.js. There are a plethora of frameworks out there and I am at a loss. My testing knowledge isn't good enough generally which is why I am trying to write these tests. I've tried vows.js which seems nice but I couldn't work out how to incorporate the testing of my API, I need some sort of client. An example of a simple post to test a login system is all I need to get going. 回答1: Update 6 months later vows-is sucks. use

Dependent tests in rspec

微笑、不失礼 提交于 2019-12-21 04:13:25
问题 I write functional tests, and I need to do tests that were being would depend on the passage of previous tests. Let's say I have a button that opens a window in which there is a functional. That is, in order to check this functionality, I need to first check the correct operation of the button (ie, open window or not functional). So, I need to do so that would be if the test failed on a button click, the tests did not run to check the functional window. Writing tests separately - for me is

How to do concurrent modification testing for grails application

可紊 提交于 2019-12-21 04:08:36
问题 I'd like to run tests that simulate users modifying certain data at the same time for a grails application. Are there any plug-ins / tools / mechanisms I can use to do this efficiently? They don't have to be grails specific. It should be possible to fire multiple actions in parallel. I'd prefer to run the tests on functional level (so far I'm using Selenium for other tests) to see the results from the user perspective. Of course this can be done in addition to integration testing if you'd

Check there were no errors in the browser console with Protractor

a 夏天 提交于 2019-12-21 04:05:16
问题 I'm using Protractor to test AngularJS I want to check that at the end of the test no uncaught exceptions occurred and were printed to the browser console. Is there a simple way to do that? 回答1: If you're using Protractor with Jasmine, use the following code: afterEach(function() { browser.manage().logs().get('browser').then(function(browserLog) { expect(browserLog.length).toEqual(0); }); }); This will pass the test case if there are no console errors. If there are any console errors, the

Why EclEmma doesn't coverage code with tests with @RunWith(PowerMockRunner.class)

烂漫一生 提交于 2019-12-21 04:03:26
问题 I am using EclEmma with Eclipse to help me to know where is missing code tests in my project, but all tests with @RunWith(PowerMockRunner.class) are not called and thus not tested. I´m using JUnit 4.8.1 with Mockito. What could it be? 回答1: Its a known bug reported for both parties: http://code.google.com/p/powermock/issues/detail?id=402 https://github.com/jacoco/eclemma/issues/15#issuecomment-9565210 eCoberture seems however to provide correct coverage. The only problem, that it seems not to

How to explicitly specify a path to Firefox for Selenium?

末鹿安然 提交于 2019-12-21 03:59:20
问题 I got Selenium IDE, followed this post, got to python test_default_server.py and it complains Firefox is not in my path: Please add the directory containing ''firefox.exe'' to your PATH environment variable, or explicitly specify a path to Firefox 3 like this: *firefox3c:\blah\firefox.exe I could change my PATH environment variable, but I'd rather pursue the local config option they are mentioning ("explicitly specify a path"). How do I do that? What does the "*firefox3c" refer to? Selenium 1

C# REPL tools; quick console-like compiling tool

旧巷老猫 提交于 2019-12-21 03:58:24
问题 Often times, I start a new instance of Visual Studio, just to create a console application that has some output and/or input. It's a temporary sandbox I use to test a method or something else and close a few minutes later. Can you think of any tools to replace this? I use to have an application that had two text fields: one on top to take C# code, and one on the bottom, to act as an stdout. But I can't remember the name. 回答1: Take a look at LINQPad. It's light-weight and has lots of features.