New answers tagged

2

Say it's broken. Say you're thinking about something else entirely and don't have a lot of patience for this bug. Which test do you wish had been written now? I test as much as I can get away with. At some point you have to stop and get paid. Keeping that in mind, it's not simply behavor. It's the boundaries. Your behavor is 'show me the neighbors'. ...


7

You can do two things: First, use parameterized tests to minimize the duplication of the test code: cases([ [0, [1, 8, 9]], [1, [0, 2, 8, 9, 10]], // more testcases here ]) .it('sample', function(n, expected) { expect(getNeighbors(n)).toEqual(expected); }); Second, partition your testcases into equivalence classes where ...


10

The short answer is "No". The more interesting part is why/how this situation might arise. I think the confusion is arising because you're trying to adhere to strict testing practices (unit tests vs integration tests, mocking, etc.) for code which doesn't seem to adhere to strict practices. That's not to say the code is "wrong", or that particular ...


8

Another point I like to add to Killian's answer is that unit tests run very quickly, so we can have 1000s of them. An integration test typically takes longer because it is calling web services, databases, or some other external dependency, so we cannot run the same tests (1000s) for integration scenarios as they would take too much time. Also, unit tests ...


60

No, integration tests should not just duplicate the coverage of unit tests. They may duplicate some coverage, but that's not the point. The point of a unit test is to ensure that a specific small bit of functionality works exactly and completely as intended. A unit test for am_i_old_enough would test data with different ages, certainly the ones near the ...


2

I would argue that you want this in VCS. When you branch or tag the code, you're going to want to branch/tag your tests too. And with that your test data. Otherwise how do you know which data set ties up with which particular code set that you have. You could possibly contain a reference to a dataset within your versioned codebase, and store the actual ...


1

Obviously putting the test data under VCS wouldn't work Why not? And what about LFS? Even without LFS, you need to think twice before discarding version control solution. You tell only that there are some files which have a size of a few megabytes. No further indication. A dozen 5 MB files which change once per month for a 12-months project is not a big ...



Top 50 recent answers are included