Sunday, 15 February 2015

C#(Help Links) - Miscellaneous

C# - Miscellaneous


2. TeamCity for .NET Developers - 2 - Setup
Reference: https://www.youtube.com/watch?v=d8ZFeAdLyP4 

3. Troubleshooting - Exception 'microsoft.ace.oledb.12.0' provider is not registered on the local machine. in c#
- Try to download and install "2007 Office System Driver: Data Connectivity Components" this may solve the exception. 
Reference: http://www.microsoft.com/en-in/download/details.aspx?id=23734

4.Facing problem while opening Visual Studio solution, while opening .cs file or while trying to run it. Error message "No exports were found that match the constraint contract name"
Solution:
(%AppData%\..\Local\Microsoft\VisualStudio\11.0\ComponentModelCache)
Just rename or delete the Microsoft.VisualStudio.Default.cache file inside the above location.
 

5. Visual J# 
Reference: https://msdn.microsoft.com/en-us/library/7xsxf8e2%28v=vs.80%29.aspx 

6. C# Fundamentals for Absolute Beginners 
Reference: http://www.microsoftvirtualacademy.com/training-courses/c-fundamentals-for-absolute-beginners 

7. C# calling the method in the class using reflection api.
Reference: https://msdn.microsoft.com/en-us/library/a89hcwhh%28v=vs.110%29.aspx

Below sample program using reflection api is copied from above url
using System.Reflection;
public class TestMethodInfo
{
    public static void Main()
    {
        // Get the constructor and create an instance of MagicClass

        Type magicType = Type.GetType("MagicClass");
        ConstructorInfo magicConstructor = magicType.GetConstructor(Type.EmptyTypes);
        object magicClassObject = magicConstructor.Invoke(new object[]{});

        // Get the ItsMagic method and invoke with a parameter value of 100

        MethodInfo magicMethod = magicType.GetMethod("ItsMagic");
        object magicValue = magicMethod.Invoke(magicClassObject, new object[]{100});

        Console.WriteLine("MethodInfo.Invoke() Example\n");
        Console.WriteLine("MagicClass.ItsMagic() returned: {0}", magicValue);
    }
}
 
8. Java and AutoIT
Reference: 
https://code.google.com/p/autoitx4java/ 
http://www.joecolantonio.com/2014/07/02/selenium-autoit-how-to-automate-non-browser-based-functionality/
http://accessrichard.blogspot.in/2011/01/autoitx4java-java-autoit-bridge.html
 
9. Convert JSON Data Into Html Table Using Javascript JQuery
Reference: http://www.dotnetpickles.com/2014/04/json-to-html-table.html 
 

 

C# Help Links - Nunit

    C# Nunit Help Links

1. NUnit Test Application  download(based on NUnit console runner)
Reference: https://visualstudiogallery.msdn.microsoft.com/b8a7a8fa-9f5a-4b9b-8e8b-8839a4364f26

2. Install or set up Nunit framework in Visual Studio
Reference: https://www.youtube.com/watch?v=IdqUFuQDD34

3. Install or set up Selenium WebDriver with C# sharp and Nunit in Visual Studio
Reference: https://www.youtube.com/watch?v=QAHlp3DJh0M

4. Debugging NUnit Tests in Visual Studio 2010
Reference: http://codebrane.com/blog/2012/06/19/debugging-nunit-tests-in-visual-studio-2010/

5. Test Automation using C#, Selenium WebDriver and NUnit
Reference: https://anoopjshetty.wordpress.com/2012/02/08/creating-test-automation-framework-using-c-selenium-and-nunit/

6. How do I create and run NUnit/WebDriver test-suites.
References:
http://stackoverflow.com/questions/20285961/how-do-i-create-and-run-nunit-webdriver-test-suites-via-visual-studio
http://nunit.sourceforge.net/doc/cookbook/cookbook.html
http://www.autotestguy.com/archives/2006/05/nunit_quick_and.html
http://www.nunit.org/index.php?p=suite&r=2.6.3

7. Running NUnit tests programmatically
References:
https://fijiaaron.wordpress.com/2011/11/22/running-nunit-tests-programmatically/
https://gist.github.com/fijiaaron/1387474

8. Nunit Suite builder
Reference:
https://www.simple-talk.com/dotnet/.net-tools/testing-times-ahead-extending-nunit/

9. Run a test suite with NUnit GUI
Reference:
http://nbi.codeplex.com/wikipage?title=Run%20a%20test%20suite%20with%20NUnit%20GUI

