#327 try scalatest for BDD testing

This commit is contained in:
Calvin
2014-01-20 18:25:30 +08:00
parent d1e96f479e
commit 62ab2837e8
2 changed files with 77 additions and 0 deletions
+41
View File
@@ -418,6 +418,13 @@
<groupId>com.icegreen</groupId>
<artifactId>greenmail</artifactId>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.10</artifactId>
<version>2.0</version>
<scope>test</scope>
</dependency>
<!-- TEST end -->
</dependencies>
@@ -558,6 +565,40 @@
</plugins>
</build>
</profile>
<!-- 执行bdd test -->
<profile>
<id>bdd-test</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>1.0-RC2</version>
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<junitxml>.</junitxml>
<filereports>WDF TestSuite.txt</filereports>
</configuration>
<executions>
<execution>
<id>test</id>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<!-- 刷新开发环境数据库 -->
<profile>
@@ -0,0 +1,36 @@
package account
import org.scalatest.GivenWhenThen
import org.scalatest.FeatureSpec
import org.scalatest.Matchers
class userManagerSpec extends FeatureSpec with GivenWhenThen with Matchers {
feature("Manage users") {
info("As a administrator")
info("i want to list and edit the current users, but i don't want to add new user")
scenario("List users") {
Given("login as administrator")
When("login success and redirect to default page")
val a = 1
Then("admin user is displayed in page")
a should be > 0
}
scenario("Edit user1") {
Given("login as administrator")
When("edit user1 with new name")
val a = 1
Then("user1 with new name display in page")
a should be > 2
}
scenario("Edit admin") {
Given("login as administrator")
When("edit admin and update his name")
Then("admin had update the name")
pending
}
}
}