C# Made Easy! Faculty of Mathematics and Physics Charles University in Prague 4 th May 2015 Workshop 11 – Functional Testing.

Slides:



Advertisements
Similar presentations
MIS 3200 – Unit 4 Complex Conditional Statements – else if – switch.
Advertisements

Need your MyMathLab card with your access code Need a Valid Address Need to know Purdue’s zip code is and your course ID for your Class You.
26-Jun-15 Getting Ready for CIT Labs Lab is scheduled for 3;00-4:30 Fridays in Moore 207 Lab is not in Towne 309 (Registrar has it wrong) Everyone.
PayDox applications All features can be used independently.
Microsoft ® Office Word 2007 Training Mail Merge II: Use the Ribbon and perform a complex mail merge [Your company name] presents:
How to install CGAL Yuanzhen Wang. What is CGAL Computational Geometry Algorithms Library “Provide easy access to efficient and reliable geometric algorithms.
Other Features Index and table of contents Macros and VBA.
Build Your Own Website Introduction Introduction Phil Stone Phil Stone ICT tutor for Dudley Adult Community Learning ICT tutor for Dudley Adult Community.
Problems, and how to solve them. By Alex Gauthier and Daymian Hogue.
Kids Computer Club House
PDF accessibility Susannah Pike
Ch 26 & 27 User Interfaces.
Searching the Internet Using Google Tips and Tricks.
Information guide.
DMT File Management Common Problems Managing DMT files –Reliable Upload –Reliable Download –Where are the files kept? –Tedious Procedures Using DOS commands.
INTERNET APPLICATION DEVELOPMENT For More visit:
CS Tutorial 1 Getting Started with Visual Studio 2012 (Visual Studio 2010 are no longer available on MSDNAA, please choose Visual Studio 2012 which.
Painless Bug Tracking Michael Tsai 2011/9/30. Reference  html 2.
{ flS Tutorial By  flS uses SMTP protocol to send mails, so your SMTP information is needed.  The first time you launch flS, you will be.
11 A First Game Program Session Session Overview  Begin the creation of an arcade game  Learn software design techniques that apply to any form.
Sustainable SharePoint 2010 Customizations By Bill Keys.
Evidence Including tools and etiquette.
Chapter 0 Getting Started. Objectives Understand the basic structure of a C++ program including: – Comments – Preprocessor instructions – Main function.
CMSC 104, Version 8/061L17Top-DownDesign.ppt Top-Down Design Topics Top-Down Design Top-Down Design Examples The Function Concept Reading Sections 3.1.
Software. A web site is a collection of web pages on a particular topic. A web page is a document written in HTML code. Web pages are linked together.
1 Getting Started with C++. 2 Objective You will be able to create, compile, and run a very simple C++ program on Windows, using Visual Studio 2008.
OpenGL 3.3 Unleashed! Faculty of Mathematics and Physics Charles University in Prague 24 th Februrary 2015 / 3 rd March 2015 Workshop 1 – OpenGL 3.3 Tutorial.
How to Test Methods Computer Science 3 Gerb Objective: Test methods properly.
Time to apply stuff… Faculty of Mathematics and Physics Charles University in Prague 2 nd November 2015 Workshop 3 – Path-finding Workshop 3 – Path-finding.
Time to apply stuff… Faculty of Mathematics and Physics Charles University in Prague 19 th October 2015 Workshop 2 – Path-finding.
HINDU STYLE PORTFOLIO TEMPLATE
UNDERSTANDING YOUR OPTIONS FOR CLIENT-SIDE DEVELOPMENT IN OFFICE 365 Mark Rackley
Time to apply stuff… Faculty of Mathematics and Physics Charles University in Prague 5 th October 2015 Workshop 1 – Java Wrestling.
Body System Here Enter group members names here. Save Your Work! This is a good time to start saving your work. Go to FILE, then Save As…, then change.
Sona Software Workshop University of Sussex Department of Psychology.
PHP using MySQL Database for Web Development (part II)
A step-by-Step Guide For labels or merges
Shaping yourself to SDET from AT Sriram Angajala
Version Control with Subversion
Log in but don’t open any work. Things are changing!!!
Data Virtualization Demoette… ADO.NET Client
AVR-GCC Programming Using C Development Tools to program your Arduino Microcontrollers. Presented by: Charles Norona November 17th, 2011 C. Norona,
Visual programming Chapter 1: Introduction
Year 7 E-Me Web design.
Outlook Technical Support It’s a web based service which is being used by Millions of users and owned by Microsoft. Microsoft.
Shine Insight Reporting 101
MonoGame and Windows 8.
Instructor: Prasun Dewan (FB 150,
Testing REST IPA using POSTMAN
MIS 3200 – Unit 4 Complex Conditional Statements else if switch.
HW for Computer Graphics
Introduction of FrontPage
CRM 2016 Solutions and Package Deployer
HW for Computer Graphics
About Everything You Always Wanted to Know
REAL-TIME, INTERACTIVE DOCUMENT AUTOMATION
HW for Computer Graphics
HW for Computer Graphics
Batch Parties Changes.
Maintaining a Program In today’s lesson we will look at:
Git started with git: 2018 edition
IDE’s and Debugging.
G061 - Queries “The search begins …..”.
Algorithms, Part 3 of 3 Topics Top down-design Structure charts
Data Types Every variable has a given data type. The most common data types are: String - Text made up of numbers, letters and characters. Integer - Whole.
Review of Previous Lesson
Makefile Assignment Create a file called f1.cpp. It should contain the following function: int squareIt ( int x ) { //insert code to calc and return the.
Algorithms, Part 3 of 3 Topics Top down-design Reading
Presentation transcript:

C# Made Easy! Faculty of Mathematics and Physics Charles University in Prague 4 th May 2015 Workshop 11 – Functional Testing

1. Test 2. Functional Testing – What, Why, How 3. Homework

Find the test here (no-ads): Permanent link: U46l08KlYpAmF3pBLF4b8xuIeesjLbiBn98IwI/viewform Time for the test: 8 min

WHAT?

 Unit testing is a software development process in which the smallest testable parts of an application, called units, are individually and independently scrutinized for proper operation. To put it simply…  Running a code that executes another code and compares results with pre-computed/pre-specified ones.

 Simple example class Calc { int Add(int a1, int a2) } class CalculatorTest { public boolean TestAdd() { Calc c = new Calculator(); if (c.Add(1, 1) == 2) return true; return false; }

WHY?

Because TIME (translates as MONEY) matters!

 Tests reduce bugs in existing features  Tests reduce bugs in new features  Tests (of complex code base) are good documentation  Tests improve design  Tests reduce cost of change  Tests constrain features  Tests reduce fear of making changes  For your colleagues as well as you!

WHY NOT TO?

 It takes too much time to write tests  It takes too much time to execute tests  It’s not your job to test the code  I don’t really know how the code should behave so I can’t test it!

 It takes too much time to write tests  But you have time to hunt bugs down?  It takes too much time to execute tests  It’s not your job to test the code  I don’t really know how the code should behave so I can’t test it!

 It takes too much time to write tests  But you have time to hunt bugs down?  It takes too much time to execute tests  You are running your tests manually … and the same time you’re considering yourself to be THE programmer?  It’s not your job to test the code  I don’t really know how the code should behave so I can’t test it!

 It takes too much time to write tests  But you have time to hunt bugs down?  It takes too much time to execute tests  You are running your tests manually … and the same time you’re considering yourself to be THE programmer?  It’s not your job to test the code  Oh, and you expect to have customers?  I don’t really know how the code should behave so I can’t test it!

 It takes too much time to write tests  But you have time to hunt bugs down?  It takes too much time to execute tests  You are running your tests manually … and the same time you’re considering yourself to be THE programmer?  It’s not your job to test the code  Oh, and you expect to have customers?  I don’t really know how the code should behave so I can’t test it!  You should have not started writing such code from the very beginning!

HOW?

Show time…

Create two (Class Library) projects 1. Fist will contain your classes (unit) for testing Name it e.g.: MyLibrary 2. Second will contain TESTs that will be executed to test your first project Name it e.g.: MyLibrary.Test

Import required libraries / packages that you will need to run tests, perform code coverage and generate reports.

After you install NUnit, you will be asked, which projects will need to use it. Select your “second” project, that is “one containing TESTs”. We have suffixed its name with “.Test”.

In order to be able to test code that exists in MyLibrary, we have to tell Visual Studio that project MyLibrary.Test references MyLibrary in order to be able to use namespaces from MyLibrary within MyLibrary.Test.

Right-click MyLibrary.Test and navigate to Add-> Reference.

When “building” the solution Visual Studio will create.dll files of your libraries. We will need both to perform tests and generate reports about code coverage.

Navigate to the folder of your solution. There you will find subdirectory ‘packages’. The content should looke like the picture to the right.

Now you will need to create 3 batch files that will 1. Run tests 2. Perform code coverage 3. Generate HTML report Put those batch files into the folder of your solution.

del TestResult.xml.\packages\NUnit.Runners.2.6.4\tools\nunit-console.exe.\MyLibrary.Test\bin\Debug\MyLibrary.Test.dll /noshadow You might need to adjust texts in red to match your configuration Explanation: here we’re running NUnit that executes code within your “.Test” project producing “TestResult.xml” file with the report. Batch File 1: test.bat 2 lines

del results.xml.\packages\OpenCover \OpenCover.Console.exe -target:test.bat - register:user -filter:+[MyLibrary]* You might need to adjust texts in red to match your configuration Explanation: here we’re running tests again but now under observation of OpenCover that will generate Code Coverage report for namespace “MyLibrary” (that’s why you might need to change that…). Batch File 2: test-cover.bat 2 lines

call test-cover.bat.\packages\ReportGenerator \reportgenerator.exe - reports:results.xml -targetdir:coverage start firefox file://%CD%/coverage/index.htm You might need to adjust text in red to match your configuration. Explanation: Here we run ReportGenerator on the report generated by the OpenCover producing HTML pages visualizing the report. Batch File 3: test-cover-report.bat 3 lines

Don’t forget to rebuild your solution every time you do any changes to any of your projects!

 Download the template:  11-Homework.zip 11-Homework.zip  Code Heap tests to provide complete code coverage!

  Subject: Programming II – 2015 – Assignment 11  Zip up the whole solution and send it  You WILL NOT find the assignment in CoDex!  Deadline:  :59  Points: (meeting the deadline)

 Sadly, I do not own the patent for perfection (and will never do)  In case of doubts about the assignment or some other problems don’t hesitate to contact me!  Jakub Gemrot 