serenity-bdd / serenity-core

Serenity BDD is a test automation library designed to make writing automated acceptance tests easier, and more fun.
http://serenity-bdd.info
Other
721 stars 519 forks source link

Syntax error in report template: Java method,FTL stack trace ("~" means nesting-related): #426

Closed heerqa closed 8 years ago

heerqa commented 8 years ago

Hi John,

I have been trying for few days, to solve the error. I know you have mentioned in #206 but i checked its not dependency conflict. I am using serenity-core latest release 1.1.34. However I have tried with older version also. I am using serenity-cucumber I am running following maven command for two way jira connectivity mvn clean verify serenity:aggregate -Dwebdriver.driver=firefox -Pserenity

But I am getting following error [ERROR] Syntax error in report template: Java method "net.thucydides.core.reports.TestOutcomes$OutcomeProportionCounter.withResult(String)" threw an exception when invoked on net.thucydides.core.reports.TestOutcomes$OutcomeProportionCounter object "net.thucydides.core.reports.TestOutcomes$OutcomeProportionCounter@26204f8f"; see cause exception in the Java stack trace.


FTL stack trace ("~" means nesting-related):

- Failed at: ${testOutcomes.proportionOf("automate... [in template "freemarker/home.ftl" at line 40, column 34]

- Failed at: ${testOutcomes.proportionOf("automate...  [in template "freemarker/home.ftl" at line 40, column 34]

Java stack trace (for programmers):

freemarker.core._TemplateModelException: [... Exception message was already printed; see it above ...] at freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:311) at freemarker.ext.beans._MethodUtil.newInvocationTemplateModelException(_MethodUtil.java:284) at freemarker.ext.beans.OverloadedMethodsModel.exec(OverloadedMethodsModel.java:68) at freemarker.core.MethodCall._eval(MethodCall.java:62) at freemarker.core.Expression.eval(Expression.java:78) at freemarker.core.Expression.evalAndCoerceToString(Expression.java:82) at freemarker.core.DollarVariable.accept(DollarVariable.java:41) at freemarker.core.Environment.visit(Environment.java:324) at freemarker.core.MixedContent.accept(MixedContent.java:54) at freemarker.core.Environment.visit(Environment.java:324) at freemarker.core.Environment.process(Environment.java:302) at freemarker.template.Template.process(Template.java:325) at net.thucydides.core.reports.templates.FreemarkerReportTemplate.merge(FreemarkerReportTemplate.java:33) at net.thucydides.core.reports.html.HtmlReporter$Merger.usingContext(HtmlReporter.java:175) at net.thucydides.core.reports.html.HtmlAggregateStoryReporter.generateReportPage(HtmlAggregateStoryReporter.java:492) at net.thucydides.core.reports.html.HtmlAggregateStoryReporter.generateAggregateReportFor(HtmlAggregateStoryReporter.java:259) at net.thucydides.core.reports.html.HtmlAggregateStoryReporter.generateReportsForTestResultsIn(HtmlAggregateStoryReporter.java:162) at net.thucydides.core.reports.html.HtmlAggregateStoryReporter.generateReportsForTestResultsFrom(HtmlAggregateStoryReporter.java:131) at net.serenitybdd.maven.plugins.SerenityAggregatorMojo.generateHtmlStoryReports(SerenityAggregatorMojo.java:233) at net.serenitybdd.maven.plugins.SerenityAggregatorMojo.execute(SerenityAggregatorMojo.java:172) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207) 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:116) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288) at org.apache.maven.cli.MavenCli.main(MavenCli.java:199) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) Caused by: java.lang.IllegalArgumentException: No enum constant net.thucydides.core.model.TestResult.COMPROMISED at java.lang.Enum.valueOf(Enum.java:238) at net.thucydides.core.model.TestResult.valueOf(TestResult.java:12) at net.thucydides.core.reports.TestOutcomes$OutcomeProportionCounter.withResult(TestOutcomes.java:564) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:1458) at freemarker.ext.beans.ReflectionCallableMemberDescriptor.invokeMethod(ReflectionCallableMemberDescriptor.java:52) at freemarker.ext.beans.MemberAndArguments.invokeMethod(MemberAndArguments.java:48) at freemarker.ext.beans.OverloadedMethodsModel.exec(OverloadedMethodsModel.java:62) ... 39 more

wakaleo commented 8 years ago

Hi,

Are there any other exceptions mentioned earlier on in the logs? It appears to be a test with an unrecognised test result, but it would be good to see the exact exception. In particular, can you see anything like this:

java.lang.IllegalArgumentException: No enum constant net.thucydides.core.model.TestResult.UNKNOWN
heerqa commented 8 years ago

I see below

Caused by: java.lang.IllegalArgumentException: No enum constant net.thucydides.core.model.TestResult.COMPROMISED

wakaleo commented 8 years ago

Thanks, I'll take a look.

wakaleo commented 8 years ago

It looks like it's using an older version of the TestResult class at some point. Could you post your pom or gradle build file?

heerqa commented 8 years ago

<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">

4.0.0
<groupId>eagree-automation</groupId>
<artifactId>eagree-automation</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
     <url>www.yahoo.com</url>
    <version.maven-compiler-plugin>3.1</version.maven-compiler-plugin>
    <version.testng>6.8.8</version.testng>

    <version.maven-resources-plugin>2.6</version.maven-resources-plugin>
    <version.maven.surfire>2.17</version.maven.surfire>
    <guice.version>3.0</guice.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <serenity.version>1.1.34</serenity.version>
    <serenity.cucumber.version>1.0.17</serenity.cucumber.version>
    <webdriver.driver>chrome</webdriver.driver>
    <spring-framework.version>4.1.2.RELEASE</spring-framework.version>
</properties>

