
2 changed files with 59 additions and 0 deletions
@ -0,0 +1,25 @@ |
|||||
|
include ../Makefile.conf |
||||
|
|
||||
|
TEST_UNIT_NAME=testsuite |
||||
|
|
||||
|
JAVA_CLASSES = \
|
||||
|
TestMain.class \
|
||||
|
|
||||
|
# Use the test framework
|
||||
|
JAVA_CLASSES += $(JAVA_CLASSES_FRAMEWORK) |
||||
|
|
||||
|
.PHONY: compile run test clean |
||||
|
|
||||
|
all: compile |
||||
|
$(MAKE) run |
||||
|
|
||||
|
run: compile |
||||
|
cd $(JAVA_CWD);$(JAVA) $(JAVA_PKG_BASENAME).$(TEST_UNIT_NAME).TestMain |
||||
|
|
||||
|
compile: $(JAVA_CLASSES) |
||||
|
|
||||
|
%.class: %.java |
||||
|
cd $(JAVA_CWD);pwd;javac $(JAVA_PKG_BASEPATH)/$(TEST_UNIT_NAME)/$< |
||||
|
|
||||
|
clean: |
||||
|
rm -f $(JAVA_CLASSES) |
@ -0,0 +1,34 @@ |
|||||
|
package foundation.pEp.jniadapter.test.framework.examples.testsuite; |
||||
|
import static foundation.pEp.jniadapter.test.framework.TestLogger.*; |
||||
|
import foundation.pEp.jniadapter.test.framework.*; |
||||
|
|
||||
|
class TestSuiteTestContext extends AbstractTestContext { |
||||
|
String name; |
||||
|
|
||||
|
@Override |
||||
|
public void init() throws Throwable { |
||||
|
name = "UnitTestFrameWorkWithoutAName"; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
class TestMain { |
||||
|
public static void main(String[] args) throws Exception { |
||||
|
TestSuite.setVerbose(true); |
||||
|
|
||||
|
new TestUnit<TestSuiteTestContext>("Unit Test 1", new TestSuiteTestContext(), ctx -> { |
||||
|
log("Unit Test 1 " + ctx.name); |
||||
|
ctx.name = "new name"; |
||||
|
}).add(); |
||||
|
|
||||
|
new TestUnit<TestSuiteTestContext>("Unit Test 2", new TestSuiteTestContext(), ctx -> { |
||||
|
log("Unit Test 2 " + ctx.name); |
||||
|
}).add(); |
||||
|
|
||||
|
new TestUnit<TestSuiteTestContext>("Unit Test 3", new TestSuiteTestContext(), ctx -> { |
||||
|
log("Unit Test 3 Failing " + ctx.name); |
||||
|
int x = 4 / 0; |
||||
|
}).add(); |
||||
|
|
||||
|
TestSuite.run(); |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue