SlideShare una empresa de Scribd logo
1 de 10
Descargar para leer sin conexión
Introduction          1

Features              4

Real World Examples   5

For Testers           8

Message for Testers   10




                           1
Introduction (As commented by the author in PowerShell Pro…)

       PowerShell is a new command shell from Microsoft and yes it is a command prompt and
       scripting environment, it can even be both at the same time.

       For a systems administrator, the benefits in learning PowerShell are mainly pertaining to Active
       Directory domains are becoming larger and more complex. For those administrators that are still
       chained to GUI tools and the Microsoft Management Console, PowerShell will set you free!!!




       Additional Features to MS-DOS Command:

   •   Variables, Constants, Arrays, and Hash Tables.
   •   Using Conditional Logic.
   •   Processing data with Loops.
   •   Modular Scripting Using Functions.
   •   Scripting using WMI Objects (Computers, Printers, Etc…).
   •   Scripting using ADSI Objects (Active Directory Management



Concepts:

Object Based Not Command Based – Output can be piped into another input

Commands are customizable – Create own commands, based on aliases

Command Based and Scripting Environment – MS DOS – command and VB Script – runs
Windows Server Host for executing scripts and not MS DOS runs the command. Same applies
for Windows Batch File




                                                                                                     2
3
CAFFEINATED ODOR WEBSITE


Features :
Guessing: In powershell, the verb-noun pattern is strictly enforced and the names are
always consistent so that I can write Get-Command *service and be assured that I will
get all the cmdLets related to services and then figure out what they do through the verb
part of their name.

Built-In Help -If you're not sure what a cmdLet does, then use the Get-Help cmdLet to see
the documentation

Trusting Operations -Are you afraid to execute a script because you're not sure what it will
do? Try the -whatif parameter that is ubiquitous to all commands. For example, del
C:f*.txt -whatif will just tell you which files would have been deleted rather th

an actually deleting them.

Get-Member- add| Get-member to the end of the command and I can see what additional
methods I have to work with or what properties I can perform filtering and assorting on




                                                                                          4
5
6
A simple script for beginners




                                7
Powershell for Testers:
A dedicated website of use of PowerShell for Testing: http://testfirst.spaces.live.com/blog/

Project CodePlex by the blogger of previous site; Adam Geras :
http://www.codeplex.com/psexpect



Project Description

A PowerShell library for automating tests. You can use this library to test your scripts, but it is really designed to
test things external to PowerShell: your Active Directory configuration, your SharePoint installation, etc.

This project was initially released for PowerShell v1.0 and has       “I built this so that it would be easier to
since been revised so that it works for PowerShell v2.0 (CTP          employ PowerShell as a means of
and above) as well. I've not run the full suite of tests on all       automating tests.”
OS/version combinations though, so please log an issue if
you find something wonky.

I built this so that it would be easier to employ PowerShell as a means of automating tests. I believe the
language has features that fundamentally make it a wise choice for automating tests, in particular, when the
targets of the tests happens to publish cmdlets. So while you can use it to test your scripts, it really is intended
to provide you with the means of writing tests to support the work that you are already doing, whether that is
writing scripts, configuring commercial-off-the-shelf products, or developing an application.

Note: The decision not to use cmdlets at all in this solution was to avoid the need to install anything on the
machines running the target of the tests. This is also why relying on an existing .NET test framework (such as
NUnit) wasn't considered the optimal solution.

Regards,                                                                             Scripts of .net
A.                                                                                   modules works with
                                                                                     powershell




                                                                                                                       8
10 quick reasons to come up for testing with PowerShell by James Brundage – MSDN
PowerShell Team – Microsoft Functional Tester (MSFT) (Source: PowerShell Blog)

   1. Being able to run command line programs easier within PowerShell
   2. Dynamically generating code or test data for a test case (fuzzing or data-driven testing get
       a lot easier with this)
   3. Being able to access COM easier within PowerShell
   4. Being able to embed PowerShell in C# (so you can avoid writing a framework and just
       embed PowerShell in your infrastructure)
   5. Being able to use weakly typed variables within PowerShell
   6. Being able to test APIs on the command line, so you test manually and then automate
   7. Getting a history of commands, to take what you've explored and turn it into a test case
   8. Being able to strongly cast or coerce types when needed
   9. Support for verbose, warning, and debug streams to provide additional test information
   10. Being able to use PowerShell's systems administration features to help setup or cleanup a
       test environment                               is a software verification and validation
                                                       method in which a programmer tests if
      Use of PowerShell in Unit Testing
                                                       individual units of source code are fit for
                                                       use – In Wiki’s terms




                                                                                                 9