10.Setup Jenkins on Windows and integrating it with NAnt.
Reference:
https://anoopjshetty.wordpress.com/2014/07/09/setup-jenkins-on-windows-and-integrating-it-with-nant/ 

11. NAnt Home Page.
Reference:

12. Xamarin Studio
Reference:
http://www.monodevelop.com/download/

Wednesday, 11 February 2015

C# - 'Hello World' Console Application program.

Click link for Visual C# installation procedure 

Launch Visual C# IDE.


Select 'New Project'.

Select 'Console Application' and click on 'OK' button.



Type 'Cons' and click keyboard 'Contrl' + 'Space' (Cntrl+Space) to see the available classes.


Program:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    public class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World");
            Console.ReadLine();
        }
    }
}

Executing the Program:

Output is displayed in console after executing the program.

Additional Information:
ConsoleApplication1.exe is generated.


Double click on 'ConsoleApplication1.exe' to execute exe file.
 
Executing .exe file doesn't require Visual C# IDE to be launched.

Microsoft Visual C# 2010 Express edition installation

Download Visual C# 2010 Express edition from below url
http://www.visualstudio.com/en-us/downloads#d-2010-express

Click "Visual C# 2010 Express".

Select the <<language>> and click on 'install now' link.

Download your selection(i.e. Visual C# 2010 Express)

Click on 'Save File' to download the vcs_web.exe installation file.

Installation file(i.e. vcs_web.exe) is downloaded into downloads folder.

Click on 'vcs_web.exe' to install Visual C# 2010 Express

Click on 'Next' button.

Accept the license terms and click on 'Next' button.

Click on 'Next' button.

Click on 'Install >' button.


Click on 'Exit' button.

Click on 'Restart Now' to restart the system.

After system restarts, open the Visual C# 2010 Express
Below screenshot show opening 'Visual C#' in 'Window 8 Operating System'.

Microsoft Visual C# 2010 Express is launching.

Thursday, 5 February 2015

Selenium-VBA

Using Selenium-VBA automation developer can develop the selenium script using VBA code in Excel.
Once the user actions are recorded with Selenium-IDE, they can be converted(i.e. formated) in to a VBA script and placed in the Excel and executed.

Below are the steps to be performed.
i.  Installing 'SeleniumWrapperSetup-<<version>>.exe'.
ii. Installing the Selenium-VBA addon in Selenium IDE.
iii. Selecting 'SeleniumWrapper Type Library' reference.
iv. Recording the user interactions in Selenium IDE.
v. Converting the recorded user interactions in to Selenium-VBA script.
vi. Writing the Selenium-VBA code in Excel.
vii. Executing the Selenium-VBA script.

Prerequisites:
1. Microsoft office is installed on Windows OS.
2. Firefox browser is installed.
3. Selenium-IDE is installed in Firefox browser.
4. Chrome browser is installed, if the scripts need to be executed on chrome browser.

1. Open the "Microsoft Office Excel Worksheet".

2. Create the Macro.







 3. Open References.


4. Verify 'SeleniumWrapper Type Library' is displayed in references.

5. if  'SeleniumWrapper Type Library' is not displayed in references, then search for 'Selenium vba wrapper download'.


6. Download the 'SeleniumWrapperSetup-<<version>>.exe' file.


7. Install the 'SeleniumWrapperSetup'.
Click 'Run' button.
 Click 'Next' button.
 Accept the agreement.
 Click 'Next' button.

Click 'Install' button.

 Don't uncheck the check box and click on 'Finish' button.
 Click 'Install Now' button to install Selenium-VBA addon in Selenium IDE.
Click 'Restart' button.
Verify Selenium-VBA is installed in Firefox browser extensions.

8. Perform create/open macro in excel.
Now verify 'SeleniumWrapper Type Library' is displayed is displayed in  "Tools" --> "References" in Excel.


9. Record the user interactions using Selenium IDE.
Open Selenium IDE
 


perform some actions, user actions are recorded in selenium ide.

10. Convert the script to VBA.
Select 'Options' --> 'Format' --> 'VBA/Webdriver'.


11. Copy the Selenium VBA recorded script.

12. Paste the copied script in Sub.



13. Change the browser name to 'chrome'.

14. Execute the script.

Note: Before executing the script make sure 'SeleniumWrapper Type Library' is selected in "Tools" --> "References". 




References: 

Environment used for executing the above Selenium-VBA script:
OS: Windows 7
Browser: Chrome 39
Microsoft Office 2007
SeleniumWrapperSetup-1.0.17.exe