Thursday, June 27, 2019

Vstest.console.exe not discovering any of the tests


"No test is available in <path> Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again."


My initial plan was to show code coverage on sonar dashboard for a unit test project.

First, I get the .coverage file using below command

%CodeCoverage% collect /output:"C:/XXXXX/VisualStudio.coverage" "C:/Program Files (x86)/Microsoft Visual Studio/XXXXX/vstest.console.exe" "C:/Program Files (x86)/XXXX/XXX.dll"

Then convert it to
coveragexml.

So when I got the project I build it ,done a Nuget reset.
After that point, the test dll file to the vstest.console.exe and try to genarate the .coverage.
However, it says,
"No test is available in my test dll. Make sure that test discoverer & executors are registered and platform & framework version settings are appropriate and try again."
But when i open the solution and execute the project using test explorer at the VS it detect the tests and everything is working fine.

Initial project was developed by visual studio 2017 and at the QA environment we have visual studio 2015.(vstest.console.exe is also came with the VS 2015).

I tryed for several days to resolve this but no luck.
Then I start installing 2017 VS to the QA environment.

Then again do the same thing, Run the command by pointing the test dll and vstest.console.exe, which comes with visual studio 2017.

Bingo it works and it identify the unit tests inside the DLL file.

So the issue was with the wrong vstest.console.exe,




Wednesday, June 5, 2019

Test reporting for MSunit testing

  1. After you have finished your code about test, go build=>rebuild the solution. (no need to use test explorer)
  2. When rebuild succeeds, find the .dll file of your unit test project and copy the path of this file. (In my test, it’s UnitTestProject3.dll)
  3. Open the ‘developer command prompt for VS’. And then type “cd path” command to locate the file which contains the dll file. (The path is what you copy in step2)
  4. After that, type “vstest.console.exe UnitTestProject3.dll /logger:trx”. Then you can see the test result in the window, also you can find the sentence like this “Results file: …path\name.trx”
  5. That is the test result file you want, and you can convert it from xml to HTML by using third-party tools such like trxer. You can type “TrxerConsole.exe TestResultFileName.trx” in cmd to convert it to HTML using trxer.

Tuesday, April 9, 2019

[Solved] Start pointer [line=185, lineOffset=32] should be before end pointer - Exception of sonar

I was using jenkins version - 2.168 and Sonar version - 6.4 with c# plugin sonar-csharp-plugin-5.6.0.577.
When i try to analyze a c# project I got this error and the sonar analisis get failed.

I tried with ;

  1. Changing the sonar c# plugin. (Started from 5.XXX ro 6.XXX).
  2. Disabling some of the rules.(At one point I disable all the rules). But no luck.

So I exclude some of the folders of the project and it works.

So the actual issue is with a one .cs file so I was able to isolate that file and permanently exclude that file form the sonar analysis workspace. 

Tuesday, February 12, 2019

How to fix : Error: Cannot find module 'typescript' - Sonar

Possible solutions:

https://nodejs.org/en/download/ install Node JS.

1st :
Go to the jenkins workspace and type "npm install  typescript"
Then try to run the sonar process.

If still you get the error.
try
Go to the jenkins workspace and type "npm install -g  typescript"

Friday, December 7, 2018

Selenium from a different perspective - Google News reading bot


  1. From the below code user will navigate to the news.google.com.
  2. Extract everything under span tag.
  3. Save the extracted text to a string array.
  4. Data cleansing on the array.
  5. Transfer the array text to speech engine. 