10

Más contenido relacionado

La actualidad más candente

Automated php unit testing in drupal 8
Automated php unit testing in drupal 8Automated php unit testing in drupal 8
Automated php unit testing in drupal 8Jay Friendly
 
Selenium Tutorial
Selenium TutorialSelenium Tutorial
Selenium Tutorialprad_123
 
#ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab"
#ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab"#ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab"
#ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab"Agile Testing Alliance
 
Mastering selenium for automated acceptance tests
Mastering selenium for automated acceptance testsMastering selenium for automated acceptance tests
Mastering selenium for automated acceptance testsNick Belhomme
 
Php unit for drupal 8
Php unit for drupal 8Php unit for drupal 8
Php unit for drupal 8valuebound
 
Automated Web Testing With Selenium
Automated Web Testing With SeleniumAutomated Web Testing With Selenium
Automated Web Testing With SeleniumJodie Miners
 
Selenium – testing tool jack
Selenium – testing tool jackSelenium – testing tool jack
Selenium – testing tool jackJackseen Jeyaluck
 
Selenium Test Automation - Challenges
Selenium Test Automation - ChallengesSelenium Test Automation - Challenges
Selenium Test Automation - ChallengesArul Selvan
 
Java Development EcoSystem
Java Development EcoSystemJava Development EcoSystem
Java Development EcoSystemAlex Tumanoff
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using seleniumshreyas JC
 
Selenium notes
Selenium notesSelenium notes
Selenium noteswholcomb
 
Trying to Sell PVS-Studio to Google, or New Bugs in Chromium
Trying to Sell PVS-Studio to Google, or New Bugs in ChromiumTrying to Sell PVS-Studio to Google, or New Bugs in Chromium
Trying to Sell PVS-Studio to Google, or New Bugs in ChromiumAndrey Karpov
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaAgile Testing Alliance
 
Jenkins & Selenium
Jenkins & SeleniumJenkins & Selenium
Jenkins & Seleniumadamcarmi
 
Lecture android best practices
Lecture   android best practicesLecture   android best practices
Lecture android best practiceseleksdev
 

La actualidad más candente (20)

Automated php unit testing in drupal 8
Automated php unit testing in drupal 8Automated php unit testing in drupal 8
Automated php unit testing in drupal 8
 
Selenium Tutorial
Selenium TutorialSelenium Tutorial
Selenium Tutorial
 
#ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab"
#ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab"#ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab"
#ATAGTR2021 Presentation - "Selenium 4 Observability – a 90 Min Hands on Lab"
 
Mastering selenium for automated acceptance tests
Mastering selenium for automated acceptance testsMastering selenium for automated acceptance tests
Mastering selenium for automated acceptance tests
 
Selenium
SeleniumSelenium
Selenium
 
Selenium
SeleniumSelenium
Selenium
 
Php unit for drupal 8
Php unit for drupal 8Php unit for drupal 8
Php unit for drupal 8
 
Automated Web Testing With Selenium
Automated Web Testing With SeleniumAutomated Web Testing With Selenium
Automated Web Testing With Selenium
 
Selenium – testing tool jack
Selenium – testing tool jackSelenium – testing tool jack
Selenium – testing tool jack
 
Selenium ppt
Selenium pptSelenium ppt
Selenium ppt
 
