Thursday 13 December 2018

Fetching more than 100 Rows from JIRA in PowerBI

Fetching more than 100 Rows from JIRA in PowerBI

When you integrate JIRA and Power BI, you can use the JIRA content pack to configure the JIRA URL and authentication details. Please find the JIRA Content Pack attached with this page. Once you configured the JIRA content pack, its only able to retrieve first 100 issues / stories from JIRA. To fetch all records, you need to open the Power BI desktop . There go to Edit Queries which will be opened in a new Window. Then click on Advanced Editor and change this line value from 500 to 100. Thats it.

let
    Source = FetchPages("", 100),

Thursday 5 July 2018

How to create a web Plugin to change TLS settings in VSTS Load Testing

Web performance tests plug-ins enable you to isolate and reuse code outside the main declarative statements in your Web performance test. A customized Web performance test plug-in offers you a way to call some code as the Web performance test is run. The Web performance test plug-in is run one time for every test iteration. In addition, if you override the PreRequest or PostRequest methods in the test plug-in, those request plug-ins will run before or after each request, respectively.
You can create a customized Web performance test plug-in by deriving your own class from the WebTestPlugin base class.
You can use customized Web performance test plug-ins with the Web performance tests you have recorded, which enables you to write a minimal amount of code to obtain a greater level of control over your Web performance tests. However, you can also use them with coded Web performance tests. For more information, see How to: Create a Coded Web Performance Test.
System_CAPS_ICON_note.jpg Note
You can also create load test plug-ins. See How to: Create a Load Test Plug-In.
Requirements
  • Visual Studio Enterprise

To create a custom Web performance test plug-in

  1. Open a Web performance and load test project that contains a Web performance test.
    For more information about how to create a Web performance and load test project, see How to: Create and Configure Test Projects for Automated Tests.
  2. In Solution Explorer, right-click on the solution and select Add and then choose New Project.
    The Add New Project dialog box is displayed.
  3. Under Installed Templates, select Visual C#.
  4. In the list of templates, select Class Library.
  5. In the Name text box, type a name for your class.
  6. Choose OK.
  7. The new class library project is added to Solution Explorer and the new class appears in the Code Editor.
  8. In Solution Explorer, right-click the References folder in the new class library and select Add Reference.
  9. The Add Reference dialog box is displayed.
  10. Choose the .NET tab, scroll down, and select Microsoft.VisualStudio.QualityTools.WebTestFramework
  11. Choose OK.
    The reference to Microsoft.VisualStudio.QualityTools.WebTestFramework is added to the Reference folder in Solution Explorer.
  12. In Solution Explorer, right-click on the top node of the Web performance and load test project that contains the load test to which you want to add the Web performance test plug-in and select Add Reference.
  13. The Add Reference dialog box is displayed.
  14. Choose the Projects tab and select the Class Library Project.
  15. Choose OK.
  16. In the Code Editor, write the code of your plug-in. First, create a new public class that derives from WebTestPlugin.
  17. Implement code inside one or more of the event handlers. See the following Example section for a sample implementation.
  18. After you have written the code, build the new project.
  19. Open a Web performance test.
  20. To add the Web performance test plug-in, choose Add Web Test Plug-in on the toolbar.
    The Add Web Test Plug-in dialog box is displayed.
  21. Under Select a plug-in, select your Web performance test plug-in class.
  22. In the Properties for selected plug-in pane, set the initial values for the plug-in to use at run time.
    System_CAPS_ICON_note.jpg Note
    You can expose as many properties as you want from your plug-ins; just make them public, settable, and of a base type such as Integer, Boolean, or String. You can also change the Web performance test plug-in properties later by using the Properties window.
  23. Choose OK.
    The plug-in is added to the Web Test Plug-ins folder.

    code for changing the TLS Settings:

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Microsoft.VisualStudio.TestTools.WebTesting.Rules;
    using Microsoft.VisualStudio.TestTools.WebTesting;
    using System.ComponentModel;
    using System.Net;
    using System.Net.Security;
    using System.Security.Cryptography.X509Certificates;

    namespace ChgSSL
    {

        public class Tls12ForcedPlugin : WebTestPlugin
        {
            [Description("Enable or Disable the plugin functionality")]
            [DefaultValue(true)]
            public bool Enabled { get; set; }

            public override void PreWebTest(object sender, PreWebTestEventArgs e)
            {
                base.PreWebTest(sender, e);

                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

                ServicePointManager.ServerCertificateValidationCallback = RemoteCertificateValidationCB;


                e.WebTest.AddCommentToResult(this.ToString() + " has made the following modification-> ServicePointManager.SecurityProtocol set to use Tlsv12 in WebTest Plugin.");
            }
            public static bool RemoteCertificateValidationCB(Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
            {
                //If it is really important, validate the certificate issuer here.
                //this will accept any certificate
                return true;
            }
        }
    }

Tuesday 29 May 2018

Downloading File /Files to a remote machine using Powershell

During a desktop application performance testing scenario, I came up with a challenge to move three dll files to 300+ AWS workspaces. I calculated even if I took 5 mins per one workspace, it would cost be 1500 Mins that is 25Hrs. So atleast I need three people do this task in a day or I have to do this in three days or less. So thought of using Powershell to do this job. I wrote my script with the help of google and unable to run it due to some exception.

Here is the script:
param([switch]$Elevated)

function Test-Admin {
  $currentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())
  $currentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)
}

