Гость
Целевая тема:
Создать новую тему:
Автор:
Форумы / Java [игнор отключен] [закрыт для гостей] / Junit4 и TestNG в одном проекте с Maven с наследованием / 1 сообщений из 1, страница 1 из 1
13.06.2012, 07:52:49
    #37835774
recvezitor
Участник
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Junit4 и TestNG в одном проекте с Maven с наследованием
Создал простой проект в котором мне нужно испльзовать junit4 and testng
Вот корневой пом:

Код: java
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
50.
51.
52.
53.
54.
55.
56.
57.
58.
59.
60.
61.
62.
63.
64.
65.
66.
67.
68.
69.
70.
71.
72.
73.
74.
75.
76.
77.
78.
79.
80.
81.
82.
83.
84.
85.
86.
87.
88.
89.
90.
<groupId>com.dimas.testmodule</groupId>
                <artifactId>TheParent</artifactId>
                <version>0.0.001</version>
                <name>TheParent</name>
                <packaging>pom</packaging>
            
                <properties>
                    <spring.version>3.0.5.RELEASE</spring.version>
                    <spring.scope>test</spring.scope>
                    <maven.surefire.plugin.version>2.9</maven.surefire.plugin.version>
                </properties>
            
                <dependencies>
                    <dependency>
                        <groupId>junit</groupId>
                        <artifactId>junit</artifactId>
                        <version>4.7</version> 
                           <scope>test</scope>
                        </dependency>
            ...etc
                    </dependencies>
            
                <build>
                    <finalName>${project.artifactId}</finalName>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-compiler-plugin</artifactId>
                            <version>2.3.2</version>
                            <configuration>
                                <source>1.6</source>
                                <target>1.6</target>
                            </configuration>
                        </plugin>
                    </plugins>
                </build>
            
                <profiles>
                    <profile>
                        <id>default</id>
                        <activation>
                            <activeByDefault>true</activeByDefault>
                        </activation>
                        <modules>
                            <module>JUnitOnly</module>
                            <module>TestNGOnly</module>
                            <module>testmodule</module>
                        </modules>
                        <build>
                            <plugins>
                                <plugin>
                                    <groupId>org.apache.maven.plugins</groupId>
                                    <artifactId>maven-surefire-plugin</artifactId>
                                    <version>${maven.surefire.plugin.version}</version>
                                    <configuration>
                                        <redirectTestOutputToFile>false</redirectTestOutputToFile>
    <excludes>
                                    <exclude>**/*NGTest.java</exclude>
                                </excludes>
                                    </configuration>
                                </plugin>
                            </plugins>
                        </build>
                    </profile>
            
                    <profile>
                        <id>testNGonly</id>
                        <modules>
                            <module>JUnitOnly</module>
                            <module>TestNGOnly</module>
                            <module>testmodule</module>
                        </modules>
            
                        <build>
                            <plugins>
                                <plugin>
                                    <groupId>org.apache.maven.plugins</groupId>
                                    <artifactId>maven-surefire-plugin</artifactId>
                                    <version>${maven.surefire.plugin.version}</version>
                                    <configuration>
                                        <redirectTestOutputToFile>false</redirectTestOutputToFile>
                                        <includes>
                                            <include>**/*NGTest.java</include>
                                        </includes>
                                    </configuration>
                                </plugin>
                            </plugins>
                        </build>
                    </profile>
                </profiles>



молули JUnitOnly and TestModule просто наследуюит корневой пом и ничего не переопределяют. А вот пом для TestNgOnly


Код: java
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
<groupId>com.dimas.testmodule.testngonly</groupId>
        <artifactId>TestNGOnly</artifactId>
        <version>0.0.001</version>
        <name>testngonly</name>
        <parent>
            <groupId>com.dimas.testmodule</groupId>
            <artifactId>TheParent</artifactId>
            <version>0.0.001</version>
        </parent>
    
        <dependencies>
            <dependency>
                <groupId>org.testng</groupId>
                <artifactId>testng</artifactId>
                <version>6.3.1</version>
                <scope>provided</scope>
            </dependency>
        </dependencies>
    
        <profiles>
            <profile>
                <id>testNGtest</id>  
                <build>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-surefire-plugin</artifactId>
                            <version>${maven.surefire.plugin.version}</version>
                            <configuration>
                                <redirectTestOutputToFile>false</redirectTestOutputToFile>
                                <suiteXmlFiles>
                                    <suiteXmlFile>
                                        <!--test/resources/my-testng.xml-->
                                        src\test\resources\my-testng.xml
                                    </suiteXmlFile>
                                </suiteXmlFiles>
                            </configuration>
                        </plugin>
                    </plugins>
                </build>
            </profile>
        </profiles>



Вобщем мне надо игнорить все testng тесты в дефолтном профиле и запускать только testng в профиле testNGOnly. Причем в одном модуле могут быть как testng так и junit тесты
...
Рейтинг: 0 / 0
Форумы / Java [игнор отключен] [закрыт для гостей] / Junit4 и TestNG в одном проекте с Maven с наследованием / 1 сообщений из 1, страница 1 из 1
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]