Selenium Test Automation - Challenges
Selenium Test Automation - ChallengesSelenium Test Automation - Challenges
Selenium Test Automation - Challenges
 
Java Development EcoSystem
Java Development EcoSystemJava Development EcoSystem
Java Development EcoSystem
 
Selenium
SeleniumSelenium
Selenium
 
Test automation using selenium
Test automation using seleniumTest automation using selenium
Test automation using selenium
 
Selenium Introduction
Selenium IntroductionSelenium Introduction
Selenium Introduction
 
Selenium notes
Selenium notesSelenium notes
Selenium notes
 
Trying to Sell PVS-Studio to Google, or New Bugs in Chromium
Trying to Sell PVS-Studio to Google, or New Bugs in ChromiumTrying to Sell PVS-Studio to Google, or New Bugs in Chromium
Trying to Sell PVS-Studio to Google, or New Bugs in Chromium
 
Session on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh GundechaSession on Selenium Powertools by Unmesh Gundecha
Session on Selenium Powertools by Unmesh Gundecha
 
Jenkins & Selenium
Jenkins & SeleniumJenkins & Selenium
Jenkins & Selenium
 
Lecture android best practices
Lecture   android best practicesLecture   android best practices
Lecture android best practices
 

Destacado

Обеспечение высокой доступности банковской ИТ-инфраструктуры
Обеспечение высокой доступности банковской ИТ-инфраструктурыОбеспечение высокой доступности банковской ИТ-инфраструктуры
Обеспечение высокой доступности банковской ИТ-инфраструктурыVsevolod Shabad
 
Landsverordening raad van advies
Landsverordening raad van adviesLandsverordening raad van advies
Landsverordening raad van adviespearl studio
 
All stars schedule 2011
All stars schedule  2011All stars schedule  2011
All stars schedule 2011pearl studio
 
Smsf nstcp program 2011
Smsf nstcp program 2011Smsf nstcp program 2011
Smsf nstcp program 2011pearl studio
 
System Z Cloud Atlanta
System Z Cloud AtlantaSystem Z Cloud Atlanta
System Z Cloud AtlantaAndrea McManus
 
Обеспечение высокой доступности производственной ИТ-инфраструктуры
Обеспечение высокой доступности производственной ИТ-инфраструктурыОбеспечение высокой доступности производственной ИТ-инфраструктуры
Обеспечение высокой доступности производственной ИТ-инфраструктурыVsevolod Shabad
 
United nations development programme
United nations development programme United nations development programme
United nations development programme pearl studio
 
Организация хранения данных сейсморазведки и промысловой геофизики
Организация хранения данных сейсморазведки и промысловой геофизикиОрганизация хранения данных сейсморазведки и промысловой геофизики
Организация хранения данных сейсморазведки и промысловой геофизикиVsevolod Shabad
 

Destacado (9)

Обеспечение высокой доступности банковской ИТ-инфраструктуры
Обеспечение высокой доступности банковской ИТ-инфраструктурыОбеспечение высокой доступности банковской ИТ-инфраструктуры
Обеспечение высокой доступности банковской ИТ-инфраструктуры
 
Landsverordening raad van advies
Landsverordening raad van adviesLandsverordening raad van advies
Landsverordening raad van advies
 
All stars schedule 2011
All stars schedule  2011All stars schedule  2011
All stars schedule 2011
 
Agile Presentation
Agile PresentationAgile Presentation
Agile Presentation
 
Smsf nstcp program 2011
Smsf nstcp program 2011Smsf nstcp program 2011
Smsf nstcp program 2011
 
System Z Cloud Atlanta
System Z Cloud AtlantaSystem Z Cloud Atlanta
System Z Cloud Atlanta
 
Обеспечение высокой доступности производственной ИТ-инфраструктуры
Обеспечение высокой доступности производственной ИТ-инфраструктурыОбеспечение высокой доступности производственной ИТ-инфраструктуры
Обеспечение высокой доступности производственной ИТ-инфраструктуры
 