<dependencies>
    <!-- Spring dependency for Rest Template added by Shagufta -->
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-core</artifactId>
        <version>${spring-framework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>${spring-framework.version}</version>
    </dependency>
    <dependency>
        <groupId>org.skyscreamer</groupId>
        <artifactId>jsonassert</artifactId>
        <version>1.2.3</version>
    </dependency>

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml-schemas</artifactId>
        <version>3.9</version>
        <exclusions>
            <exclusion>
                <artifactId>xml-apis</artifactId>
                <groupId>xml-apis</groupId>
            </exclusion>
        </exclusions>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>3.9</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>ooxml-schemas</artifactId>
        <version>1.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.1</version>
    </dependency>
    <!-- Serenity dependencies below -->
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-core</artifactId>
        <version>${serenity.version}</version>
    </dependency>

    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-junit</artifactId>
        <version>${serenity.version}</version>
    </dependency>

    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-cucumber</artifactId>
        <version>${serenity.cucumber.version}</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.7.7</version>
    </dependency>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.11</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.assertj</groupId>
        <artifactId>assertj-core</artifactId>
        <version>1.7.0</version>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd</groupId>
        <artifactId>serenity-jira-requirements-provider</artifactId>
        <version>1.0.1</version>
    </dependency>
    <dependency>
        <groupId>net.serenity-bdd.maven.plugins</groupId>
        <artifactId>serenity-maven-plugin</artifactId>
        <version>${serenity.version}</version>
    </dependency>
    <dependency>
        <groupId>com.googlecode.lambdaj</groupId>
        <artifactId>lambdaj</artifactId>
        <version>2.3.3</version>
    </dependency>
    <dependency>
        <groupId>org.hamcrest</groupId>
        <artifactId>hamcrest-all</artifactId>
        <version>1.3</version>
    </dependency>
    <dependency>
        <groupId>com.jayway.restassured</groupId>
        <artifactId>rest-assured</artifactId>
        <version>2.4.0</version>
    </dependency>
    <!-- Dependency below added by Shagufta -->
    <dependency>
        <groupId>commons-configuration</groupId>
        <artifactId>commons-configuration</artifactId>
        <version>1.10</version>
    </dependency>
    <dependency>
        <groupId>commons-beanutils</groupId>
        <artifactId>commons-beanutils</artifactId>
        <version>1.9.2</version>
    </dependency>

    <dependency>
        <groupId>org.uncommons</groupId>
        <artifactId>reportng</artifactId>
        <version>1.1.2</version>
        <scope>test</scope>
        <exclusions>
            <exclusion>
                <groupId>org.testng</groupId>
                <artifactId>testng</artifactId>
            </exclusion>
        </exclusions>
    </dependency>
            <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>${version.testng}</version>
    </dependency>

</dependencies>
<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>${version.maven-resources-plugin}</version>
            <configuration>
                <encoding>UTF-8</encoding>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${version.maven.surfire}</version>
            <configuration>
                <groups>func</groups>
                <!-- -->
                <excludedGroups>smoke</excludedGroups>
                <suiteXmlFiles>
                    <suiteXmlFile>build/testng.xml</suiteXmlFile>
                </suiteXmlFiles>

            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${version.maven-compiler-plugin}</version>
            <configuration>
                <encoding>UTF-8</encoding>
                <source>${version.java-version}</source>
                <target>${version.java-version}</target>
                <!-- <compilerReuseStrategy>alwaysNew</compilerReuseStrategy> -->
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.17</version>
            <configuration>
                <properties>
                    <property>
                        <name>usedefaultlisteners</name>
                        <value>false</value>
                    </property>
                    <property>
                        <name>listener</name>
                        <value>org.uncommons.reportng.HTMLReporter</value>
                    </property>
                </properties>
                <reportsDirectory>target/</reportsDirectory>
                <!-- <workingDirectory>target/</workingDirectory> -->
            </configuration>
        </plugin>

    </plugins>
</build>
<!-- profiles -->
    <profiles>
        <profile>
            <id>serenity</id>
            <!-- <activation> <activeByDefault>true</activeByDefault> </activation> -->
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.18</version>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <version>2.7.1</version>
                        <configuration>
                            <argLine>-Xmx1024m</argLine>
                            <systemPropertyVariables>
                                <serenity.browser.width>1200</serenity.browser.width>
                            </systemPropertyVariables>
                        </configuration>
                    </plugin>

                    <plugin>
                        <artifactId>maven-failsafe-plugin</artifactId>
                        <version>2.18</version>
                        <configuration>
                            <includes>
                                <include>**/*Test.java</include>
                                <include>**/*TestSuite.java</include>
                                <include>**/Test*.java</include>
                                <include>**/When*.java</include>
                            </includes>
                            <argLine>-Xmx512m</argLine>
                            <systemPropertyVariables>
                                <webdriver.driver>${webdriver.driver}</webdriver.driver>
                            </systemPropertyVariables>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-compiler-plugin</artifactId>
                        <version>3.2</version>
                        <configuration>
                            <source>1.7</source>
                            <target>1.7</target>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>net.serenity-bdd.maven.plugins</groupId>
                        <artifactId>serenity-maven-plugin</artifactId>
                        <version>${serenity.version}</version>
                        <executions>
                            <execution>
                                <id>serenity-reports</id>
                                <phase>post-integration-test</phase>
                                <goals>
                                    <goal>aggregate</goal>
                                </goals>
                            </execution>
                        </executions>

                        <dependencies>
                            <dependency> <groupId>net.serenity-bdd</groupId> <artifactId>serenity-jira-requirements-provider</artifactId> 
                                <version>1.0.1</version> </dependency>
                            <dependency>
                                <groupId>com.googlecode.lambdaj</groupId>
                                <artifactId>lambdaj</artifactId>
                                <version>2.3.3</version>
                                <exclusions>
                                    <exclusion>
                                        <artifactId>hamcrest-all</artifactId>
                                        <groupId>org.hamcrest</groupId>
                                    </exclusion>
                                </exclusions>
                            </dependency>
                        </dependencies>

                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

heerqa commented 8 years ago

Hi John,

I have attached POM.xml.

Thanks, Shagufta

heerqa commented 8 years ago

Hi John,

This issue is resolved by using the right build as specified on below page https://github.com/serenity-bdd/serenity-core/issues/274

Thanks, Shagufta

wakaleo commented 8 years ago

Thanks for the update.

Sent from my iPhone

On 29 May 2016, at 08:35, Shagufta Naz notifications@github.com wrote:

Closed #426.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

Mattscl commented 5 years ago

i have this error , please contect me by QQ1144933047, thanks