[ 
https://issues.apache.org/jira/browse/ISIS-767?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14066464#comment-14066464
 ] 

Dan Haywood commented on ISIS-767:
----------------------------------

Umm.  I don't think it's necessary to recreate the entire Isis system for each 
test, and the example apps don't... they store the IsisSystemForTest on a 
thread-local.

The main code is:

BootstrappingGlue:

    @Before(value={"@integration"}, order=100)
    public void beforeScenarioIntegrationScope() {
        org.apache.log4j.PropertyConfigurator.configure("logging.properties");
        ToDoSystemInitializer.initIsft();
        
        before(ScenarioExecutionScope.INTEGRATION);
    }


where:

public class ToDoSystemInitializer {
    
    public static IsisSystemForTest initIsft() {
        IsisSystemForTest isft = IsisSystemForTest.getElseNull();
        if(isft == null) {
            isft = new ToDoSystemBuilder().build().setUpSystem();
            IsisSystemForTest.set(isft);
        }
        return isft;
    }
    ...
}

.... where IsisSystemForTest.getElseNull() and IsisSystemForTest.set(...) wrap 
the thread-local.

~~~

With respect to database recreation, we now (in Isis 1.5.0) have fixture 
scripts, which I think go some way to addressing the point.

~~~

So... is there anything to do for this ticket?

Cheers
Dan


> Enable integration and BDD tests to do a lightweight teardown (eg zap 
> contents of tables) rather than tear down entire system.
> ------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: ISIS-767
>                 URL: https://issues.apache.org/jira/browse/ISIS-767
>             Project: Isis
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: core-1.4.0
>            Reporter: Dan Haywood
>            Assignee: Dan Haywood
>             Fix For: core-1.7.0
>
>
> Background to this is email from Oscar to dev list:
> We have implemented some BDD tests as Scenario Outlines [1].
> But just for one execution, is spending aprox. 15 min in completing a 
> Scenario Outline with aprox. 20 scenarios.
> The problem is that they become really slow, as the whole Isis system is 
> recreated for each example.
> Following best practices, Scenarios should be independent, but I think there 
> should be ways to guarantee it without sacrificing speed.
> - Isis System does not need to be recreated (introspected) for each Scenario, 
> as the source code has not changed.
> - Database can be recreated, or perhaps there's an "abstraction" on 
> DataNucleus or JDBC to empty a DataStore without re-creating the table 
> structure from the JDO annotations.
> Perhaps are other alternatives to improve their speed that does not require 
> refactoring the Isis BDD integrations tests implementation?
> Regards,
> Oscar
> [1] 
> http://jnye.co/Posts/11/repeating-bdd-tests-using-scenario-outlines-and-an-examples-table-with-specflow



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to