You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@deltaspike.apache.org by "l.penet@senat.fr" <l....@senat.fr> on 2016/10/12 12:00:48 UTC

A question on ProjectStage and CdiTestSuiteRunner

Hi,


I have a question on using ProjectStage in test to discriminate UnitTest 
and IntegrationTest.

It seems to me that in previous releases of DS, I could set the project 
stage in tests using the system property org.apache.deltaspike.ProjectStage.

Today, when I launch tests driven by the CdiTestSuiteRunner, it 
overrrides this setting. I can of course set it using an annotation, but 
I use the same tests configuration for unit test and integration test, 
so I would like to be able to do that with properties.

Thanks in advance,

Ludovic


|
| AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
|


Re: A question on ProjectStage and CdiTestSuiteRunner

Posted by Gerhard Petracek <ge...@gmail.com>.
hi ludovic,

it isn't intended, however, what you can do is e.g.:

@RunWith(CdiTestRunner.class)
@TestControl(projectStage = ProjectStage.UnitTest.class)
public class UTTest
{
    @Test
    public void case1()
    {
        //project-stage unit-test is active
    }
}

@RunWith(CdiTestRunner.class)
@TestControl(projectStage = ProjectStage.IntegrationTest.class)
public class ITTest extends UTTest
{
    //project-stage integration-test is active
    //(no test-methods here, because you would like to re-use the
test-methods provided by UTTest)
}

->

@RunWith(CdiTestSuiteRunner.class)
@Suite.SuiteClasses({UTTest.class})
public class UTTestSuite {
}

and

@RunWith(CdiTestSuiteRunner.class)
@Suite.SuiteClasses({ITTest.class})
public class ITTestSuite {
}

regards,
gerhard



2016-10-12 14:00 GMT+02:00 l.penet@senat.fr <l....@senat.fr>:

> Hi,
>
>
> I have a question on using ProjectStage in test to discriminate UnitTest
> and IntegrationTest.
>
> It seems to me that in previous releases of DS, I could set the project
> stage in tests using the system property org.apache.deltaspike.ProjectS
> tage.
>
> Today, when I launch tests driven by the CdiTestSuiteRunner, it overrrides
> this setting. I can of course set it using an annotation, but I use the
> same tests configuration for unit test and integration test, so I would
> like to be able to do that with properties.
>
> Thanks in advance,
>
> Ludovic
>
>
> |
> | AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT.
> |
>
>