Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.

Slides:



Advertisements
Similar presentations
J-Unit Framework.
Advertisements

Problem Solving 5 Using Java API for Searching and Sorting Applications ICS-201 Introduction to Computing II Semester 071.
METHOD OVERRIDING 1.Sub class can override the methods defined by the super class. 2.Overridden Methods in the sub classes should have same name, same.
MAHDI OMAR JUNIT TUTORIAL. CONTENTS Installation of Junit Eclipse support for Junit Using Junit exercise JUnit options Questions Links and Literature.
Programo Issues Cora Pérez Ariza ~ DECSAI ~ UGR Granada, January 28 th & 29 th, 2009.
Written by: Dr. JJ Shepherd
Objectives: Test Options JUnit Testing Framework TestRunners Test Cases and Test Suites Test Fixtures JUnit.
C12, Polymorphism “many forms” (greek: poly = many, morphos = form)
Oct Ron McFadyen1 Singleton To guarantee that there is at most one instance of a class we can apply the singleton pattern. Singleton Static.
CSC 212 Vectors, Lists, & Sequences. Announcement Daily quizzes accepted electronically only  Submit via one or other Dropbox  also accepted,
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
CS 106 Introduction to Computer Science I 03 / 23 / 2007 Instructor: Michael Eckmann.
JUnit Introduction and Advanced Features. Topics Covered  Junit Introduction  Fixtures  Test Suites  Currency Example.
JUnit. Why is testing good? Due to psychological factors, programmers are bad testers. A computer can test much faster than a human Philosophy: “If it.
Class template Describing a generic class Instantiating classes that are type- specific version of this generic class Also are called parameterized types.
1 Generics and Using a Collection Generics / Parameterized Classes Using a Collection Customizing a Collection using Inheritance Inner Classes Use of Exceptions.
TDD Test-Driven Development. JUnit 4.0 To use annotations need to import org.junit.Test To use assertion need to import org.junit.Assert.* No need to.
Unit 031 Interfaces What is an Interface? Interface Declaration Syntax Implementing Interfaces Using Interfaces as Types Interfaces and Inheritance Interfaces.
14-Jul-15 JUnit 4. Comparing JUnit 3 to JUnit 4 All the old assertXXX methods are the same Most things are about equally easy JUnit 4 makes it easier.
Java CourseWinter 2009/10. Introduction Object oriented, imperative programming language. Developed: Inspired by C++ programming language.
Unit Testing & Defensive Programming. F-22 Raptor Fighter.
Principles of Computer Programming (using Java) Review Haidong Xue Summer 2011, at GSU.
© Dr. A. Williams, Fall Present Software Quality Assurance – JUnit Lab 1 JUnit A unit test framework for Java –Authors: Erich Gamma, Kent Beck Objective:
Concordia University Department of Computer Science and Software Engineering Click to edit Master title style ADVANCED PROGRAMMING PRACTICES Unit Testing.
JUnit The framework. Goal of the presentation showing the design and construction of JUnit, a piece of software with proven value.
Programming Languages and Paradigms Object-Oriented Programming.
Lecture 6 Software Testing and jUnit CS140 Dick Steflik.
Inheritance and Class Hierarchies Ellen Walker CPSC 201 Data Structures Hiram College.
1 Object-Oriented Software Engineering CS Interfaces Interfaces are contracts Contracts between software groups Defines how software interacts with.
Object Oriented Programming: Java Edition By: Samuel Robinson.
Testing. RHS – SOC 2 Testing So far, we have not really created tests in a systematic manner Testing has been more like ”probing” Making a thorough test.
Java Quiz Bowl A fun review of the Java you should know from CMPT 201 If you don’t know the answers - this week is for you to study up!
5-Aug-2002cse Arrays © 2002 University of Washington1 Arrays CSE 142, Summer 2002 Computer Programming 1
Testing in NetBeans. SWC Testing The ideal test: When the test is passed, the product is ready for delivery! Ideal – but (almost) impossible –Number of.
Slide 1 Unit Testing. Slide 2 Unit Testing Options l Use N-Unit In a microsoft environment.NET… you can use their supplied N-Unit testing to test your.
CSC 212 – Data Structures Lecture 11: More Inheritance & Generic Types.
Copyright © 2014 by John Wiley & Sons. All rights reserved.1 Chapter 10 - Interfaces.
Chapter 3 Inheritance and Polymorphism Goals: 1.Superclasses and subclasses 2.Inheritance Hierarchy 3.Polymorphism 4.Type Compatibility 5.Abstract Classes.
JUnit Adam Heath. What is JUnit?  JUnit is a unit testing framework for the Java programming language  It allows developers to swiftly and easily test.
Generic Types  Recent release of Java added generics  Include type parameters in class definition  Like methods, parameters can change each time 
Chapter 6 Introduction to Defining Classes. Objectives: Design and implement a simple class from user requirements. Organize a program in terms of a view.
90-723: Data Structures and Algorithms for Information Processing Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 1: Introduction Data.
Java Class Structure. Class Structure package declaration import statements class declaration class (static) variable declarations* instance variable.
JUnit. Introduction JUnit is an open source Java testing framework used to write and run repeatable tests JUnit is integrated with several IDEs, including.
Application development with Java Lecture 21. Inheritance Subclasses Overriding Object class.
Test it! Unit, mocking and in-container Meet Arquillian! Ivan St. Ivanov.
Classes, Interfaces and Packages
Access Specifier. Anything declared public can be accessed from anywhere. Anything declared private cannot be seen outside of its class. When a member.
Quick Review of OOP Constructs Classes:  Data types for structured data and behavior  fields and methods Objects:  Variables whose data type is a class.
Written by: Dr. JJ Shepherd
Unit Testing. F-22 Raptor Fighter Manufactured by Lockheed Martin & Boeing How many parts does the F-22 have?
Java & C++ Comparisons How important are classes and objects?? What mechanisms exist for input and output?? Are references and pointers the same thing??
Array Size Arrays use static allocation of space. That is, when the array is created, we must specify the size of the array, e.g., int[] grades = new int[100];
Topic: Junit Presenters: Govindaramanujam, Sama & Jansen, Erwin.
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
Question of the Day  Move one matchstick to produce a square.
Internet Computing Module II. Syllabus Creating & Using classes in Java – Methods and Classes – Inheritance – Super Class – Method Overriding – Packages.
Unit Testing in Eclipse Presented by David Eisler 08/09/2014.
Memory Management in Java Mr. Gerb Computer Science 4.
Programming in Java Transitioning from Alice. Becomes not myFirstMethod but …. public static void main (String[] arg) { // code for testing classes goes.
MT311 Java Application Development and Programming Languages Li Tak Sing( 李德成 )
Unit Testing.
Software Construction Lab 10 Unit Testing with JUnit
EECE 310: Software Engineering
More JUnit CS 4501 / 6501 Software Testing
null, true, and false are also reserved.
Java Programming Language
More JUnit CS 4501 / 6501 Software Testing
OO Design with Inheritance
Java Programming Language
Presentation transcript:

Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel

2 Day 10 JUnit 4 Extensions

 At times test cases requires some prerequisites ◦ Online in internet ◦ Database is available ◦ Database is filled with required test data  Best practice is to check this during running tests.  Done tag  Specified methods must be public, and return a boolean or Boolean value 3

public class TestFillDatabase = public void fillData() { //... } public boolean databaseIsAvailable() { boolean isAvailable =...; return isAvailable ; } 4

 Gets JUnit to inject test data into instances of your test class, via the constructor  The test data is provided by a method with annotation  TestCase must contain a constructor which takes the correct number, types of parameters. 5

 This method needs to return a collection of arrays, but beyond that you can implement it however you want.  We create an embedded array in the Java code. However, we can also get data from other sources. 6

@RunWith(Parameterized.class) public class SampleTest { private int number; private double public static Collection data() { return Arrays.asList(new Object[][] { { 0, 0.00 }, { 50, 5.00 }, { 99, 9.90 } }); } public SampleTest(int number, double result) { super(); this.number = number; this.result = result; public void shouldCalculateCorrectFee() { PremiumTweetsService premiumTweetsService = new PremiumTweetsService(); double calculatedFees = premiumTweetsService.calculateFeesDu e(numberOfTweets); assertThat(calculatedFees, is(expectedFee)); } 7

 When writing tests, it is common to find that several tests need similar objects created before they can run.  Annotating a public void method causes that method to be run before the Test method. methods of superclasses will be run before those of the current class. 8

 Sometimes several tests need to share computationally expensive setup (like logging into a database).  This can compromise the independence of tests, but it may be necessary optimization.  Annotating a public static void no-arg method causes it to be run once before any of the test methods in the class.  methods of superclasses will be run before those the current class. 9

 If you allocate external resources in a Before method you need to release them after the test runs.  Annotating a public void method causes that method to be run after the Test method.  methods are guaranteed to run even if a Before or Test method throws an exception. methods declared in superclasses will be run after those of the current class. 10

 If you allocate expensive external resources in a BeforeClass method you need to release them after all the tests in the class have run.  Annotating a public static void method causes that method to be run after all the tests in the class have been run.  methods are guaranteed to run even if a BeforeClass method throws an exception. methods declared in superclasses will be run after those of the current class. 11