Sunday, December 28, 2014

Qualities of a good tester

Developers are needed to make software but testers are also needed to assure quality software. However, many times testers seem to think that their objective is finding bugs rather than ensuring quality software is being developed. The following qualities should be looked for when recruiting a tester.
  • Methodical
  • Organized
  • Systematic
  • Tactful/Diplomatic but firm
  • Evidence oriented
  • Understanding
  • Detail oriented
  • Clear and concise communicator
  • Forward thinking (Need to anticipate risks)
  • Curious to experiment and see outcomes


Of course, not every tester will have all those qualities completely. Some will take years of testing experience to acquire those attributes. There are no perfect developers and testers but we can make a team with testers completing those desired qualities. 

Reference:

Marick, Brian. (2001) Classic Testing Mistakes.  Springer Berlin Heidelberg.

Saturday, December 20, 2014

QR Generation ASp.net MVC

The following C# ASP.net MVC project was done in Visual Studio 2012. The Zxing Dlls were obtained in
http://zxingnet.codeplex.com
After obtaining the dynamically linked libraries (dlls), It is time to create the Asp.net Web project. The figure below shows that the example was made using .Net Framework 4.5.1 while the language is C# using the ASP.net MVC Web project template.
image

Upon creating the project, Go to a the Home View files and open the index.cshtml
image
Feel free to change the text provided by the template before an initial test of the page. You can test by
pressing the button beside the browser.
image

The Page should appear with the expected content
image
Reference the Zxing Dlls
image
Browse to wherever the dlls are located. Then check if the zxing dlls were successfully referenced.
image
image
Add a class for the QR code generator. Name the class
image
The class was named QRCodeGenerator
Below is the code for that class
-----


----
Next step is to add a controller method that will call the QRCodeGenerator class's method returning the rendered image. The code of the method is seen below. In this example the Home Controller was given the method that returns the html code with the QR image of a given text
---

---
Enter the code for the cshtml. In this example the index under the Home contained the code for the Qr
Generation.

---
In my example the following code were modified after Visual Studio generated the Asp.net MVC C#
project
image
Look at the results. The solution should be ready to be built and published
image
After the publishing the page should appear on a browser. Feel free to enter a url on the textbox and
press the Get QR button
image


Sunday, November 23, 2014

Showing Date Difference with javascript html.

The following shows that it is possible to get the amount of days between dates using html and javascript. The code implemented requires jquery. A sample can be seen here

Here is the code

Saturday, November 1, 2014

Install Mysql server on Ubuntu 14.04

Summary of steps

  1. open terminal
  2. type sudo apt-get install mysql-server
  3. Confirm installation by pressing Y
  4. Wait for installation to complete
  5. Enter root proposed password when promted
  6. Confirm root password
  7. Enter command for running mysql server mysql –u root –p
  8. Type the root password confirmed earlier
  9. Done, feel free to use the Mysql database commands

. Go to the terminal and type sudo apt-get install mysql-server to start the installation. Eventually, a prompt will ask to continue or not. Enter Y to proceed to the installation. image

You will be then asked for a password for the root account. Type it and reenter it.

image

image

After that more files are loaded until the installation is completed. Once the installation is completed, enter mysql –u root –p on the terminal. Afterwards,type in the root password entered earlier. You should then see the Mysql server communicating on the terminal.image

Friday, October 31, 2014

Date Picker with Jquery

image

 

Jquery made it easy for making a date picker. Here is a sample code used in http://formatdelimeters.azurewebsites.net/Home/About.


<link rel="stylesheet" href="//code.jquery.com/ui/1.11.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.2/jquery-ui.js"></script>

<h3>Pick a date</h3>
<p>Date: <input type="text" id="datepicker"></p>
<p>Use this area to provide additional information.</p>

<script>
        $("#datepicker").datepicker();
</script>

Sunday, October 19, 2014

SQL Joining Illustrations

SQL Joining is used to combine rows of two or more tables. There are 4 general types of SQL joining which are inner, left, right and full outer.

Let’s start with inner Join. The image below shows that the returned rows with at least one match on both tables

Inner Join Sample Inner Join Code
image

SELECT <select_list>

FROM TABLE A A

INNER JOIN TABLE B B

ON A.key=B.Key;

The next is left Join where the rows from the left table as well as the rows matched rows on the right table are returned.

Left Join Sample Left Join Code
image

SELECT <select_list> FROM TABLE A A

LEFT JOIN TABLE B B

ON A.key=B.Key;

Conversely, right Join has rows from the right table as well as those that matched on the left table returned.

