- Installing NUnitAsp requires only a few steps
- Download and unzip NUnitAsp.
- You've probably already done this step, but if not, read on.
- Unzip the NUnitAsp package into a directory of your choice, such as "C:\Program Files\NUnitAsp"
- Install NUnit.
- You can use any testing tool, but NUnit is the most common.
- Reference NUnitAsp in your test projects.
- Copy bin\NUnitAdapter.cs into your test project. (This file isn't required, but it makes working with NUnit easier.)
- Add bin\nunitasp.dll as a reference.
Steps
To Work With NUnit
- Install Download NUnit which is an open source.
- Install Nuint in your system
- Add References in Website we need to test
C:\Program
Files\NUnit 2.5.2\bin\net-2.0\framework
i.e.
nunit.framework.dll
nunit.mock.dll
nunit.framework.dll
4)
Add Class file to your App_Code (same directory of class file
which you want to test).
- Create your own test cases in that class file.
6.Publish your website and store all assembly in a folder outside the root directory
7. Create
a config file for your Assembly (e.g. if your assembly name is
App_Code.dll
then
its config file should be App_Code.dll.config)
How
selenium Run through NUnit:
- Open NUnit IDE through start menu.
- Go to File > Open Project
- Navigate to the directory where your dll is saved
- Add Assembly to NUnit. (e.g. App_Code.dll)
- Click on Run and the test cases will run
The
test cases will run now and if the status will be failed then there
will be a red bar and if Status is
Passed
then there will be a green bar.
Result
Evaluation
Result
can be analyzed from result status bar.
When
Script is passed the status Bar is green and number of passed script
are shown (as shown below).
When
the script is failed then the status bar id Red number of passed
script as well.
Test
result will also store in xml form in the same directory where your
dll is and it is shown.
Special
Note:
- As NUnit does not recognize Global.asax , So we have to add [SetUp] method, this method will be called before each test method in the derived class so mention all that things we need to initialize before running the test cases
- It also doesn’t recognize Web.config. So we have to create a separate config file for your dll (if your dll is App_Code.dll then your config should be App_Code.dll.config and it should be in the same directory where your dll is)
- We are not running the test cases in web environment , so we cannot access Session variableHow to execute Selected test cases with NUnit:
- Open NUnit and select File >> Open
- Navigate the search folder where our selenium project is kept.
- Then double click on project .
- Go to bin folder and again double click here.
- Go to debug folder and again double click here.
- Here select project name dll file and click on it and then press open button of pop-up.
- Right click on header line and select collapse of location. Please see screen shot below.9) Click on + sign button and then all test fixture is open.10) Select desire test case which we want to execute, Click on + sign button regarding same test case.11) Select different test scripts with the help oh check box. Here we select many test scripts through checkbox according to scripts.12) Go to Test menu and click on Run All or press F5 button.For this only desire test scripts are execute and it gives only result which we want.How selenium project execute through NUnit:
- Go to selenium project location means where keep selenium project.
- Double Click on selenium project .
- Click on visual studio file which name is same as project name.
- Open Solution Explorer.
- Click on App.config file
- we want to execute this project.
- Click save button from the top save button menu bar.
- Click on Build button from the Build menu bar.
10) Then Open NUnit and select File >> Open11) Navigate the search folder where our selenium project is kept.12) Then double click on project .13) Go to bin folder and again double click here.14) Go to debug folder and again double click here.15) Here select project name dll file and click and then press open button of pop-up.
- After full test run we go click on Tools menu and again click save results as XML
- We give here desire location where we want to save this result.
- This result in XML format.
- Open this result and analyze pass and failure test cases with description.
1 comment:
its really interesting.....
hope we will learn more about the latest versions too..
Post a Comment