Archive for the 'software' Category

Counting lines of source code with PowerShell

How do you count the lines of code your application has? As far as I know Visual Studio does not provide this functionality, so needless to say, we are doing that with PowerShell 😉

$num = 0
dir c:\root\ -include *.cs -Recurse | ForEach-Object { 
	$file=[array](Get-Content $_ ) 
	$num += $file.length 
}
$num

You obviously need to change c:\root to your root folder path, and change the *.cs mask to the one applicable to your source code.

Tags: , ,

Automated Software Testing with PowerShell and PowerGUI

PowerShell is great for automated software testing. We all know that and some of us even have some experience doing that. However, wouldn’t it be great to have a UI console to manage and run the individual test scripts?

Now you have one!

UI Console for Automated Software Testing based on PowerShell

This PowerGUI-based console allows you to:

  1. Run selected/all/based on criteria test scripts.
  2. See results, last run time, modification time, error messages.
  3. Filter and sort by any of the aforementioned properties.
  4. Add new test scripts.
  5. Edit test scripts.
  6. Copy test scripts to serve as models for new scripts.
  7. Delete scripts.
  8. Produce reports.
  9. Schedule tests for regular automated runs.

You can watch the automated software testing demo and download (absolutely free) the testing console at PowerGUI.org.

Enjoy and let me know if you have any feedback/feature requests!

Dmitry

Tags: , , , , , , , , , ,

PowerShell session at St. Petersburg .NET Usergroup – July 6th

Next Friday, July 6th 2007 I will be presenting at St. Petersburg (Russia) .NET Usergroup.

The usergroup will start at 6 pm local time and will go till approximately 9. We will start with Gaidar Magdanurov demoing some of his WCF work, and then I will do a PowerShell for developers session, sharing our experience and evangelizing PowerShell as the best command-line you can implement for your applications.

If you happen to be in St. Petersburg, Russia please register and drop by:

http://sp.ineta.ru/Events/EventInfo.aspx?ID=2b472d76-b54f-41dd-b753-4a793eba19ff

Tags: , , , , , ,

Autotesting with PowerShell

We have started working on automating PowerGUI testing.

While this will not bring immediate benefit such as new features, etc. this should make our releases starting with 1.0.6 and beyond much more stable and bug-free. With our current schedule of new releases every 2-3 weeks manual testing simply cannot provide for high quality and allow many changes between releases.

We had a few options on the software to use to automate tests and decided to go with… PowerShell scripts!

Here’s what we’ve done:

1. Created a dll proving a wrapper which gives us things like global variables, STA threading model (we need this for the web browser control on the welcome page), initialization in a separate thread (so we have both PowerGUI and scripts running in separate threads), etc.

2. Created a PowerShell autotest script which basically runs all tests one by one and catches and reports error messages.

3. For each individual tests we create separate ps1 files doing just one of the tests. For example, this script “clicks” all nodes in PowerGUI left-hand tree without waiting them to complete.

P.S. This last test by the way already caught us a bug in 1.0.5 caused by our changes to asynchronous behavior. This fast click-through sometimes results in an error message being displayed. This is not fatal and the workaround is to simply click Refresh but nevertheless this is an issue which we now have covered in our tests and which will for sure go away forever in our next releases.

You can read more about Lightweight Testing with Windows PowerShell in May edition of MSDN Magazine.

Tags: , , , , , , ,


My Recent Tweets

Legal

The posts on this blog are provided “as is” with no warranties and confer no rights. The opinions expressed on this site are mine and mine alone, and do not necessarily represent those of my employer - WSO2 or anyone else for that matter. All trademarks acknowledged.

© 2007-2014 Dmitry Sotnikov

August 2021
M T W T F S S
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

%d bloggers like this: