I have taken the sample code coverage project and trying to get the
code coverage, but getting following two problems.
1) Maven is taking actionscript file as java and throwing warning, so
I am getting zero coverage.
2) Unable to start flash player. Tried all following possible
workarounds for it, but none worked:-
a) Included
<properties>
<flashplayer.command>C:\WINDOWS\system32\Macromed\Flash
\flashplayer.exe</flashplayer.command>
</properties>
<testRunner>
<launcher>
<flashplayerCommand>${flashPlayer.command}</
flashplayerCommand>
</launcher>
</testRunner>
b) mvn clean install -X -DflashPlayer.command=C:\WINDOWS
\system32\Macromed\Flash\flashplayer.exe
c) Mentioned C:\WINDOWS\system32\Macromed\Flash\ in windows
environment PATH also
3) Can we have branch coverage also using FlexMojo?
Following are the logs and after it the pom.xml :-
[INFO] Flexmojos 4.0-alpha-3
[INFO] Apache License - Version 2.0 (NO WARRANTY) - See COPYRIGHT
file
[DEBUG] Instrumenting code to test coverage mode null
[DEBUG] Instrumenting com.nikhil.App:13
[DEBUG] Instrumenting com.nikhil.App:19
[DEBUG] Instrumenting com.nikhil.App:8
[DEBUG] Instrumenting com.nikhil.Calculator:16
[DEBUG] Instrumenting com.nikhil.Calculator:23
[DEBUG] Instrumenting com.nikhil.Calculator:24
[DEBUG] Instrumenting com.nikhil.Calculator:26
[DEBUG] Instrumenting com.nikhil.Calculator:32
[DEBUG] Instrumenting com.nikhil.Calculator:8
[INFO] Running tests C:\sample_app2\target\test-classes\TestRunner.swf
[DEBUG] [LAUNCHER] ASVmLauncher starting
[DEBUG] [LAUNCHER] exec: FlashPlayer.exe - C:\sample_app2\target\test-
classes\TestRunner.swf
[DEBUG] [LAUNCHER] Creating process
[WARNING] [LAUNCHER] Using regular flashplayer tests
[DEBUG] [org.sonatype.flexmojos.test.monitor.AsVmPing] opened server
socket on port 13540
[DEBUG] [org.sonatype.flexmojos.test.monitor.ResultHandler] opened
server socket on port 13539
Javancss.<init>(InputStream).e:
net.sourceforge.cobertura.javancss.ParseException: Encountered "{" at
line 8, column 20.
Was expecting one of:
";" ...
"." ...
WARN getAccumlatedCCNForSource, JavaNCSS got an error while parsing
the java file C:\sample_app2\src\main\flex\com\nikhil\App.as
ParseException in STDIN
Last useful checkpoint: ""
Encountered "{" at line 8, column 20.
Was expecting one of:
";" ...
"." ...
Javancss.<init>(InputStream).e:
net.sourceforge.cobertura.javancss.ParseException: Encountered "{" at
line 9, column 1.
Was expecting one of:
";" ...
"." ...
WARN getAccumlatedCCNForSource, JavaNCSS got an error while parsing
the java file C:\sample_app2\src\main\flex\com\nikhil\Calculator.as
ParseException in STDIN
Last useful checkpoint: ""
Encountered "{" at line 9, column 1.
Was expecting one of:
";" ...
"." ...
Cobertura: Saved information on 2 classes.
[INFO]
------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] Total time: 2:09.766s
[INFO] Finished at: Tue Sep 27 16:54:19 GMT+05:30 2011
[INFO] Final Memory: 55M/495M
[INFO]
------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonatype.flexmojos:flexmojos-maven-
plugin:4.0-alpha-3:test-run (default-test-run) on project sample_app2:
Failed to laun
ch Flash Player. Probably java was not able to find flashplayer.
[ERROR] Make sure flashplayer is available on PATH
[ERROR] or use -DflashPlayer.command=${flashplayer executable}
[ERROR] Read more at:
https://docs.sonatype.org/display/FLEXMOJOS/Running+unit+tests:
Cannot run program "FlashPlayer.exe": CreateProcess error=2, The syst
em cannot find the file specified
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
execute goal org.sonatype.flexmojos:flexmojos-maven-plugin:4.0-
alpha-3:test-run (default-
test-run) on project sample_app2: Failed to launch Flash Player.
Probably java was not able to find flashplayer.
Make sure flashplayer is available on PATH
or use -DflashPlayer.command=${flashplayer executable}
Read more at: https://docs.sonatype.org/display/FLEXMOJOS/Running+unit+tests
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:
217)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:
153)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:
145)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:
84)
at
org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:
59)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:
183)
at
org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:
161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:
319)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:
156)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:
25)
at java.lang.reflect.Method.invoke(Method.java:597)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:
290)
at
org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:
230)
at
org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:
409)
at
org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Failed to
launch Flash Player. Probably java was not able to find flashplayer.
Make sure flashplayer is available on PATH
or use -DflashPlayer.command=${flashplayer executable}
Read more at: https://docs.sonatype.org/display/FLEXMOJOS/Running+unit+tests
at
org.sonatype.flexmojos.plugin.test.TestRunMojo.run(TestRunMojo.java:
380)
at
org.sonatype.flexmojos.plugin.test.TestRunMojo.execute_aroundBody0(TestRunMojo.java:
219)
at
org.sonatype.flexmojos.plugin.test.TestRunMojo.execute_aroundBody1$advice(TestRunMojo.java:
24)
at
org.sonatype.flexmojos.plugin.test.TestRunMojo.execute_aroundBody2(TestRunMojo.java:
206)
at
org.sonatype.flexmojos.plugin.test.TestRunMojo.execute_aroundBody3$advice(TestRunMojo.java:
17)
at
org.sonatype.flexmojos.plugin.test.TestRunMojo.execute(TestRunMojo.java:
1)
at
org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:
101)
at
org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:
209)
... 19 more
Caused by:
org.sonatype.flexmojos.test.launcher.LaunchFlashPlayerException:
Failed to launch Flash Player.
at
org.sonatype.flexmojos.test.launcher.AsVmLauncher.runFlashplayer(AsVmLauncher.java:
180)
at
org.sonatype.flexmojos.test.launcher.AsVmLauncher.start(AsVmLauncher.java:
291)
at
org.sonatype.flexmojos.test.DefaultTestRunner.run(DefaultTestRunner.java:
55)
at
org.sonatype.flexmojos.plugin.test.TestRunMojo.run(TestRunMojo.java:
360)
... 26 more
Caused by: java.io.IOException: Cannot run program "FlashPlayer.exe":
CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:460)
at java.lang.Runtime.exec(Runtime.java:593)
at java.lang.Runtime.exec(Runtime.java:466)
at
org.sonatype.flexmojos.test.launcher.AsVmLauncher.runFlashplayer(AsVmLauncher.java:
174)
... 29 more
Caused by: java.io.IOException: CreateProcess error=2, The system
cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:453)
... 32 more
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions,
please read the following articles:
[ERROR] [Help 1]
http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Cobertura: Coverage data file C:\sample_app2\cobertura.ser either does
not exist or is not readable. Creating a new data file.
Cobertura: Saved information on 2 classes.
And this is the pom.xml file I am
using
:-----------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2008 Marvin Herman Froeder Licensed under the Apache
License, Version 2.0 (the "License"); you may not use this file except
in compliance with the License. You may obtain a copy of the License
at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the License for the specific language
governing permissions and limitations under the License.
-->
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-flex-super-pom</artifactId>
<version>4.0-alpha-3</version>
</parent>
<groupId>com.adobe.samples</groupId>
<artifactId>calculator-api</artifactId>
<version>1.0-SNAPSHOT</version>
<!--repositories>
<repository>
<id>Flexmojos</id>
<name>Flexmojo Repository Switchboard</name>
<layout>default</layout>
<url>http://mvnrepository.com/artifact/org.sonatype.flexmojos</url>
</repository>
</repositories-->
<packaging>swc</packaging>
<properties>
<flashplayer.command>C:\WINDOWS\system32\Macromed\Flash
\flashplayer.exe</flashplayer.command>
</properties>
<build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>tests</testSourceDirectory>
<plugins>
<plugin>
<groupId>org.sonatype.flexmojos</groupId>
<artifactId>flexmojos-maven-plugin</artifactId>
<version>4.0-alpha-3</version>
<configuration>
<!--testRunner>
<launcher>
<flashplayerCommand>${flashPlayer.command}</
flashplayerCommand>
</launcher>
</testRunner-->
<coverage>true</coverage>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.1.2</version>
</plugin>
</plugins>
</reporting>
<dependencies>
<dependency>
<groupId>com.adobe.flexunit</groupId>
<artifactId>flexunit</artifactId>
<version>0.85</version>
<type>swc</type>
<scope>test</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<id>site</id>
<build>
<plugins>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>site</goal>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.sonatype.maven.plugins</groupId>
<artifactId>maven-upload-plugin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<executions>
<execution>
<id>publish-site</id>
<phase>verify</phase>
<goals>
<goal>upload-file</goal>
</goals>
<configuration>
<serverId>forge</serverId>
<repositoryUrl>http://repository.sonatype.org/
service/local/repositories/flexmojos-site/content-compressed</
repositoryUrl>
<file>target/${project.artifactId}-$
{project.version}-site.jar</file>
<repositoryPath>flexmojos/sample</repositoryPath>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
--
You received this message because you are subscribed to the Google
Groups "Flex Mojos" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/flex-mojos
http://flexmojos.sonatype.org/