United nations development programme
United nations development programme United nations development programme
United nations development programme
 
Организация хранения данных сейсморазведки и промысловой геофизики
Организация хранения данных сейсморазведки и промысловой геофизикиОрганизация хранения данных сейсморазведки и промысловой геофизики
Организация хранения данных сейсморазведки и промысловой геофизики
 

Similar a PowerShell testing guide for beginners

Sql Server & PowerShell
Sql Server & PowerShellSql Server & PowerShell
Sql Server & PowerShellAaron Shilo
 
PowerShellForDBDevelopers
PowerShellForDBDevelopersPowerShellForDBDevelopers
PowerShellForDBDevelopersBryan Cafferky
 
Kirill Rozin - Practical Wars for Automatization
Kirill Rozin - Practical Wars for AutomatizationKirill Rozin - Practical Wars for Automatization
Kirill Rozin - Practical Wars for AutomatizationSergey Arkhipov
 
Learn Powershell Scripting Tutorial Full Course 1dollarcart.com.pdf
Learn Powershell Scripting Tutorial Full Course 1dollarcart.com.pdfLearn Powershell Scripting Tutorial Full Course 1dollarcart.com.pdf
Learn Powershell Scripting Tutorial Full Course 1dollarcart.com.pdfClapperboardCinemaPV
 
stackconf 2020 | Enterprise CI/CD Integration Testing Environments Done Right...
stackconf 2020 | Enterprise CI/CD Integration Testing Environments Done Right...stackconf 2020 | Enterprise CI/CD Integration Testing Environments Done Right...
stackconf 2020 | Enterprise CI/CD Integration Testing Environments Done Right...NETWAYS
 
Best Selenium Python Frameworks for Test automation.pdf
Best Selenium Python Frameworks for Test automation.pdfBest Selenium Python Frameworks for Test automation.pdf
Best Selenium Python Frameworks for Test automation.pdfpCloudy
 