if ((Test-Admin) -eq $false)  {
    if ($elevated)
    {
        # tried to elevate, did not work, aborting
    }
    else {
        Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "{0}" -elevated' -f ($myinvocation.MyCommand.Definition))
}

exit
}
$Files =Import-Csv D:\Test.csv
import-Module bitstransfer
ForEach($File in $Files)
 {
        $ip=$File.ip
        Write-Output $ip
        $Uname =$File.Uname
        Write-Output $Uname
        $Pwd = $File.Pwd
        $Source ="D:\DLL Files\*.dll"
        $Dest = "\\$($ip)\c$\Program Files (x86)\NetSuite\NetSuite Point of Sale\"
        Write-Output $Dest
        $secpasswd = ConvertTo-SecureString "shoN$p0s" -AsPlainText -Force
        $cred = New-Object System.Management.Automation.PSCredential ($Uname, $secpasswd)
        Write-Output $cred
        $Session = New-PSSession -ComputerName $ip -Credential $cred
        $File = [System.IO.File]::ReadAllBytes("D:\DLL_Files\oAuthRestletCall.dll");
        $File1 = [System.IO.File]::ReadAllBytes("D:\DLL_Files\HtmlAgilityPack.dll");
        $File2 = [System.IO.File]::ReadAllBytes("D:\DLL_Files\MPK_Calendar.dll");
        Invoke-Command -Session $session -ArgumentList $file -ScriptBlock{[System.IO.File]::WriteAllBytes("C:\Program Files (x86)\NetSuite\NetSuite Point of Sale\oAuthRestletCall.dll", $args)};
        Invoke-Command -Session $session -ArgumentList $file1 -ScriptBlock{[System.IO.File]::WriteAllBytes("C:\Program Files (x86)\NetSuite\NetSuite Point of Sale\HtmlAgilityPack.dll", $args)};
        Invoke-Command -Session $session -ArgumentList $file2 -ScriptBlock{[System.IO.File]::WriteAllBytes("C:\Program Files (x86)\NetSuite\NetSuite Point of Sale\MPK_Calendar.dll", $args)};
        #Copy-Item $Source $Dest -Recurse -Force
        #Start-BitsTransfer -Source $Source -Destination $Dest -Credential $cred
        Write_Output "done"
        Remove-PSSession $Session
        }     

Then I took the approach of doing this task with SIKULI + Powershell IDE and succeeded. I spent an hour by StackOverflow and other sites and here is the code :

PS C:\Windows\system32\WindowsPowerShell\v1.0>
[10.9.8.238]: PS D:\Users\PerfReg1172\Documents> $url = "http://10.9.11.192/Logs/NTWSLogs/HtmlAgilityPack.dll";
$output = "c:\Program Files (x86)\NetSuite\NetSuite Point of Sale\HtmlAgilityPack.dll";
Invoke-WebRequest -Uri $url -OutFile $output;
$url = "http://10.9.11.192/Logs/NTWSLogs/MPK_Calendar.dll";
$output = "c:\Program Files (x86)\NetSuite\NetSuite Point of Sale\MPK_Calendar.dll";
Invoke-WebRequest -Uri $url -OutFile $output;
$url = "http://10.9.11.192/Logs/NTWSLogs/oAuthRestletCall.dll";
$output = "c:\Program Files (x86)\NetSuite\NetSuite Point of Sale\oAuthRestletCall.dll";
Invoke-WebRequest -Uri $url -OutFile $output;

I already have an IIS running and copied the files to a directory.I declared this variables to store the file contents in  a variable and writing them as a file in the remote machine.SIKULI will open a new remote Power Shell session in Powershell IDE, then it will paste the above lines and execute them. I made a loop with all 300 machine ip's and passwords to achieve this.

Thank you SIKULI + POWERSHELL.

I did it by 9 Hrs where sikuli ran unattended.  I wasted nerely 5 hours in the task1 .

Attaching a SQL Server Database to DB server through T-SQL

While working to develop a SIKULI script to run on multiple machines, i came to a situation  to attach a database in every machine. As sikuli is not much flexible, i choose to attach the db via T-SQL .

I opened the SQL server  management studio in the remote machine and logged into that with SIKULI script. so finally find the below code to be run on a new query window.

CREATE DATABASE RAPOS_Replication  
    ON (FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\RAPOS_Replication.mdf'),  
    (FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\RAPOS_Replication_Log.ldf')  
    FOR ATTACH;

With sikuli, its some thing like below:

        type('CREATE DATABASE RAPOS_Replication')
        type(' ON (FILENAME = \'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\RAPOS_Replication.mdf\'),')
        type(' (FILENAME = \'C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\RAPOS_Replication_Log.ldf\')')
        type('FOR ATTACH;'+Key.ENTER+Key.F5)
        wait(3)

Thursday 29 March 2018

Special Train between Tambaram & Quilon



 தாம்பரம் - கொல்லம் - தாம்பரம் இடையே சிறப்பு ரயில். செங்கல்பட்டு, விழுப்புரம், திருச்சி, திண்டுக்கல், மதுரை, சிவகாசி, செங்கோட்டை வழியாக இயக்கம். 30ம் தேதி முதல் தாம்பரத்தில் இருந்து, 31ம் தேதி முதல் கொல்லத்தில் இருந்தும் சிறப்பு ரயில் சேவை.



Shrinking the size of Oracle Virtual Box

First, zero fill your virtual disk. Boot the VM and run: sudo dd if=/dev/zero of=/bigemptyfile bs=4096k status=progress sudo rm -f /bigempty...