Search in sources :

Example 1 with TestSuite

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

the class TestSuitePart method refreshVisuals.

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

Example 2 with TestSuite

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

the class TestSuitePart method getModelSpecificChildren.

protected List<IEntity> getModelSpecificChildren() {
    TestSuite 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.getFilterFamilies());
    list.add(entity.getTestCases());
    return list;
}
Also used : TestSuite(org.whole.lang.tests.model.TestSuite) IEntity(org.whole.lang.model.IEntity) ArrayList(java.util.ArrayList)

Example 3 with TestSuite

use of org.whole.lang.tests.model.TestSuite 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 4 with TestSuite

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

the class TestsInterpreterVisitorTest method testInterpreter.

@Test
public void testInterpreter() throws Exception {
    TestSuite testSuite = new TestSuiteCompleted().create();
    IEntity result = InterpreterOperation.interpret(testSuite).getResult();
    Assert.assertEquals(1, result.wGet(0).wIntValue());
    Assert.assertEquals(0, result.wGet(1).wIntValue());
    Assert.assertEquals(0, result.wGet(2).wIntValue());
}
Also used : TestSuite(org.whole.lang.tests.model.TestSuite) IEntity(org.whole.lang.model.IEntity) Test(org.junit.Test)

Example 5 with TestSuite

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

the class TestsInterpreterVisitorTest method testLearningInterpreter.

@Test
public void testLearningInterpreter() throws Exception {
    TestSuite testSuiteToComplete = new TestSuiteToComplete().create();
    TestSuite testSuiteCompleted = new TestSuiteCompleted().create();
    IBindingManager bm = BindingManagerFactory.instance.createArguments();
    bm.wDefValue("learnMode", true);
    bm.wDefValue("learnCycles", 2);
    IEntity result = InterpreterOperation.interpret(testSuiteToComplete, bm).getResult();
    Assert.assertEquals(1, result.wGet(0).wIntValue());
    Assert.assertEquals(0, result.wGet(1).wIntValue());
    Assert.assertEquals(0, result.wGet(2).wIntValue());
    result = InterpreterOperation.interpret(testSuiteCompleted).getResult();
    Assert.assertEquals(1, result.wGet(0).wIntValue());
    Assert.assertEquals(0, result.wGet(1).wIntValue());
    Assert.assertEquals(0, result.wGet(2).wIntValue());
    // remove timestamps from both the models
    IEntityIterator<IEntity> iterator = IteratorFactory.descendantOrSelfMatcherIterator().withPattern(JavaEntityDescriptorEnum.LongLiteral);
    iterator.reset(testSuiteToComplete);
    while (iterator.hasNext()) {
        iterator.next();
        iterator.remove();
    }
    iterator = IteratorFactory.descendantOrSelfMatcherIterator().withPattern(JavaEntityDescriptorEnum.LongLiteral);
    iterator.reset(testSuiteCompleted);
    while (iterator.hasNext()) {
        iterator.next();
        iterator.remove();
    }
    Assert.assertTrue(Matcher.match(testSuiteCompleted, testSuiteToComplete));
}
Also used : TestSuite(org.whole.lang.tests.model.TestSuite) IEntity(org.whole.lang.model.IEntity) IBindingManager(org.whole.lang.bindings.IBindingManager) Test(org.junit.Test)

Aggregations

TestSuite (org.whole.lang.tests.model.TestSuite)6 IEntity (org.whole.lang.model.IEntity)3 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 IBindingManager (org.whole.lang.bindings.IBindingManager)1 FilterRule (org.whole.lang.tests.model.FilterRule)1 Name (org.whole.lang.tests.model.Name)1 TestCase (org.whole.lang.tests.model.TestCase)1