Git Product home page Git Product logo

aj_tools_unittest's Introduction

GitHub top language GitHub release (latest by date including pre-releases)

AJ_Tools_UnitTest

AJ_Tools_UnitTest is a component developed with 4D v17 R5. Its purpose is to give 4D developers a way to do unit test and partial integration tests within 4D.

It is made to be used in development environment but not in production. You can write unit tests and partial integration tests (no UI). You cannot write functional tests with this component.

Credits

This component was created under the inspiration of the Javascript unit test library RITEway developed by Eric Elliott, which is a master in the Test Driven Development.

Those 2 articles was the main resources that inspired me to developer AJ_Tools_UnitTest component. JavaScript Testing: Unit vs Functional vs Integration Tests Rethinking Unit Test Assertions

Documentation

wiki AJ_Tools_UnitTest

Example v2 (From v18 R3)

      // __UNIT_TEST

    $test:=AJ_UnitTest .new("Sum()";Current method name;"Math")

    $test.given:="no parameters"
    $test.should:="return 0"
    $test.expected:=0
    $test.actual:=zz_sum
    $test.assert()

    $test.given:="1 parameter (here 5)"
    $test.should:="return 10 (addition itself)"
    $test.expected:=10
    $test.actual:=zz_sum (5)
    $test.assert()

    $test.given:="3 and 3"
    $test.should:="return 6"
    $test.expected:=6
    $test.actual:=zz_sum (3;3)
    $test.assert()

Example (Before v18 R3)

      // __UNIT_TEST

    $test:=New AJ_Tools_UT_describe ("Sum()";Current method name;"Math")

    $test.given:="no parameters"
    $test.should:="return 0"
    $test.expected:=0
    $test.actual:=zz_sum
    $test.assert()

    $test.given:="1 parameter (here 5)"
    $test.should:="return 10 (addition itself)"
    $test.expected:=10
    $test.actual:=zz_sum (5)
    $test.assert()

    $test.given:="3 and 3"
    $test.should:="return 6"
    $test.expected:=6
    $test.actual:=zz_sum (3;3)
    $test.assert()

Results Window

All tests pass Result Window - all tests pass One test fails Result Window - one test fails

Version

Minimal 4D Version :

  • 18 (using formula member function)
  • 18 R3 (using class)

Questions?

If you have any question, you can ask them directly on github or write to [email protected]

aj_tools_unittest's People

Contributors

minzirillo avatar zankorius avatar

Watchers

 avatar

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.