What I Learned From Writing a Test Framework (And Why I May Never Write One A...
What I Learned From Writing a Test Framework (And Why I May Never Write One A...What I Learned From Writing a Test Framework (And Why I May Never Write One A...
What I Learned From Writing a Test Framework (And Why I May Never Write One A...Daryl Walleck
 
Automating Perl deployments with Hudson
Automating Perl deployments with HudsonAutomating Perl deployments with Hudson
Automating Perl deployments with Hudsonnachbaur
 
Automating Your Enterprise Application Deployments with PowerShell
Automating Your Enterprise Application Deployments with PowerShellAutomating Your Enterprise Application Deployments with PowerShell
Automating Your Enterprise Application Deployments with PowerShellGeoff Varosky
 
Muraliupdatedpersonal091215
Muraliupdatedpersonal091215Muraliupdatedpersonal091215
Muraliupdatedpersonal091215Murali Krishna R
 
Unit testing using Munit Part 1
Unit testing using Munit Part 1Unit testing using Munit Part 1
Unit testing using Munit Part 1Anand kalla
 
Automating Your Enterprise Application Deployments With PowerShell by Geoff V...
Automating Your Enterprise Application Deployments With PowerShell by Geoff V...Automating Your Enterprise Application Deployments With PowerShell by Geoff V...
Automating Your Enterprise Application Deployments With PowerShell by Geoff V...SPTechCon
 
PowerShell Zero To Hero Workshop!
PowerShell Zero To Hero Workshop!PowerShell Zero To Hero Workshop!
PowerShell Zero To Hero Workshop!Daisy Stevens
 
Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using RubyKumari Warsha Goel
 
24 Hours Of Exchange Server 2007 (Part 8 Of 24)
24 Hours Of Exchange Server 2007 (Part 8 Of 24)24 Hours Of Exchange Server 2007 (Part 8 Of 24)
24 Hours Of Exchange Server 2007 (Part 8 Of 24)Harold Wong
 
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Puneet Kala
 

Similar a PowerShell testing guide for beginners (20)

Sql Server & PowerShell
Sql Server & PowerShellSql Server & PowerShell
Sql Server & PowerShell
 
Codeception
CodeceptionCodeception
Codeception
 
PowerShellForDBDevelopers
PowerShellForDBDevelopersPowerShellForDBDevelopers
PowerShellForDBDevelopers
 
10071756.ppt
10071756.ppt10071756.ppt
10071756.ppt
 
Kirill Rozin - Practical Wars for Automatization
Kirill Rozin - Practical Wars for AutomatizationKirill Rozin - Practical Wars for Automatization
Kirill Rozin - Practical Wars for Automatization
 
Learn Powershell Scripting Tutorial Full Course 1dollarcart.com.pdf
Learn Powershell Scripting Tutorial Full Course 1dollarcart.com.pdfLearn Powershell Scripting Tutorial Full Course 1dollarcart.com.pdf
Learn Powershell Scripting Tutorial Full Course 1dollarcart.com.pdf
 
stackconf 2020 | Enterprise CI/CD Integration Testing Environments Done Right...
stackconf 2020 | Enterprise CI/CD Integration Testing Environments Done Right...stackconf 2020 | Enterprise CI/CD Integration Testing Environments Done Right...
stackconf 2020 | Enterprise CI/CD Integration Testing Environments Done Right...
 
Best Selenium Python Frameworks for Test automation.pdf
Best Selenium Python Frameworks for Test automation.pdfBest Selenium Python Frameworks for Test automation.pdf
Best Selenium Python Frameworks for Test automation.pdf
 
What I Learned From Writing a Test Framework (And Why I May Never Write One A...
What I Learned From Writing a Test Framework (And Why I May Never Write One A...What I Learned From Writing a Test Framework (And Why I May Never Write One A...
What I Learned From Writing a Test Framework (And Why I May Never Write One A...
 
Automating Perl deployments with Hudson
Automating Perl deployments with HudsonAutomating Perl deployments with Hudson
Automating Perl deployments with Hudson
 
Automating Your Enterprise Application Deployments with PowerShell
Automating Your Enterprise Application Deployments with PowerShellAutomating Your Enterprise Application Deployments with PowerShell
Automating Your Enterprise Application Deployments with PowerShell
 
Windows PowerShell
Windows PowerShellWindows PowerShell
Windows PowerShell
 
Muraliupdatedpersonal091215
Muraliupdatedpersonal091215Muraliupdatedpersonal091215
Muraliupdatedpersonal091215
 
Unit testing using Munit Part 1
Unit testing using Munit Part 1Unit testing using Munit Part 1
Unit testing using Munit Part 1
 
Automating Your Enterprise Application Deployments With PowerShell by Geoff V...
Automating Your Enterprise Application Deployments With PowerShell by Geoff V...Automating Your Enterprise Application Deployments With PowerShell by Geoff V...
Automating Your Enterprise Application Deployments With PowerShell by Geoff V...
 
PowerShell Zero To Hero Workshop!
PowerShell Zero To Hero Workshop!PowerShell Zero To Hero Workshop!
PowerShell Zero To Hero Workshop!
 
Selenium
SeleniumSelenium
Selenium
 
Selenium Automation Using Ruby
Selenium Automation Using RubySelenium Automation Using Ruby
Selenium Automation Using Ruby
 
24 Hours Of Exchange Server 2007 (Part 8 Of 24)
24 Hours Of Exchange Server 2007 (Part 8 Of 24)24 Hours Of Exchange Server 2007 (Part 8 Of 24)
24 Hours Of Exchange Server 2007 (Part 8 Of 24)
 
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
Selenium-Webdriver With PHPUnit Automation test for Joomla CMS!
 

PowerShell testing guide for beginners

  • 1. Introduction 1 Features 4 Real World Examples 5 For Testers 8 Message for Testers 10 1
  • 2. Introduction (As commented by the author in PowerShell Pro…) PowerShell is a new command shell from Microsoft and yes it is a command prompt and scripting environment, it can even be both at the same time. For a systems administrator, the benefits in learning PowerShell are mainly pertaining to Active Directory domains are becoming larger and more complex. For those administrators that are still chained to GUI tools and the Microsoft Management Console, PowerShell will set you free!!! Additional Features to MS-DOS Command: • Variables, Constants, Arrays, and Hash Tables. • Using Conditional Logic. • Processing data with Loops. • Modular Scripting Using Functions. • Scripting using WMI Objects (Computers, Printers, Etc…). • Scripting using ADSI Objects (Active Directory Management Concepts: Object Based Not Command Based – Output can be piped into another input Commands are customizable – Create own commands, based on aliases Command Based and Scripting Environment – MS DOS – command and VB Script – runs Windows Server Host for executing scripts and not MS DOS runs the command. Same applies for Windows Batch File 2
  • 3. 3
  • 4. CAFFEINATED ODOR WEBSITE Features : Guessing: In powershell, the verb-noun pattern is strictly enforced and the names are always consistent so that I can write Get-Command *service and be assured that I will get all the cmdLets related to services and then figure out what they do through the verb part of their name. Built-In Help -If you're not sure what a cmdLet does, then use the Get-Help cmdLet to see the documentation Trusting Operations -Are you afraid to execute a script because you're not sure what it will do? Try the -whatif parameter that is ubiquitous to all commands. For example, del C:f*.txt -whatif will just tell you which files would have been deleted rather th an actually deleting them. Get-Member- add| Get-member to the end of the command and I can see what additional methods I have to work with or what properties I can perform filtering and assorting on 4
  • 5. 5
  • 6. 6
  • 7. A simple script for beginners 7
  • 8. Powershell for Testers: A dedicated website of use of PowerShell for Testing: http://testfirst.spaces.live.com/blog/ Project CodePlex by the blogger of previous site; Adam Geras : http://www.codeplex.com/psexpect Project Description A PowerShell library for automating tests. You can use this library to test your scripts, but it is really designed to test things external to PowerShell: your Active Directory configuration, your SharePoint installation, etc. This project was initially released for PowerShell v1.0 and has “I built this so that it would be easier to since been revised so that it works for PowerShell v2.0 (CTP employ PowerShell as a means of and above) as well. I've not run the full suite of tests on all automating tests.” OS/version combinations though, so please log an issue if you find something wonky. I built this so that it would be easier to employ PowerShell as a means of automating tests. I believe the language has features that fundamentally make it a wise choice for automating tests, in particular, when the targets of the tests happens to publish cmdlets. So while you can use it to test your scripts, it really is intended to provide you with the means of writing tests to support the work that you are already doing, whether that is writing scripts, configuring commercial-off-the-shelf products, or developing an application. Note: The decision not to use cmdlets at all in this solution was to avoid the need to install anything on the machines running the target of the tests. This is also why relying on an existing .NET test framework (such as NUnit) wasn't considered the optimal solution. Regards, Scripts of .net A. modules works with powershell 8
  • 9. 10 quick reasons to come up for testing with PowerShell by James Brundage – MSDN PowerShell Team – Microsoft Functional Tester (MSFT) (Source: PowerShell Blog) 1. Being able to run command line programs easier within PowerShell 2. Dynamically generating code or test data for a test case (fuzzing or data-driven testing get a lot easier with this) 3. Being able to access COM easier within PowerShell 4. Being able to embed PowerShell in C# (so you can avoid writing a framework and just embed PowerShell in your infrastructure) 5. Being able to use weakly typed variables within PowerShell 6. Being able to test APIs on the command line, so you test manually and then automate 7. Getting a history of commands, to take what you've explored and turn it into a test case 8. Being able to strongly cast or coerce types when needed 9. Support for verbose, warning, and debug streams to provide additional test information 10. Being able to use PowerShell's systems administration features to help setup or cleanup a test environment is a software verification and validation method in which a programmer tests if Use of PowerShell in Unit Testing individual units of source code are fit for use – In Wiki’s terms 9
  • 10. 10