Tuesday, June 26, 2012

Custom Web Performance Rules


Create a Custom Extraction Rule for a Web Performance Test
http://msdn.microsoft.com/en-us/library/ms243179.aspx

Create a Custom Validation Rule for a Web Performance Test
http://msdn.microsoft.com/en-us/library/ms182556

Create a Web Performance Test Plug-In
http://msdn.microsoft.com/en-us/library/ms243191.aspx

Custom Extraction Rule - Extract Cookie Value
http://social.msdn.microsoft.com/Forums/en-US/vstswebtest/thread/cf2bf144-4e87-414f-8aa3-7731f9bc7b73/

Encode/Decode to Base64


//Encode

static public string EncodeTo64(string toEncode)
    {
      byte[] toEncodeAsBytes
            = System.Text.ASCIIEncoding.ASCII.GetBytes(toEncode);
      string returnValue
            = System.Convert.ToBase64String(toEncodeAsBytes);
      return returnValue;
    }


//Decode

    static public string DecodeFrom64(string encodedData)
    {
      byte[] encodedDataAsBytes
          = System.Convert.FromBase64String(encodedData);
      string returnValue =
         System.Text.ASCIIEncoding.ASCII.GetString(encodedDataAsBytes);
      return returnValue;
    }


//Usage

      string myData = “Here is a string to encode.”;

      string myDataEncoded = EncodeTo64(myData);
      Console.WriteLine(myDataEncoded);

      string myDataUnencoded = DecodeFrom64(myDataEncoded);
      Console.WriteLine(myDataUnencoded);

      Console.ReadLine();

Link where I got this from:
http://arcanecode.com/2007/03/21/encoding-strings-to-base64-in-c/

401 - Unauthorized error in Web Performance test

Scenario:
1. In a Visual Studio Web Performance test, make call to a web service that requires credentials.
=> you will get 401 - Unauthorized error (if you did not specify credentials)

Solution:
1. Add a Header (for Basic authentication) to the web test request: Right-click on the call -> Add Header.

2. Add the following info:
Name: "Authorization"
Value: “Basic ” + encodeBase64 (“username:password”)

Use http://www.base64encode.org/ to encode username and password in the following format: "username:password".

It should look like this:

Tuesday, June 19, 2012

RESTClient - usefull tool when working with REST services

You can download the tool from here:
https://addons.mozilla.org/en-US/firefox/addon/restclient/

After installting the Firefox addon you can use it to create all kinds of calls to the REST service.


Monday, June 18, 2012

Nice things you can do with Excel

Excel can be a very useful tool with few tricks.
Here is a collection of some of them:

1. ALT + Enter - to go on second line inside a cell.

2. View -> Freeze Panes -> Freeze top Row.
















3. =IF(logical_test,[value_if_true],[value_if_false]) - to display a result if the logical_test is true or false.

4. =SUMIF(range,criteria,[sum_range]) - to add elements in a range that match given criteria.

5. =COUNTIF(range,criteria) - to count elements in a range that match given criteria.


6. =COUNT(value1,[value2],...) - to count the number of cells in a range that contain numbers.


7. =COUNTBLANK(range) - to count number of blank cells in a range.

8. =COUNTA(value1,[value2],...) - to count the number of cells in a range that are not empty.

9. =OR(logical1,[logical2],...) - logic OR. Same for AND and NOT.

10. =SUM(number1,[number2],..) - to add numbers

11. =CONCATENATE(text1,[text2],...) - to concatenate strings

12. =VALUE(text) - to convert text to numbers

13. =TRIM(text) - to remove all spaces from a string

14. =ROUND(number,num_digits) - to round a number with specified number of digits.

15. =INT(number) - to round a number to the closest integer.

16. =RANDBETWEEN(top,bottom) - generates random number in given range.

17. =ISBLANK(value) - returns True if blank and False otherwise.

18. =CONVERT(number,from_unit,to_unit) - used to convert from a unit to another.

19. Home -> Conditional Formating.























Have fun :)

Monday, May 14, 2012

Run, Alina, run!


    There was a running competition in Timisoara, and I went with my colleagues :) from Haufe-Lexware.
It was cold and windy and I have never run this much in my life, but somehow it was worth it.
I felt like quiting many times, but managed to run 5km in 27:16 minutes, winning a 10th place in the women category: http://www.crosulfirmelor.ro/index.php/ro/rezultate-2012.html

    It was a really interesting experience. I had "Run, Alina, run!" written on the back of my tshirt, and people that I did not know where cheering. That was really nice and gave me a warm feeling of hope that I could do it.

    Here is a foto of me just before the finish line. I'm the one in blue :)
(oh, yeah I did not see that girl coming :P )