Thursday, February 09, 2012

Clearing all event logs


Here is the code to clean up all event logs in the current machine/server.

The code is in power shell, as some people feel this is the best language to write scripts on Windows.

strComputer = "." 
Set oWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate,(Security)}!\\" & _
strComputer & "\root\cimv2" )
Set cLogFiles = oWMIService.ExecQuery _
("SELECT * FROM Win32_NTEventLogFile" )
For Each oLogfile in cLogFiles
Wscript.echo("Clearing Logfile " + oLogFile.Name)
oLogFile.ClearEventLog()
Next

Thursday, February 02, 2012

Web driver script

Hasan from Trainline shared with us Selenium WebDriver script.

I was using Selenium before Web Driver came into the picture. Need to try this out.

 

using System;

using NUnit.Framework;

using OpenQA.Selenium;

using OpenQA.Selenium.IE;

using OpenQA.Selenium.Remote;

using OpenQA.Selenium.Support.UI;

namespace WebDriver

{

    [TestFixture]

class TrainlineTest

    {

        [Test]

public void webDriverTest()

        {

var ieCapabilities = DesiredCapabilities.InternetExplorer();

            ieCapabilities.SetCapability(InternetExplorerDriver.IntroduceInstabilityByIgnoringProtectedModeSettings, true);

var driver = new InternetExplorerDriver(ieCapabilities);

            driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(10));

           driver.Navigate().GoToUrl("http://buytickets.thetrainline.tw.testttl.com");

            driver.FindElement(By.Id("OriginStation")).SendKeys("London");

            driver.FindElement(By.Id("DestinationStation")).SendKeys("Manchester");

            driver.FindElement(By.Id("SingleJourneyCheckBox")).Click();

new SelectElement(driver.FindElement(By.Id("AdultsTravelling"))).SelectByText("2");

IWebElement query = driver.FindElement(By.Id("outwardDate"));

            query.SendKeys(Keys.Control + "a");

            query.SendKeys("23/02/2012");

            driver.FindElement(By.Name("extendedSearch")).Click();

Assert.IsTrue(driver.FindElement(By.Id("showTicketsIdButton")).Displayed, "Show Prices Button Not Present");

        }

   }

}

Wednesday, January 11, 2012

The best file search utility–fast and free

I have come across Agent Ransack and it was really fast. Works well if you want to search for text inside a particular file.

Initial screen

Agent Ransack - great software for searching for text in files

Searching for the text “sync tool is run”.

sync tool is run

Visual Studio 2008 Load Test Gotchas!

 

I really like this link: http://www.codeproject.com/KB/testing/VS2008LoadTestGotchas.aspx

This was shared by our NFT SME.