Right Join Sample Right Join Code
image

SELECT <select_list> FROM TABLE A A

RIGHT JOIN TABLE B B

ON A.key=B.Key

Full Join returns rows that have at least a match in one of the tables.

Full Outer Join Sample Full Outer Join Code
image

SELECT <select_list> FROM TABLE A A

FULL OUTER JOIN TABLE B B

ON A.key=B.Key

Sunday, September 28, 2014

Generate table out of CSV text



The goal here is to have Csv texts be represented in Html tables.
Csv to Table


Javascript
function WriteCsvToTable(csvText, TablePane) {

    /*Variable Declaration*/
    var Rows = csvText.split("\n"), Html = [];

    /*Loop that makes the rows
      Each row is split with the mark of the comma.
      Then Joined to make the row
     */
    for (var ctr = 0; ctr < Rows.length; ctr++)
        Html.push("<tr><td>" + Rows[ctr].split(",").join("</td><td>") + "</td></tr>");

    Html = "<table>" + Html.join("") + "</table>";
    $(TablePane).html(Html);
}
/*Source http://jsfiddle.net/frvQ2/*/


The code above is the Javascript code that occurs during the click event. It is important to know that the Javascript code above requires Jquery. It is assumed that the “csvText” parameter matches the CSV format. The next parameter is a string to be queried with jquery funtions.  It is assumed both parameters matches the format required of them.

The first line executed in the functions is Variable declaration. The first variable is “Rows” which is an array generated from splitting the lines of the csv text entered. The next variable starts as an empty array where table related html elements are to be added.

The loop performs a one liner of code that adds content to the Html array. Each element of the array contains multiple html elements (this naming convention can be confusing). Each array element pushed starts with the "
"
_tags and ends with "
" closing tags. What’s between them is a result of an array and string javascript functions. The current element in the Row array represents the line in the csv text. The current line is split with its commas (,). Each of those commas are replaced with tags. Henceforth, those texts before commas and the line break are now in a table cell.

The Html array resulting from the loop is turned in to string with the table opening and closing tags between the appended string values from the Html array. This generates the final table code to be the content of the pane specified in the TablePane parameter.
HTML
<div class="row">
    <h1>Enter Your CSV Here:</h1>
    <textarea id="csv" class="text">
        Id,Product Name,Price
        1,Sailor Hat,$5
        2,Old Rod,$50
        3,Waffle Maker,$120</textarea>
</div>
<div class="row">
    <a href="#TablePane" onclick="WriteCsvToTable($('#csv').val(), '#TablePane')" class="btn  btn-primary">Generate Table</a>
   
</div>
<div class="row" id="TablePane">

</div>


The HTML code above contains a textbox where a user can enter CSV texts. A button that will call the function that generates a table representing the Csv specified upon click. There is also the panel where the table will be shown.

CSS
#TablePane tr:nth-child(odd) td{
            background:#beeab4;
        }
        #TablePane td {
            border : thin black solid;
            width:1%;
        }
CSS can also be applied for the table’s looks.

The link below has the results of the script with a few UI related modifications. It's a page from an Microsoft Azure website using the free tier. Constant up time is not a guarantee.

Sunday, September 21, 2014

Comma Separated Values (CSV)

Comma Separated Values (CSV) file format is used to present tabular data in a plain text format.  The first line is like a header column informing the field/column names in each record seen on the succeeding rows. Each line after the first in a csv text is a record that is separated from other records with line breaks. Those records have fields or field values separated by a comma (,). The format is quite popular as a means of transferring tabular data between different applications.

CSV example
Id,Product Name,Price
1,Sailor Hat,$5
2,Old Rod,$50
3,Waffle Maker,$120

Many programming languages have ways to parse the format. Java has several libraries for CSV including openscv. Meanwhile, Microsoft's dot Net framework (.Net) has Csv Reader and a built in parser class that can be set for a csv format. PHP even has a function built in for csv fgetcsv().  Technically, any programming language that has I/O support can read and write csv files. It's just plain text and not binaries.

There are other formats for representing data in plain text including JSON and XML. However, it seems that not all JSON or XML content can be read by spreadsheets applications. JSON and xml are not confined to a tabular representation of data. The tabular separation makes csv simple to generate from a database management system or DBMS.

Spreadsheet applications such as Microsoft Excel can read and write csv files natively. Those csv files can also be read and written by the spreadsheet application of LibreOffice. Furthermore, spreadsheet applications are often used to read csv files generated from database management systems. 

