NUNIT Navaneeth Rajkumar Open Source Tools Team Project Central.Net.

Slides:



Advertisements
Similar presentations
Introduction to Eclipse. Start Eclipse Click and then click Eclipse from the menu: Or open a shell and type eclipse after the prompt.
Advertisements

The map and reduce functions in MapReduce are easy to test in isolation, which is a consequence of their functional style. For known inputs, they produce.
Pemrograman VisualMinggu …2… Page 1 MINGGU Ke Dua Pemrograman Visual Pokok Bahasan: Console Application Tujuan Instruksional Khusus: Mahasiswa dapat menjelaskan.
HELP GUIDE NEW USER REGISTRATION (SLIDE 2) TAKING A QUIZ (SLIDE 8) REVIEWING A QUIZ (SLIDE 17) GROUP MEMBERSHIP (SLIDE 26) CREATING QUIZZES (SLIDE 31)
Neo.NET Entity Objects VisualStudio Tool Guide.
Visual Basic 2010 How to Program. © by Pearson Education, Inc. All Rights Reserved.2.
Visual Basic 2010 How to Program Reference: Instructor: Maysoon Bin Duwais slides Visual Basic 2010 how to program by Deitel © by Pearson Education,
Chapter 6 Multiform Projects Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
E.1 Eclipse. e.2 Installing Eclipse Download the eclipse.installation.exe from the course web site to your computer and execute it. Keep the destination.
Operating Systems Simulator Jessica Craddock Kelvin Whyms CPSC 410.
Using Visual C++ and Pelles C
® IBM Software Group © 2006 IBM Corporation The Eclipse Data Perspective and Database Explorer This section describes how to use the Eclipse Data Perspective,
Creating a Console Application with Visual Studio
How XSL Formatter works Operation System Requirements How to format GUI for operating on Windows screen Application Integration Interface.
Working with SharePoint Document Libraries. What are document libraries? Document libraries are collections of files that you can share with team members.
Sharepoint Portal Server Basics. Introduction Sharepoint server belongs to Microsoft family of servers Integrated suite of server capabilities Hosted.
Beginning Programming with the Visual Studio.NET Environment.
1 ENG236: ENG236: C++ Programming Environment (2) Rocky K. C. Chang THE HONG KONG POLYTECHNIC UNIVERSITY.
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
Intro. to Game Programming Want to program a game?
XP New Perspectives on Browser and Basics Tutorial 1 1 Browser and Basics Tutorial 1.
IT 211 Project Integration and Deployment Lab #11.
Instructor: Chris Trenkov Hands-on Course Python for Absolute Beginners (Spring 2015) Class #001 (January 9, 2015)
®® Microsoft Windows 7 for Power Users Tutorial 13 Using the Command-Line Environment.
Intro to C++. Getting Started with Microsoft Visual Studios Open Microsoft Visual Studios 2010 Click on file Click on New Project Choose Visual C++ on.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 4 I Need a Tour Guide.
11 Web Services. 22 Objectives You will be able to Say what a web service is. Write and deploy a simple web service. Test a simple web service. Write.
Installing and Using Active Directory Written by Marc Zacharko.
Lecture Set 1 Part C: Understanding Visual Studio and.NET – Applications, Solutions, Projects (no longer used – embedded in Lecture Set 2A)
1 Introduction to C# Programming Console applications No visual components Only text output Two types MS-DOS prompt - Used in Windows 95/98/ME Command.
Introduction to Eclipse CSC 216 Lecture 3 Ed Gehringer Using (with permission) slides developed by— Dwight Deugo Nesa Matic
Active-HDL Interfaces Debugging C Code Course 10.
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files.
NUNIT - Testing your Application. NUnit Tool – Used for Test driven development Lets create a sample banking class named account which supports operations.
BIT 142:Programming & Data Structures in C#. What is Unit Testing? 2.
1.  “To write test cases for every non-trivial function or method in the module so that each test case is [as] separate from the others [as] possible.”
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved. 1 3 Welcome Application Introduction to Visual Programming.
1.  Writing snippets of code that try to use methods (functions) from your program.  Each snippet should test one (and only one) function......by calling.
McGraw-Hill © 2009 The McGraw-Hill Companies, Inc. All rights reserved. Chapter 6 Multiform Projects.
Using Microsoft Visual Studio 2005 Original by Suma Rao Revised by John G. McMahon ( 9/6/2008 )
Using Microsoft Visual Studio C++ Express 2005 Name: Dr Ju Wang Ashwin Belle Course Resource:
Chapter 3 MATLAB Fundamentals Introduction to MATLAB Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
1 Introduction to C# Programming Console applications No visual components Only text output Two types MS-DOS prompt - Used in Windows 95/98/ME Command.
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.
11/25/2015Slide 1 Scripts are short programs that repeat sequences of SPSS commands. SPSS includes a computer language called Sax Basic for the creation.
The material contained in this document is proprietary to Triniti Corporation (Triniti). This material may not be disclosed, duplicated or otherwise revealed,
A brief introduction to javadoc and doxygen. What’s in a program file? 1. Comments 2. Code.
Photoshop Image Slicing. Reasons to Image Slide To create links out of sliced images To optimise different areas. (flat areas of colour, such as logos,
File and Folder CLI Commands 12/24/ Agenda Overview of OS functions and the SHELL Internal v External Commands Command History Making & Modifying.
Lecture Set 2 Part A: Creating an Application with Visual Studio – Solutions, Projects, Files 8/10/ :35 PM.
1 Getting Started with C++ Part 1 Windows. 2 Objective You will be able to create, compile, and run a very simple C++ program on Windows, using Microsoft.
Visual Basic.NET Comprehensive Concepts and Techniques Chapter 3 Building an Application in the Visual Basic.NET Environment.
Introduction to Programming Python Lab 5: Strings and Output 05 February PythonLab5 lecture slides.ppt Ping Brennan
How to Fix Binkw32.dll Error
Active-HDL Server Farm Course 11. All materials updated on: September 30, 2004 Outline 1.Introduction 2.Advantages 3.Requirements 4.Installation 5.Architecture.
Installing and Configuring Moodle. Download Download latest Windows Install package from Moodle.orgMoodle.org.
C# Programming: From Problem Analysis to Program Design
Dive Into® Visual Basic 2010 Express
Navaneeth Rajkumar Open Source Tools Team Project Central.Net
INF230 Basics in C# Programming
CCA Skill Certification
Introduction to javadoc
Social Media And Global Computing Introduction to Visual Studio
Understanding the Visual IDE
1. Open Visual Studio 2008.
HOW TO CREATE A CLASS Steps:
Exploring the Power of EPDM Tasks Working with and Developing Tasks in SolidWorks Enterprise PDM (EPDM) By: Marc Young xLM Solutions
Introduction to javadoc
Presentation transcript:

NUNIT Navaneeth Rajkumar Open Source Tools Team Project Central.Net

Something about nUnit… NUnit is a unit-testing framework for all.Net languages. It has been written entirely in C#.

Important nUnit Links

The Input & Output of nUnit nUnit Dll, exe fileXML file (Optional) Processing details on the GUI or Command prompt

The 2 operational modes  GUI mode  Console mode (Project Central. net)

Things to do before testing Download Nunit msi from and install nunit.

Things to do before testing cont…. Add nunit.frameworks.dll to your project references. This dll resides in nunit\bin folder. The next few screen shots show how to add this dll file if your project has been opened as a classlibrary.

Select the Solution explorer mode

Right click references and select Add reference

Select Browse

Goto the nunit\bin directory, choose nunit.framework.dll and press open.

Now press ok in the Add reference page

The dll has been added to your reference list.

In your code, add using nunit.framework.

Add testfixture to your program

TestFixture Example [TestFixture] public class calcTest{ [Test] public void AdditionTests(){ calculator cal=new calculator(); cal.Addition(5,10); //CASE 1 Assert.AreEqual(15,cal.output()); cal.Addition(-5,10); // CASE 2 Assert.AreEqual(15,cal.output()); } [Test] public void DivisionTests(){ calculator cal=new calculator(); cal.Division(10,2); // CASE 1 Assert.AreEqual(5,cal.output()); cal.Division(10,0); //CASE 2 Assert.AreEqual(2,cal.output()); } }//for testfixture

How to write your test code Suppose you want to test the functions in a class, your testfixture(test stub) should look somewhat like this using NUnit.Framework; Namespace sample1{ public class sampleclass(){ public void func1(){} }//for sampleclass [TestFixture] public class sampleTest(){ [Test] public void test1(){ testcase1; testcase2; }//for test1() }//for sampleTest textfixture }//for namespace

Calculator Example using System; using NUnit.Framework; namespace ClassLibrary1 { public class calculator { private int result; public void Addition(int num1,int num2){ result=num1+num2; } public int output(){ return result; } public void Division(int num1,int num2){ if(num2==0){ throw new DivideByZeroException(); } result = num1/num2; }

Calculator Example cont… [TestFixture] public class calcTest { [Test] public void AdditionTests(){ calculator cal=new calculator(); cal.Addition(5,10);Console.Write("TESTING 5+10\n"); Assert.AreEqual(15,cal.output()); cal.Addition(-5,10);Console.Write("TESTING -5+10\n"); Assert.AreEqual(5,cal.output()); } [Test] public void DivisionTests(){ calculator cal=new calculator(); cal.Division(10,2); Console.Write("TESTING 10div2\n"); Assert.AreEqual(5,cal.output()); cal.Division(10,0); Console.Write("TESTING 10div0\n"); Assert.AreEqual(0,cal.output()); } }//for testfixture }//for namespace

Build the Project After the testfixture is complete, build the project. This will create a dll file which will reside in projectname\bin\debug folder.

LOCATION of dll In this example I am copying the dll file from projectname\bin\debug folder to nunit\bin folder for my convenience. But this is not a requirement when we are testing and the dll can be run from projectname\bin\debug folder.

Location of exe files

Starting the GUI from console The GUI can be started from the console by executing nunit-gui.exe [inputfilename][options] Ex: nunit-gui.exe nunit.tests.dll –run This option will load the dll file and run the test. * Options with their values are separated by an equal, colon or a space.

Starting the GUI from console nunit-gui.exe [inputfilename][options] Options: /help short format: /? /config=STR project config to load /noload suppress loading of last proj /run Automatically run after load /fixture=STR Fixture to test

GUI MODE The steps to be followed are Load the Dll file. Select Run. View the errors if any on the GUI screen. Save the output XML if necessary.

Select open in the NUNIT GUI

Select the dll which you want to test(In this case, we have moved the dll to the nunit\bin folder)

Runs Perfectly

Tests Fail

To save the output in an XML file

Writing in the output file In the GUI mode, the user must specify that he/she wants to save the output. No xml output file is automatically created on the users behalf. But in Console mode, a XML file is created even if not specified by the user.

Console mode The command to execute the exe in console mode is nunit-console.exe [filename] [option] Example: nunit-console.exe classlibrary1.dll - XML=ourfile.xml

The different options are Nunit-console [inputfiles][options] Options /Fixture=STR Fixture to test /config=STR project configuration to load /XML=STR Name of XML output file /transform=STR name of transform file /xmlConsole display XML to the console /output=STR File to receive test output (short :/out=STR) /err=STR File to receive test error output /labels Label each test in stdout /include = STR list of categories to include /exclude = STR list of categories to exclude /noshadow disable shadow option /thread runs thread on a separate thread /wait wait for input before closing console window /nologo Do not display the logo /help Display help (short format: /?)

Runs Perfectly

Test Fails

Output file As mentioned earlier, in console mode the xml file is automatically created as testresult.xml in the nunit\bin folder. The user can change the name of the output file by saying -XML = newfilename.xml as shown in the previous slide.

Now lets Examine the Output file (test passed)

Test Failed

Failure message(1 message)

Test Failure(2 tests)

Proposed Architecture The architecture which has been proposed by the architect is The user shall run his tests in the console mode of the nUnit tool after the dll has been created by the nAnt tool. The output XML file shall be sent to the User Interface to accommodate information about the user, date, time and other related information.

NUNIT Thank you