Test meetup Houten
June 29, 2015
An introduction for technical testers
Joost van Dieten
Ka Yip Cheung
Tester
Developer
Setup CI
Review Unit Tests
Exploratory Testing
Defect management
New Test Cases
Write scripts
Setup Test tools
New Code
Fix defects
Write Unit Tests
Review System Tests
Automate tests
public class Person {
private int age;
private String name;
public Person(int age, String name){
this.age = age;
this.name = name;
}
public int getAge(){
return this.age;
}
public void setAge(int age){
this.age = age;
}
public String getName(){
return this.name;
}
public void setName(String name){
this.name = name;
}
}class Person(var age: Int, var name: String)class PersonSpec {
}Designed to increase team productivity through simple clear tests and executable specifications
Suitable for all test types unit test, system test, integration test, acceptance test
7 style traits to pick from
test("An empty Set should have size 0") {
assert(Set.empty.size == 0)
}"An empty Set" should "have size 0" in {
assert(Set.empty.size == 0)
}
describe("A Set") {
describe("when empty") {
it("should have size 0") {
assert(Set.empty.size == 0)
}
it("should produce NoSuchElementException when head is invoked") {
intercept[NoSuchElementException] {
Set.empty.head
}
}
}
} "A Set" when {
"empty" should {
"have size 0" in {
assert(Set.empty.size == 0)
}
"produce NoSuchElementException when head is invoked" in {
intercept[NoSuchElementException] {
Set.empty.head
}
}
}
} "A Set" - {
"when empty" - {
"should have size 0" in {
assert(Set.empty.size == 0)
}
"should produce NoSuchElementException when head is invoked" in {
intercept[NoSuchElementException] {
Set.empty.head
}
}
}
} object "A Set" {
object "when empty" {
def "should have size 0" {
assert(Set.empty.size == 0)
}
def "should produce NoSuchElementException when head is invoked" {
intercept[NoSuchElementException] {
Set.empty.head
}
}
}
} val examples =
Table(
"set",
BitSet.empty,
HashSet.empty[Int],
TreeSet.empty[Int]
)
property("an empty Set should have size 0") {
forAll(examples) { set =>
set.size should be (0)
}
}info("As a TV set owner")
info("I want to be able to turn the TV on and off")
info("So I can watch TV when I want")
info("And save energy when I'm not watching TV")
feature("TV power button") {
scenario("User presses power button when TV is off") {
Given("a TV set that is switched off")
val tv = new TVSet
assert(!tv.isOn)
When("the power button is pressed")
tv.pressPowerButton()
Then("the TV should switch on")
assert(tv.isOn)
}
}class PersonSpec extends FlatSpec {
}ScalaTest provides a domain specific language (DSL) for expressing assertions in tests using the word should
result should equal (3) // can customize equality
result should === (3) // can customize equality and enforce type constraints
result should be (3) // cannot customize equality, so fastest to compile
result shouldEqual 3 // can customize equality, no parentheses required
result shouldBe 3 // cannot customize equality, so fastest to compile, no parentheses requiredclass PersonSpec extends FlatSpec with Matchers {
it should "init new Person with age and name" in {
val joost = new Person(28,"Joost")
}
}We work in a scrum project with user stories. How cool would it be te be able to map those stories 1 on 1 to functional acceptance tests.