Giter Club home page Giter Club logo

Comments (1)

javagl avatar javagl commented on June 19, 2024

I agree that such a case could be added.

A bit more generally, this is related to #226 . One could consider roughly the approaches:

  • write "classical" unit tests, that set up some data + mocks, and check the result of calling a certain function
  • use the more "holistic" ("integration-level") approach of trying to create one invalid file for each possible validation issue

Right now, the latter is used.

And I think that there is some benefit in having the actual file with the actual issue.

(A bit snarky: I'm pretty sure that there is a considerable number of "unit tests" in the world that do not really test functionality - in some cases they are testing whether something was mocked in a certain way. It's an art, and I'm by no means claiming that I'm doing the right thing, but for the validator, using that "file-based" level of tests seemed to make sense)

One drawback: There may be many files, and there could be quite some redundancy.

For example, the case that you described will be validated by the FeatureIdValidator. And this will use the same code path, regardless of whether the feature IDs come from an attribute or from a texture. So one could create a test for feature ID textures and a nullFeatureId, but it will "only" be another test of this particular function.

In the more "classical" unit-test approach, this function would be covered explicitly and only once (with all combinations of inputs) with something like

const featureIdSet = ...;
const nullFeatureId = ...;
FeatureIdValidator.validateFeatureIdSet(... featureIdSet, nullFeatureId, mockContext);
expect(mockContext.issues.length).toBe(1);

I'll keep this open as a reminder, even though increasing the test coverage is an ongoing task.

from 3d-tiles-validator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.