Reference
EdoCeo. "Comma Separated Values (CSV) Standard File Format." n.d. Edoceo. 2014 .
Microsoft. "Import or export text (.txt or .csv) files." 2006. Office. 2014 .
Networking Group. "Common Format and MIME Type for CSV Files." October 2005. 2014 .


Csv and Json can represent tabular data so they are interchangeable in some cases
There is a CSV to JSON converter here http://formatdelimeters.azurewebsites.net/ thought it's just an Azure website that can be taken down anytime

Saturday, August 23, 2014

Unit Testing C#

Unit test shown below are done with Microsoft unit test framework. Unit test is done to make sure properties, attributes and actions work as expected. A Professional IDE for developers needs to have unit test support since unit testing is a requirement in quality software development. Visual studio being a professional IDE, has capabilities for unit testing including the test explorer Microsoft cited to run unit tests efficiently. Moreover, Visual studio has capabilities in simplifying unit test creation. There are test cases and annotations already so Visual Studio is aware if a class is intended for unit testing or not. Microsoft recommended that test methods are made as soon as the method was created to define and check expectations.
First make sure there is/are class/classes to test on. Afterwards, add a test project in the solution. The test project is where test classes can be created and defined.


Next, make sure the test project has reference of the project that has the classes to be tested. This step ensures that the test classes (or the classes with test methods) can call the classes to be tested.


You can rename the auto generated test class or add your own Test class. This is also a good time to have the test explorer.


There is a class below that has mathematical functions. The other class is a test class that determines if the results from the mathematical functions are correct. Pardon the awful naming convention.
Mathematical function caller
public class MathOperator
    {
        public int Fibonacci(int number)
        {
            if (number <= 1)
                return number;
            return Fibonacci(number - 1) + Fibonacci(number - 2);
        }

        public int Summation(int maxNumber)
        {
            if (maxNumber <= 1)
                return maxNumber;
            return maxNumber + Summation(maxNumber - 1);
        }

    }

Test class
[TestClass]
    public class MathFuncTest
    {
        [TestMethod]
        public void TestFibonacci()
        {
            MathOperator toBeTested = new MathOperator();
            Assert.AreEqual(toBeTested.Fibonacci(2), 1);
        }

        [TestMethod]
        public void TestFibonacci_F3()
        {
            MathOperator toBeTested = new MathOperator();
            Assert.AreEqual(toBeTested.Fibonacci(3), 2);
        }

        [TestMethod]
        public void TestFibonacci_F8()
        {
            MathOperator toBeTested = new MathOperator();
            Assert.AreEqual(toBeTested.Fibonacci(8), 21);
        }

        [TestMethod]
        public void TestSummation_n100()
        {
            MathOperator toBeTested = new MathOperator();
            Assert.AreEqual(toBeTested.Summation(100), 5050);
        }
    }

As seen above, the test class contains an annotation [TestClass] indicating that the class is made for testing purposes and not to be part of the build. The [TestMethod] annotation indicates that the method is to be called when tests are commanded to be run. Running tests can be done from the test explorer where the user can click Run all. Tests can either pass or fail. The results will be visible on the Test explorer. Pass is given when the assertion has the expected result. A fail is given when he assertion did not have the expected result or when an unanticipated exception occurred. Furthermore, a right click on the test class name allows the user to run tests in the class by clicking the Run Tests option or using the keyboard shortcut specified.

All of these are done for the sake of having expectations for classes and their methods. Unit testing is a part of professional software development as evident by the fact that Visual Studio supports it.So be ready in making test classes especially on test driven software projects.

Sunday, July 6, 2014

Crashing Report: Visual Studio. Mysql Export

I experienced a fatal error when I tried to export data from a Mysql database in Visual Studio. The database is on an Azure VM.
The error occurred after I selected a database(censored database name on the combobox). At first, the combobox was empty. I selected A database then Visual Studio Crashed. I repeated the procedure and it all results into Visual Studio 2013 crashing.
I reopened Visual Studio and tried looking for any clues regarding the crash. I easily found a related error. 

The error appears after clicking the item highlighted above. Interacting with the prompt is harmless.
The prompt indicated that there is a problem in getting the information regarding the database. The Access issue might have also occurred in the fatal error. Nevertheless, Visual Studio should have not crashed due to a disconnection. There should have been a fail safe or an error handler for this kind of situations. An error prompt like the one that appeared on the non fatal issue would have been nice instead of crashing Visual Studio.

The experience highlights that connecting on an external Mysql database from an Azure VM can be troubling. I also experienced server disconnection as seen in server explorer. Question is how to make databases connections to Azure VMs be reliable