Our company haven't Team Foundation Server, to do the integration web test, I plan to extend our existed AppMonitor application to run my .webtest file.  the AppMon just simply call powershell script to send request to the webpage, if it can pick up the webtest, it can do more complicate testing.

To approach that final goal, the first thing is get the classes for the .webtest file deserialization.

below are my steps:
1. rename webtest1.webtest to webtest1.xml
2. in VS command line window, run "xsd webtest1.xml", and you will get webtest1.xsd
3. "xsd webtest1.xsd /classes", you class will be generated.

xsd webtest1.xml
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 4.0.30319.1]
Copyright (C) Microsoft Corporation. All rights reserved.
Writing file 'C:\Users\llj\Documents\Visual Studio 2010\Projects\TestProject1\Te
stProject1\webtest1.xsd'.

xsd webtest1.xsd /classes
Microsoft (R) Xml Schemas/DataTypes support utility
[Microsoft (R) .NET Framework, Version 4.0.30319.1]
Copyright (C) Microsoft Corporation. All rights reserved.
Writing file 'C:\Users\llj\Documents\Visual Studio 2010\Projects\TestProject1\Te
stProject1\webtest1.cs'.



 
Categories: C# | UnitTest


Fiddler2 includes the ability to capture web traffic (including AJAX requests) for later playback with the Visual Studio Web Test product.

Simply run Fiddler and then interact with your Web Application.  When you've finished using your web application, click File > Export Sessions > All Sessions. In the dialog, choose Visual Studio WebTest.


url


 
Categories: UnitTest

Tools--> Manage Add-ons--> Microsoft Corporation-->Microsoft Web Test Record
(and I noticed the Fiddler2 is not enable there either..)




After enable it, You can see the Web Test Recorder bar in the IE window's left.

   


 
Categories: UnitTest | VS 2008

1. Defined [DataContract] but forget [DataMember] in DTO .You will got return DTO with all member be null or 0;
if all  proprieties are datamember ,just need [Serializable],
but the fields name may be end with  'k__backingfield' if you generate class from service xml in client. 
to fix this, either add [DataMember] to classes, or use the classes in client side also.


2. DataMember use Enum type which first item value not 0,  and didn't initial  the value. it will cause serialize/deserialize issue.
for example,
public enum SessionLOB //Line Of Business
    {
        UnDefined = 1, Auto = 4, InstantRenter = 5, StandardRenter = 32, HomeOwner = 37
    } ;
and with MyDTO has properties lob
public  SessionLOB lob { get; set; }

if the lob was not initialed and not be set a value, you will get null DTO, because it failed to deserialize 0 to SessionLOB 


 
Categories: C# | WCF

My Ajax call replace a dropdown box,  then call
$('select').each(function () {
              $(this).selectBox();
            });

to update the jquery selectBox look and feel again.

but it caused the "setting is undefined: settings.menuTransition" error,

to fixed that need add

            $('select').each(function () {
                $(this).selectBox('destroy');
              
            });
Before the Ajax Call, so the next time you Initial it .the dropdown will be function..

 
Categories: JQuery

September 16, 2011
@ 12:44 AM
check the JQuery Ajax:
$.ajax({
type: "POST",
url: this.url,
data: form_data,
beforeSend: function() {
$('#ajaxDetails').addClass('progress');
},
error: function() {
$('#status').text('Update failed—try again.').slideDown('slow');
},
success: function() {
$('#status').text('Update successful!');
},
complete: function() {
$('#ajaxDetails').removeClass('progress');
setTimeout(function() {
$('#status').slideUp('slow');
}, 3000);
}
});

to get the from data:
var form_data = $("form").serialize();
var form_data_array = $("form").serializeArray();
a simple example:
$(document).ready(function() {
$('#submit').click(function () {
var name = $('.uname').val();
var data = 'uname=' + name;
$.ajax({
type:"GET",
url:"welcome.php",
data: data,
success: function (html) {
$('#message').html(html);
}
});
return false;
});
});


and MVC3 Ajax
@using (Ajax.BeginForm(       
"ActionName",
"ControllerName",
new AjaxOptions {
 UpdateTargetId = "modal-dialog",
OnFailure="searchFailed",
OnBegin = "Dialog.Updating()",
OnSuccess = "Dialog.Update({title:'Select Friends'})"
})) {
… <input type="submit" value="Next" />
}





 
Categories: JQuery | MVC

September 10, 2011
@ 01:05 AM
I created a new MVC project, and test the remote validation in the about page.

1)Controller Home:
               public ActionResult ValidateTestName(string testName)
        {
            return Json(!testName.Equals("test"),
                        JsonRequestBehavior.AllowGet);
        }
2)Model:
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;

namespace MvcApplication1.Models
{
    public class AboutModel
    {
        [Required]
        [Remote("ValidateTestName", "Home", ErrorMessage = "this Name already be used.")]
        public string TestName { get; set; }

        [Required]
        [Range(20, 44)]
        public int Age { get; set; }
    
    }
}  
3)View:
In _Layout.cshtml:
 

    
    
In About.cshtml

@model MvcApplication1.Models.AboutModel
@{
    ViewBag.Title = "About Us";
}

About

Put content here. @using (Html.BeginForm()) { @Html.EditorForModel(); "submit" value="Submit" /> }


It is working perfect under FireFox 6:



but not working in my IE9 :(...
I have downloaded Jquery.Validation 1.8.1 try to fix this issue, but looks still unlucky.
(Jquery.Validation site : http://bassistance.de/jquery-plugins/jquery-plugin-validation/)


but this post in stack overflow said it tested in
Chrome 10.0, IE9 and FireFox 4.0
 
Categories: Asp.net | MVC

August 16, 2011
@ 12:35 PM
http://fsymbols.com/computer/trademark/#windows

hold alt and input 0153 you will got ™
0174 you will got ®

to put/replace them in string:
str.Replace("&#174;","\u00AE").Replace("&#174", "\u00AE").
                    Replace("&#0153;", "\u2122")


some time you need use <sup>&reg;</sup> in html


 
Categories: WebDesign

August 15, 2011
@ 08:47 PM
this file is made last year before I changed job.

Favorite Projects.docx (17.61 KB)
 
Categories: ProjectManagement