Chuan Chuan Law

DevOps | Software Automation | Continuous Integration

Year: 2013 (page 1 of 2)

Unable To Build After Upgrade To MVC4 Targeting 4.0 and VS2010

If you have upgraded your MVC3 project to MVC4 running in VS2010, and still targeting the 4.0 framework, you will have problem while running your build as below:

To fix this problem, you need to do the following:

  1. Unload the project in Visual Studio
    2.  Edit the .csproj file

3. Comment out the lines as below:

 

  4. Reload the project
  5. Re-build and you should see a success build!

 

What Does A QA Do?

I held a learning session with my team a couple of weeks ago about this topic “What Does A QA Do?” The reason is because I think as we are so much driven into the daily tasks and responsibilities to deliver projects and hitting deadlines, sometimes its good to take a pause and rethink, “What are you actually supposed to be doing?”
Who are we?
 
There are many definitions of the role. QA, tester, test analyst, test engineer. Regardless of what our official title is, I think we are simply part of the development team that help the team to deliver a quality and successful product.
What do we do?
 
Most would say we find bugs and raise them. Correct, but not just that. We link business requirements with technical design, into a quality end user product.
How do we do our job?
 
There are many technical terms for this, manual, exploratory, automation, regression, performance, security, etc. Firstly, we need to have the knowledge of a product manager to know what product are we building. Secondly, we need to have the knowledge of a business analyst to understand the detailed business rules behind each piece of functionality built. Thirdly, we need to have the knowledge of a developer to understand the system design,  and technical solution such as what does the code do, the data flow into the database, etc. Lastly, we need to be able to use the product as an experienced end user.
What type of bugs we find?
Most would think that bugs are software bugs, careless mistakes by the developers. This is only a minor part of it. Bugs can be:

 

  • Product bug – building the wrong product from the very beginning, wrong idea
  • Requirement bug – caused by lack of understanding of the business rules and outside the square thinking
  • Software bug – caused by wrong implementation
  • Environment bug – caused by the way the software interacts with an operating system, system configuration, database version, etc
  • Deployment bug – caused by sequence of deploying (e.g.: running a script prior update of code might break a system), code merge mistake, database backward compatibility issues
  • Performance bug – all the above bugs are eliminated, but we forgot to take into account that the system might break down under peak usage
  • Security bug – all the above bugs are eliminated, but we forgot that there are back doors or windows opened that allow intruders in to break the system and do nasty stuff!
Conclusion
I am not trying to over complicate things. Many would think QA only test. Yes, but a good QA does not only test. A good QA should have the following skill sets:
  • Good understanding of business knowledge
  • Able to think outside the square
  • Good communication skill with technical and non-technical stakeholders
  • Good team player
  • Good technical skills

 

 
 

Code For Web Services Regression Tests

This is to replace my July post with the link to the source code in GitHub which I have remove for security reasons.

However, below is how the code looks like:

#!/usr/bin/ruby