public static void Main(string[] args)
        {

            IWebDriver driver;
            driver = new ChromeDriver(@"C:\Driver\2.41.0\");
            driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(30);
            driver.Navigate().GoToUrl("https://news.google.com");

            IList<IWebElement> elm = driver.FindElements(By.TagName("span"));

            string[] a = new string[2000];
            int i = 0;
            foreach (var item in elm)
            {
                a[i++] = item.Text.ToString();
            }
            a = a.Where(x => !string.IsNullOrEmpty(x)).ToArray();

            int j = 0;
            foreach (var item in a)
            {
                if (a[j].Length < 30)
                {
                    a[j] = "";
                }
                j++;
            }
            a = a.Where(x => !string.IsNullOrEmpty(x)).ToArray();

            SpeechSynthesizer synthesizer = new SpeechSynthesizer();
            synthesizer.SelectVoiceByHints(VoiceGender.Female, VoiceAge.Senior);
            synthesizer.Volume = 100;
            synthesizer.Rate = -1;
            int k = 1;
            foreach (var item in a)
            {
                synthesizer.Speak(a[k]);
                k++;
            }
        }

Wednesday, October 24, 2018

Troubleshooting sonar server error -SQL Database collation must be case-sensitive and accent-sensitive

I got this error while trying to configure a sonar server.
sonarqube-7.3

I when true the log files and this is what i found at the end of the web.log file.

2018.10.25 09:23:32 INFO  web[][o.s.p.ProcessEntryPoint] Starting web
2018.10.25 09:23:33 INFO  web[][o.a.t.u.n.NioSelectorPool] Using a shared selector for servlet write/read
2018.10.25 09:23:36 INFO  web[][o.s.c.e.CoreExtensionsLoader] Loaded core extensions: 
2018.10.25 09:23:38 INFO  web[][o.e.p.PluginsService] no modules loaded
2018.10.25 09:23:38 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.join.ParentJoinPlugin]
2018.10.25 09:23:38 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.percolator.PercolatorPlugin]
2018.10.25 09:23:38 INFO  web[][o.e.p.PluginsService] loaded plugin [org.elasticsearch.transport.Netty4Plugin]
2018.10.25 09:23:41 INFO  web[][o.s.s.e.EsClientProvider] Connected to local Elasticsearch: [127.0.0.1:9001]
2018.10.25 09:23:41 INFO  web[][o.s.s.p.LogServerVersion] SonarQube Server / 7.3.0.15553 / 7f72262e02808e9431d97735ece621a22a1d8208
2018.10.25 09:23:41 INFO  web[][o.sonar.db.Database] Create JDBC data source for jdbc:sqlserver://localhost;databaseName=SONAR;selectMethod=cursor;Connect Timeout=200; pooling='true'; Max Pool Size=200
2018.10.25 09:23:46 INFO  web[][o.s.s.p.ServerFileSystemImpl] SonarQube home: C:\sonarqube-7.3\sonarqube-7.3
2018.10.25 09:23:46 INFO  web[][o.s.s.u.SystemPasscodeImpl] System authentication by passcode is disabled
2018.10.25 09:23:48 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Git / 1.4.1.1128 / e051f5aeb379541b13956447b5dc8b4e0b23b098
2018.10.25 09:23:48 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin LDAP / 2.2.0.608 / 79dc3fa4393a29667673c70182f3016288b548b7
2018.10.25 09:23:48 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarC# / 7.3.2.6129 / e7a731061a7fa928c4e1c11b830f22db97a61f83
2018.10.25 09:23:48 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarCSS / 1.0.1.508 / 2eb799e363666ae65036ad61a6e6adc1a1283097
2018.10.25 09:23:48 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarFlex / 2.4.0.1222 / 68d9cb3b7daccbc4869c4f2b89d09218d26a0829
2018.10.25 09:23:48 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarGo / 1.1.0.1612 / 1809c7be6d88396c0a1b8d597b1e9e0ed8d29730
2018.10.25 09:23:48 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarJS / 4.2.0.6476 / a21b56462f3375b5d51d90f1819862878476d817
2018.10.25 09:23:48 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarJava / 5.6.1.15064 / dd4545a04af6f7d0cb0486926cfa8cfc5cae5ee1
2018.10.25 09:23:48 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarKotlin / 1.0.1.965 / b5872affdfeda52e0a71494e2df9a3524b80d3bc
2018.10.25 09:23:48 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarPHP / 2.14.0.3569 / 59a202b8d1c5276ce32da2a0bc63c94cae4cdeb2
2018.10.25 09:23:48 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarPython / 1.10.0.2131 / a00e0ddc83bbeb01a9ee7475fab9eafe3f4096ac
2018.10.25 09:23:48 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarTS / 1.7.0.2893 / 0d296cae94240b183a0b3ae6e1a409a60fe9f865
2018.10.25 09:23:48 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin SonarXML / 1.5.1.1452 / eadc1dcd0e24a3c77068e3c1d41af0327d6b16ea
2018.10.25 09:23:48 INFO  web[][o.s.s.p.ServerPluginRepository] Deploy plugin Svn / 1.8.0.1168 / 4143f2d119022a758f6bf40aed4294e4c31706cf
2018.10.25 09:23:49 INFO  web[][o.s.s.p.d.m.c.MssqlCharsetHandler] Verify that database collation is case-sensitive and accent-sensitive

2018.10.25 09:23:49 ERROR web[][o.s.s.p.Platform] Web server startup failed: Database collation must be case-sensitive and accent-sensitive. It is SQL_Latin1_General_CP1_CI_AS but should be SQL_Latin1_General_CP1_CS_AS.


At the end you might notice that its saying It is SQL_Latin1_General_CP1_CI_AS but should be SQL_Latin1_General_CP1_CS_AS.
So this means we need to change the collection type of our MS SQL database.
To do that go to properties of your data base and select options.
Then change the collection type to SQL_Latin1_General_CP1_CS_AS.


Tuesday, October 2, 2018

Increase the response time out on SoapUI for a individual test case

testRunner.testCase.settings.setString("HttpSettings@socket_timeout","200000")

Just at above line to the setup script section of your test case.