Search in sources :

Example 1 with TestCase

use of org.whole.lang.tests.model.TestCase in project whole by wholeplatform.

the class TestCasePart method getModelSpecificChildren.

protected List<IEntity> getModelSpecificChildren() {
    TestCase entity = getModelEntity();
    List<IEntity> list = new ArrayList<IEntity>(6);
    list.add(entity.getDescription());
    list.add(entity.getPackageName());
    list.add(entity.getName());
    list.add(entity.getDeployer());
    list.add(entity.getAspects());
    list.add(entity.getTests());
    return list;
}
Also used : TestCase(org.whole.lang.tests.model.TestCase) IEntity(org.whole.lang.model.IEntity) ArrayList(java.util.ArrayList)

Example 2 with TestCase

use of org.whole.lang.tests.model.TestCase in project whole by wholeplatform.

the class TestsDefaultEntityRegistryConfiguration method apply.

public void apply(IEntityRegistry er) {
    super.apply(er);
    TestsEntityFactory ef = TestsEntityFactory.instance(er);
    TestSuite testSuite = ef.createTestSuite();
    testSuite.setFilterFamilies(ef.createFilterFamilies(0));
    er.put(testSuite);
    TestCase testCase = ef.createTestCase();
    testCase.setAspects(ef.createAspects(0));
    er.put(testCase);
    er.put(ef.createAllOf(2));
    er.put(ef.createAnyOf(2));
}
Also used : TestSuite(org.whole.lang.tests.model.TestSuite) TestCase(org.whole.lang.tests.model.TestCase)

Example 3 with TestCase

use of org.whole.lang.tests.model.TestCase in project whole by wholeplatform.

the class TestCasePart method refreshVisuals.

@Override
protected void refreshVisuals() {
    TestCase entity = getModelEntity();
    getFigure().showDescription(EntityUtils.isNotResolver(entity.getDescription()));
    getFigure().showDeployer(EntityUtils.isNotResolver(entity.getDeployer()));
    getFigure().showAspects(EntityUtils.isNotResolver(entity.getAspects()));
    getFigure().updateResults(entity.getExpectedResults(), entity.getActualResults());
}
Also used : TestCase(org.whole.lang.tests.model.TestCase)

Example 4 with TestCase

use of org.whole.lang.tests.model.TestCase in project whole by wholeplatform.

the class TestsInterpreterVisitor method visit.

@Override
public void visit(TestSuite entity) {
    Results results = TestsEntityFactory.instance.createResults();
    printWriter().printf("=== %s test suite ===\n\n", entity.getName().getValue());
    getBindings().wDefValue("filterRulesMap", TestsHelpers.createFilterRulesMap(entity));
    TestCases testCases = entity.getTestCases();
    for (int i = 0; i < testCases.wSize(); i++) {
        TestCase testCase = testCases.get(i);
        if (getBindings().wIsSet("runSingleTest") && getBindings().wGet("runSingleTest").wGetParent().wGetParent() != testCase)
            continue;
        testCase.accept(this);
        Results testCaseResults = (Results) getResult();
        results.getErrors().setValue(results.getErrors().getValue() + testCaseResults.getErrors().getValue());
        results.getFailures().setValue(results.getFailures().getValue() + testCaseResults.getFailures().getValue());
        results.getSuccesses().setValue(results.getSuccesses().getValue() + testCaseResults.getSuccesses().getValue());
    }
    if (EntityUtils.isResolver(entity.getExpectedResults()))
        entity.setExpectedResults(EntityUtils.clone(results));
    if (!Matcher.match(results, entity.getActualResults()))
        entity.setActualResults(results);
    setResult(results);
}
Also used : Results(org.whole.lang.tests.model.Results) TestCase(org.whole.lang.tests.model.TestCase) AfterTestCase(org.whole.lang.tests.model.AfterTestCase) BeforeTestCase(org.whole.lang.tests.model.BeforeTestCase) TestCases(org.whole.lang.tests.model.TestCases) Constraint(org.whole.lang.tests.model.Constraint)

Aggregations

TestCase (org.whole.lang.tests.model.TestCase)4 ArrayList (java.util.ArrayList)1 IEntity (org.whole.lang.model.IEntity)1 AfterTestCase (org.whole.lang.tests.model.AfterTestCase)1 BeforeTestCase (org.whole.lang.tests.model.BeforeTestCase)1 Constraint (org.whole.lang.tests.model.Constraint)1 Results (org.whole.lang.tests.model.Results)1 TestCases (org.whole.lang.tests.model.TestCases)1 TestSuite (org.whole.lang.tests.model.TestSuite)1