class WebServices
def main_method
f=IO.popen(“curl –request POST –header ‘Content-type: text/xml’ –data @adauthenticate.xml -s -v -D – http://webservices.pageup.com.au/nas/ADAuthenticate/ADAuthenticate.asmx 2>/dev/null>result.xml”).readlines
evalresult(“authenticate”)

f=IO.popen(“curl –request POST –header ‘Content-type: text/xml’ –data @bulkData.xml -s -v -D – http://webservices.pageup.com.au/nas/BulkData/BulkData.asmx?op=GetAvailableImportItemTypes 2>/dev/null>result.xml”).readlines
evalresult(“bulkData”)

f=IO.popen(“curl –request POST –header ‘Content-type: text/xml’ –data @htmlToPdf.xml -s -v -D – http://webservices.pageup.com.au/nas/HTMLToPDF/HTMLToPDF.asmx?op=GetToken 2>/dev/null>result.xml”).readlines
evalresult(“HTMLToPDF”)

f=IO.popen(“curl –request POST –header ‘Content-type: text/xml’ –data @htmlToRtf.xml -s -v -D – http://webservices.pageup.com.au/nas/HTMLToRTF/HTMLToRTF.ASMX?op=URLToRTF 2>/dev/null>result.xml”).readlines
evalresult(“HTMLToRTF”)

f=IO.popen(“curl –request POST –header ‘Content-type: text/xml’ –data @jobSource.xml -s -v -D – http://webservices.pageup.com.au/nas/JobSourceWS/JobSourceWS.asmx?op=GetToken 2>/dev/null>result.xml”).readlines
evalresult(“jobSource”)

f=IO.popen(“curl –request POST –header ‘Content-type: text/xml’ –data @jobSource2.xml -s -v -D – http://webservices.pageup.com.au/nas/JobSourceWS/JobSourceWS.asmx?op=UpdateJobSource  2>/dev/null>result.xml”).readlines
evalresult(“updateJobSource”)

f=IO.popen(“curl –request POST –header ‘Content-type: text/xml’ –data @mediaOrder.xml -s -v -D – http://webservices.pageup.com.au/nas/MEDIAORDERWS/MediaOrderWS.asmx?op=GetToken 2>/dev/null>result.xml”).readlines
evalresult(“MediaOrder”)

f=IO.popen(“curl –request POST –header ‘Content-type: text/xml’ –data @pageUpPeople.xml -s -v -D – http://webservices.pageup.com.au/nas/PageUpPeopleWS//PageUpPeople.asmx?op=GetApplicant 2>/dev/null>result.xml”).readlines
evalresult(“PageUpPeople”)

f=IO.popen(“curl –request POST –header ‘Content-type: text/xml’ –data @pdfReportGenerator.xml -s -v -D – http://webservices.pageup.com.au/nas/PDFReportGenerator/PDFReportGenerator.asmx?op=Generate360ReportWS 2>/dev/null>result.xml”).readlines
evalresult(“PDFReportGenerator”)

f=IO.popen(“curl –request POST –header ‘Content-type: text/xml’ –data @pdfToHtml.xml -s -v -D – http://webservices.pageup.com.au/nas/PDFtoHTML/PDFtoHTML.asmx?op=PDFToHTML 2>/dev/null>result.xml”).readlines
evalresult(“PDFToHTML”)

f=IO.popen(“curl http://webservices.pageuppeople.com/nas/JobsRest/JobListing.svc/218/caw/en  2>/dev/null>result.xml”).readlines
evalresult(“JobRest”)

end

def evalresult(webserviceType)
f=File.new(“/Users/chuan/webservicesTest/result.xml”)
text = f.read

if (webserviceType==”authenticate”) then
print “Authenticate: ”
if (text =~/HTTP/1.1 200 OK/ && text =~/Success/) then
print  “Successn”
else
print  “Failn”
end
end

if (webserviceType==”bulkData”) then
print “Bulk Data: ”
if (text =~/HTTP/1.1 200 OK/ && text =~/OrgUnit/) then
print  “Successn”
else
print  “Failn”
end
end

if (webserviceType==”HTMLToPDF”) then
print “HTML To PDF: ”
if (text =~/HTTP/1.1 200 OK/) then
print  “Successn”
else
print  “Failn”
end
end

if (webserviceType==”jobSource”) then
print “Job Source: ”
if (text =~/HTTP/1.1 200 OK/) then
print  “Successn”
token=text.scan(/(.*)</GetTokenResult>/)
token_string=token.to_s
token_string.gsub!(/[^a-zA-Z0-9-]/,””)
File.open(‘jobSource2.xml’, ‘w’) do |f1|
f1.puts ”
f1.puts ‘  ‘
f1.puts ‘    ‘
f1.puts ”      #{token_string}”
f1.puts ‘     test’
f1.puts ‘
‘                    f1.puts   ‘
‘                    f1.puts ‘
‘                     end
else
print  “Failn”
end
end

if (webserviceType==”updateJobSource”) then
print “Job Source – Update Job Source: ”
if (text =~/HTTP/1.1 200 OK/) then
print  “Successn”
else
print  “Failn”
end
end

if (webserviceType==”MediaOrder”) then
print “Media Order: ”
if (text =~/HTTP/1.1 200 OK/) then
print  “Successn”
else
print  “Failn”
end
end

if (webserviceType==”PageUpPeople”) then
print “PageUpPeople: ”
if (text =~/HTTP/1.1 200 OK/ && text =~/tester145127@pup.com/) then
print  “Successn”
else
print  “Failn”
end
end

if (webserviceType==”PDFReportGenerator”) then
print “PDFReportGenerator: ”
if (text =~/HTTP/1.1 200 OK/) then
print  “Successn”
else
print  “Failn”
end
end

if (webserviceType==”PDFToHTML”) then
print “PDFToHTML: ”
if (text =~/HTTP/1.1 200 OK/) then
print  “Successn”
else
print  “Failn”
end
end

if (webserviceType==”JobRest”) then
print “JobRest: ”
if (text =~/Account management/) then
print  “Successn”
else
print  “Failn”
end
end

end

end

WebServices.new.main_method

Principles Of Regression Test

I guess I have posted a lot of technical stuff in my blog. However, I would like to go into a more theoritical side of things about software testing today – how to write a regression test.
So, what is regression test? Everyone knows that it is a set of test to make sure that existing functionality still works after new functionalities are added.
But how to write a good regression test? Most would think that the more tests you add into a regression test suite the better it is. This is a wrong view about regression test.
There are rules to follow in order to write an effective and efficient regression test suite. These rules are:

 

  • Test all the core functions of the system (not the little help screen)
  • Test the happy path and user would follow (not edge cases)
  • Partition it logically based on system or core modules so that it is easily readable and accessible
  • Partition a set of tests that will be run before every release (very important core modules) and others that will only be run when necessary (changes occur)
  • Keep it as simple and short as possible
  • Avoid repetitive steps
However, please bear in mind that I am not trying to say we do not want to test more in regression test. I simply mean that most edge cases and low level tests should be in the unit test level instead of functional regression test.

Web Services Regression Test Suite

To follow the previous blog, I have completed the regression test suite for web services.

The code has been checked into GitHub at Git Hub

Regression Testing Web Services

The mechanism I use to regression test web services is the same as the mechanism I test API, which is by using:

  • Curl
  • Ruby
Curl is main tool to call the web services and it sits inside the Ruby script which is used to do other functions such as checking the output, etc.
For example, the Curl command below will pass the XML file to the JobSource web service and pipe the output to another XML file:

 f=IO.popen(“curl –request POST –header ‘Content-type: text/xml’ –data @jobSource2.xml -s -v -D – http://webservices.pageup.com.au/JobSourceWS/JobSourceWS.asmx?op=UpdateJobSource  2>/dev/null>result.xml”).readlines

How To Bypass Untrusted SSL Connection II

I guess I have blogged about how to bypass Untrusted SSL Connection before by using your local computer’s FireFox with stored certificate. However, there are cases when by doing this itself is not sufficient.

Below is what you can do besides that:

1. Enter “about:config” in the address bar of your FireFox
2. Enter the following settings (https://pusso is the website I want to bypass)

3. Use the following code in your Selenium code

FirefoxProfile profile = new FirefoxProfile(@”pathtolocalfirefoxprofile”);
profile.SetPreference(“network.http.phishy-userpass-length”, 255);
profile.SetPreference(“network.automatic-ntlm-auth.trusted-uris”, “pusso”);

Uploading Files in Windows Using Selenium C#

I have encountered a situation where I need to click on a button in order to upload a file.

I test this using Selenium C# by:

1. Entering the file path into the box

driver.FindElement(By.Id(“uploadFile”)).SendKeys(“C/testFile.txt”);

2. Calling the Javascript function to simulate what happens when “Upload” button is clicked

IJavaScriptExecutor js = driver as IJavaScriptExecutor;

string script = “__doPostBack(‘uploadFileButton’,”)”;

js.ExecuteScript(script);

Database Migration Test Script

To assist the testing in database migration or database changes, I have built a script that does the following:

  1. Pass in the connection of the 2 databases that you want to compare
  2. For each database, list out all the tables in alphabetical order
  3. For each table, print out the number of columns and the number of rows
  4. Print out the tables that exist in Database A but not not Database B and vice versa
  5. For tables that exist in both databases, compare the number of columns, number of rows, and database schema (e.g.: varchar or nvarchar)
  6. If database schema is different, print out the schema in both databases

Selenium – How To Bypass Untrusted SSL Connection

In order to bypass the untrusted SSL connection error, you will need to:

  • Launch the browser from desktop
  • Manually adds the exception to bypass the untrusted SSL message
  • Declare the web driver to use the desktop browser’s profile instead of Selenium’s default profile
FirefoxProfile profile = new FirefoxProfile(@”C:UserschuanlAppDataRoaming MozillaFirefoxProfilesqu7su2xj.default”);
IWebDriver driver = new FirefoxDriver(profile); 
  • Once that is done, when you run Selenium, you will not get the untrusted SSL message again.
« Older posts

© 2019 Chuan Chuan Law

Theme by Anders NorenUp ↑