java - Maven plugin Run after Selenium Test -
i developing selenium tests test various web applications. part of requirements have test start server, run test, stop server.
i can have test start server, attempts stop server before test started. there phase condition this?
my pom.xml <plugins></plugins>
follows
<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <groupid>cnphi.ft</groupid> <artifactid>ping</artifactid> <version>0.0.1-snapshot</version> <name>ping</name> <dependencies> <dependency> <groupid>cnphi.ft</groupid> <artifactid>functional-test-base</artifactid> <version>0.0.1-snapshot</version> </dependency> <dependency> <groupid>org.seleniumhq.selenium</groupid> <artifactid>selenium-firefox-driver</artifactid> <version>2.45.0</version> </dependency> </dependencies> <build> <plugins> <plugin> <artifactid>maven-compiler-plugin</artifactid> <version>3.3</version> <configuration> <source>1.6</source> <target>1.6</target> </configuration> </plugin> <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>exec-maven-plugin</artifactid> <version>1.2</version> <executions> <execution> <phase>pre-integration-test</phase> <id>startserver</id> <goals> <goal>exec</goal> </goals> </execution> </executions> <configuration> <executable>start.bat</executable> </configuration> </plugin> <!-- create directories store screenshots --> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-antrun-plugin</artifactid> <version>1.8</version> <executions> <execution> <id>create screenshot directory</id> <phase>generate-test-resources</phase> <configuration> <tasks> <echo message="creating test output directory" /> <mkdir dir="./target/screenshots/success" /> <mkdir dir="./target/screenshots/errorsandfailures" /> <mkdir dir="./target/screenshots/ignored" /> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> <!-- end create directories --> <!-- run tests integration tests --> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-failsafe-plugin</artifactid> <version>2.18.1</version> <configuration> <testfailureignore>true</testfailureignore> </configuration> <executions> <execution> <goals> <goal>integration-test</goal> <goal>verify</goal> </goals> </execution> </executions> </plugin> <!-- end integration test configuration --> <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>exec-maven-plugin</artifactid> <version>1.2</version> <executions> <execution> <phase>post-integration-test</phase> <id>stopserver</id> <goals> <goal>exec</goal> </goals> </execution> </executions> <configuration> <executable>stop.bat</executable> </configuration> </plugin> </plugins> <pluginmanagement> <plugins> <!--this plugin's configuration used store eclipse m2e settings only. has no influence on maven build itself. --> <plugin> <groupid>org.eclipse.m2e</groupid> <artifactid>lifecycle-mapping</artifactid> <version>1.0.0</version> <configuration> <lifecyclemappingmetadata> <pluginexecutions> <pluginexecution> <pluginexecutionfilter> <groupid> org.apache.maven.plugins </groupid> <artifactid> maven-antrun-plugin </artifactid> <versionrange> [1.8,) </versionrange> <goals> <goal>run</goal> </goals> </pluginexecutionfilter> <action> <ignore></ignore> </action> </pluginexecution> </pluginexecutions> </lifecyclemappingmetadata> </configuration> </plugin> </plugins> </pluginmanagement> </build> <reporting> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-surefire-report-plugin</artifactid> <version>2.18.1</version> <reportsets> <reportset> <id>integration-tests</id> <reports> <report>failsafe-report-only</report> </reports> </reportset> </reportsets> </plugin> </plugins> </reporting>
Comments
Post a Comment