All Projects → shohei909 → NanoTest

shohei909 / NanoTest

Licence: other
NanoTest is a light weight test library. Its API is similar to the haxe.unit testing framework, but it can run as pre-compilation macro and can output test failures as compiler warnings or errors.

Programming Languages

haxe
709 projects
Batchfile
5799 projects

Labels

Projects that are alternatives of or similar to NanoTest

kit-assignment-tests
Test collection for KIT programming assignments (WS16/17)
Stars: ✭ 18 (+28.57%)
Mutual labels:  test
Quizoo
Online Quiz Platform for conducting quizes
Stars: ✭ 27 (+92.86%)
Mutual labels:  test
xv
❌ ✔️ zero-config test runner for simple projects
Stars: ✭ 588 (+4100%)
Mutual labels:  test
fixturez
Easily create and maintain test fixtures in the file system
Stars: ✭ 57 (+307.14%)
Mutual labels:  test
dts-jest
A preprocessor for Jest to snapshot test TypeScript declaration (.d.ts) files
Stars: ✭ 102 (+628.57%)
Mutual labels:  test
dojos
Alguns desafios para os participantes dos grupos de estudo
Stars: ✭ 33 (+135.71%)
Mutual labels:  test
jest-it-up
🌐📈 Automatically bump up global Jest thresholds whenever coverage goes above them
Stars: ✭ 37 (+164.29%)
Mutual labels:  test
difflicious
Scala library for readable diffs of values
Stars: ✭ 50 (+257.14%)
Mutual labels:  test
jest-fixtures
Use file system fixtures in Jest
Stars: ✭ 39 (+178.57%)
Mutual labels:  test
demos
永恒君的案例库
Stars: ✭ 19 (+35.71%)
Mutual labels:  test
IO-TESTER
A functional test framework
Stars: ✭ 32 (+128.57%)
Mutual labels:  test
CI-Report-Converter
The tool converts different error reporting standards for deep compatibility with popular CI systems (TeamCity, IntelliJ IDEA, GitHub Actions, etc).
Stars: ✭ 17 (+21.43%)
Mutual labels:  test
BaseUrlManager
⛵ BaseUrlManager的设计初衷主要用于开发时,有多个环境需要打包APK的场景,通过BaseUrlManager提供的BaseUrl动态设置入口,只需打一次包,即可轻松随意的切换不同的开发环境或测试环境。在打生产环境包时,关闭BaseUrl动态设置入口即可。
Stars: ✭ 43 (+207.14%)
Mutual labels:  test
speed-cloudflare-cli
📈 Measure the speed and consistency of your internet connection using speed.cloudflare.com
Stars: ✭ 99 (+607.14%)
Mutual labels:  test
xray-action
... a GitHub action to import test results into "Xray" - A complete Test Management tool for Jira.
Stars: ✭ 16 (+14.29%)
Mutual labels:  test
AndcultureCode.Cli
and-cli command-line tool to manage the development of software applications
Stars: ✭ 14 (+0%)
Mutual labels:  test
to-string-verifier
To String Verifier provides an easy and convenient way to test the toString method on your class.
Stars: ✭ 25 (+78.57%)
Mutual labels:  test
kotlin-plugin-generated
A Kotlin compiler plugin that annotates Kotlin-generated methods for improved coverage reports
Stars: ✭ 33 (+135.71%)
Mutual labels:  test
airplayreceiver
Open source implementation of AirPlay 2 Mirroring / Audio protocol.
Stars: ✭ 84 (+500%)
Mutual labels:  test
jaymock-cli
Mock an API and generate fake JSON test data, right from the terminal.
Stars: ✭ 13 (-7.14%)
Mutual labels:  test

NanoTest is a light weight test library. Its interface is similar to the haxe.unit testing framework, but it can output test failures as compiler warnings or errors.

NanoTest with FlashDevelop

NanoTest

NanoTest with Intellij IDEA

NanoTest

NanoTest can display test failures as compiler warnings on the Result Panel of FlashDevelop and other IDEs.

Installing NanoTest

You can install NanoTest from haxelib.

haxelib install nanotest

Running test as macro

Create test classes and save them as sample/TestSample.hx.

package sample;
import nanotest.NanoTestRunner;
import nanotest.NanoTestCase;

class TestSample {
    static function main(){
        var r = new NanoTestRunner();
        r.add(new SampleCase());
        r.run();
    }
}

class SampleCase extends NanoTestCase {
    public function testBasic(){
        assertEquals( "A", "A" );
    }
}

Create compile.hxml with the content:

--next
-neko report/test.n
-main sample.FailureSample
-lib nanotest
-cp sample
-debug

--next
-cmd neko "report/test.n" 1>report/neko.txt

--next
-lib nanotest
--macro nanotest.NanoTestRunner.readResult('report/neko.txt', ['sample'], 'Neko')

Compile it on commandline

haxe compile.hxml

Output test failures as compilation errors

Use NanoTestRunner.error as failure output function.

var r = new NanoTestRunner(NanoTestRunner.error);

Improvements from haxe.unit

NanoTestCase has some addtional functions,

assertThrows(func:Void->Void, ?isSuccess:Dynamic->Bool, ?p:PosInfos)
assert a function expected to throw exception. If isSuccess function is set, the thrown exception is tested by the isSuccess function.
assertNotEquals(expected:T, ?actual:T, ?p:PosInfos)
assert values which do not equals
globalSetup()
setup which is run once per class of tests
globalTearDown()
tearDown which is run once per class of tests
success(?posInfos:PosInfos)
output a success
fail(message:String, ?posInfos:PosInfos)
output a failure
error(e:Dynamic)
output the current exception

and the assertEquals function supports EnumValue.

Use label

The label function can be used for subtending failures in same line.

class SampleCase extends NanoTestCase {
    public function testBasic() {
        var a = [1, 2, 3, 5];
        var b = [2, 2, 3, 3];
        for (i in 0...a.length) {
            assertEquals(a[i], b[i]).label(i);
        }
    }
}

This result is below.

Test failed : expected 1 but was 2 [0]
Test failed : expected 5 but was 3 [3]

License

The MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].