Windows 7 USB/DVD Download Tool

by Laurent Kempé 27. August 2010 09:18

Tonight during the preparation of an usb stick using Windows 7 USB/DVD Download I got an error message about bootsect just at the end of the creation of bootable usb stick. Following the troubleshoot link I arrived on the following

When creating a bootable USB device, I am getting an error about bootsect
To make the USB device bootable, you need to run a tool named bootsect.exe. In some cases, this tool needs to be downloaded from your Microsoft Store account. This may happen if you're trying to create a 64-bit bootable USB device from a 32-bit version of Windows. To download bootsect:

  1. Login to your Microsoft Store account to view your purchase history
  2. Look for your Windows 7 purchase.
  3. Next to Windows 7, there is an "Additional download options" drop-down menu.
  4. In the drop-down menu, select "32-bit ISO."
  5. Right-click the link, and then save the bootsect.exe file to the location where you installed the Windows 7 USB/DVD Download Tool (e.g. C:\Users\username\AppData\Local\Apps\Windows 7 USB DVD Download Tool).
  6. Once the file has been saved, go back to the Windows 7 USB/DVD Download tool to create your bootable USB device.

Now my problem is that I haven’t ordered my iso on Microsoft Store but downloaded it from MSDN, so I can’t download bootsect from Microsoft Store.

I could find bootsect.exe in a Windows 7 32 bit iso which came also from MSDN. Then after following the help documentation I successfully created a bootable usb stick with Windows 7 64 bits.

Tomorrow evening I will start the re-installation of my machine with a fresh Windows 7 64 bits (running 32 bits till now) and a new Seagate Momentus XT, 7200rpm, 32MB, 2.5", 500GB, SATA-II

Bookmark and Share DotnetKicks dotnetshoutout

Tags:

Windows 7

Corporate Culture, disruptive thinking and implementation

by Laurent Kempé 29. July 2010 17:27

Today, my friend Didier finally pushed his post about Netflix on his blog, Corporate Culture: unusual Netflix example. Some time ago, quite some time ago, he sent me the presentation about Netflix, which had a big impact on me! I liked very much the idea !

Netflix thinks that “as they grow, they have to minimize rules”. Different approach as what we all know, experience, read. And … Netflix is definitely not a startup anymore! I would like to share with you a document from Netflix I found on SlideShare about their culture and some quite innovative management ideas they have put in place. Feed for thoughts ;-)

I’d like to think that I pushed him a bit to publish this after sending him the link and having a talk about the post of Startup Culture Lessons From Mad Menwhich bring a lot of similar points than the presentation of Netflix.

That led us to think a bit about what just didn’t make sense anymore given the realities of the Gen Y worker, broadband in the home, constant connectivity via mobile devices, the modern market for hiring exceptional people, etc.

Here are some of the more interesting features of working life at a post-modern company that have come out of that Mad Men inspired thinking.

It is clear that not everybody is ready to work like this, there is quite a mind shift !

I am happy to see that some of those idea made their way at Innoveo.

Bookmark and Share DotnetKicks dotnetshoutout

Tags: , , ,

Management | Leadership

Unit Test using test doubles, aka Mock, Stub, Fake, Dummy

by Laurent Kempé 17. July 2010 00:31

Following my post about Application Acceptance Testing, we went, beginning of that week, in some very interesting discussions during a meeting at Innoveo in which I presented the differences between Mock and Stub in Unit Test. After the meeting as I often do I gather up from the web some posts which expressed in more details what I was talking about and made some extract of the posts.

This time I found some interesting content follow-up on my explanations on the site of Rhino.Mock framework website and a post from Martin Fowler; Mock’s aren’t Stubs

Understanding the difference between a Stub and a Mock is an important distinction to do, because they have each one purpose which isn’t the same.

Some framework like the excellent mockito decided not to make the distinction in the way you create the two, some other framework like the also excellent Rhino.Mock does this distinction. At the end what is important is that the developer understand the difference.

Extract from Rhino.Mock website

“In short term, mock are for behavior verification, and stub are for state verification.

In longer term, a mock is an object that we can set expectations on, and which will verify that the expected actions have indeed occurred. A stub is an object that you use in order to pass to the code under test. You can setup expectations on it, so it would act in certain ways, but those expectations will never be verified.

In general, it is recommended to follow the principle of "Test only one thing per test". So each unit test should validate no more than one significant interaction with another object. This generally implies that a given test should have no more than one mock object, but it may have several stubs, as needed. (An exception to this would be if the "one thing" tested inherently requires expectations on two dependent objects, for example, verifying that a method on one object is only called after a method on another object has been called.)

If you want to verify the behavior of the code under test, you will use a mock with the appropriate expectation, and verify that. If you want just to pass a value that may need to act in a certain way, but isn't the focus of this test, you will use a stub.

IMPORTANT: A stub will never cause a test to fail.”

Extract from Martin Fowler post

“This difference is actually two separate differences. On the one hand there is a difference in how test results are verified: a distinction between state verification and behavior verification. On the other hand is a whole different philosophy to the way testing and design play together, which I term here as the classical and mockist styles of Test Driven Development.”

Fowler in his post use an older way (post from 2007) of expressing Arrange-Act-Assert, mixed with Fixture terms: setup, exercise, verify, teardown.

Today’s the expressions Arrange-Act-Assert or Record-Replay (which he is talking later on in the post) are common.

Stub

“This style of testing uses state verification: which means that we determine whether the exercised method worked correctly by examining the state of the SUT and its collaborators after the method was exercised. As we'll see, mock objects enable a different approach to verification.”

Mock

“The SUT is the same - an order. However the collaborator isn't a warehouse object, instead it's a mock warehouse - technically an instance of the class Mock.

The second part of the setup creates expectations on the mock object.The expectations indicate which methods should be called on the mocks when the SUT is exercised.

Once all the expectations are in place I exercise the SUT. After the exercise I then do verification, which has two aspects. I run asserts against the SUT - much as before. However I also verify the mocks - checking that they were called according to their expectations.

The key difference here is how we verify that the order did the right thing in its interaction with the warehouse. With state verification we do this by asserts against the warehouse's state. Mocks use behavior verification, where we instead check to see if the order made the correct calls on the warehouse. We do this check by telling the mock what to expect during setup and asking the mock to verify itself during verification. Only the order is checked using asserts, and if the method doesn't change the state of the order there's no asserts at all.”

“When you're doing testing like this, you're focusing on one element of the software at a time -hence the common term unit testing. The problem is that to make a single unit work, you often need other units - hence the need for some kind of warehouse in our example.”

Mock/Stub are also called test doubles inspired from stunt double in movies! I think the analogy is quite good.

“Meszaros then defined four particular kinds of double:

  • Dummy objects are passed around but never actually used. Usually they are just used to fill parameter lists.
  • Fake objects actually have working implementations, but usually take some shortcut which makes them not suitable for production (an in memory database is a good example).
  • Stubs provide canned answers to calls made during the test, usually not responding at all to anything outside what's programmed in for the test. Stubs may also record information about calls, such as an email gateway stub that remembers the messages it 'sent', or maybe only how many messages it 'sent'.
  • Mocks are what we are talking about here: objects pre-programmed with expectations which form a specification of the calls they are expected to receive.

Of these kinds of doubles, only mocks insist upon behavior verification. The other doubles can, and usually do, use state verification. Mocks actually do behave like other doubles during the exercise phase, as they need to make the SUT believe it's talking with its real collaborators - but mocks differ in the setup and the verification phases.”

Mock objects always use behavior verification, a stub can go either way. Meszaros refers to stubs that use behavior verification as a Test Spy. The difference is in how exactly the double runs and verifies and I'll leave that for you to explore on your own.”

Test Driven Development

The classical TDD style is to use real objects if possible and a double if it's awkward to use the real thing. So a classical TDDer would use a real warehouse and a double for the mail service. The kind of double doesn't really matter that much.

A mockist TDD practitioner, however, will always use a mock for any object with interesting behavior. In this case for both the warehouse and the mail service.

”An important offshoot of the mockist style is that of Behavior Driven Development (BDD). BDD was originally developed by my colleague Dan North as a technique to better help people learn Test Driven Development by focusing on how TDD operates as a design technique. This led to renaming tests as behaviors to better explore where TDD helps with thinking about what an object needs to do. BDD takes a mockist approach, but it expands on this, both with its naming styles, and with its desire to integrate analysis within its technique. I won't go into this more here, as the only relevance to this article is that BDD is another variation on TDD that tends to use mockist testing. I'll leave it to you to follow the link for more information.”

“Occasionally you do run into things that are really hard to use state verification on, even if they aren't awkward collaborations. A great example of this is a cache. The whole point of a cache is that you can't tell from its state whether the cache hit or missed - this is a case where behavior verification would be the wise choice for even a hard core classical TDDer. I'm sure there are other exceptions in both directions.”

“It's at this point that I should stress that whichever style of test you use, you must combine it with coarser grained acceptance tests that operate across the system as a whole. I've often come across projects which were late in using acceptance tests and regretted it.”

TDD's origins were a desire to get strong automatic regression testing that supported evolutionary design. Along the way its practitioners discovered that writing tests first made a significant improvement to the design process.

“As I've learned from Test Driven Development itself, it's often hard to judge a technique without trying it seriously.”

Bookmark and Share DotnetKicks dotnetshoutout

Tags: ,

unit test | innoveo solutions | TDD | Agile | acceptance test

File dialog automation using White framework

by Laurent Kempé 16. July 2010 03:22

Today TeamCity was showing me one functional test failure on my WPF application.

I already discussed about this problem here: White’s tip for your automated WPF functional tests
The solution I presented at that time was working on my local development environment but not on my Continuous Integration system; aka TeamCity. So I went for another solution which was searching for the filename ComboBox and was setting the value.

This was working for some time but today not anymore. The issue I discovered is that using the ComboBox needed that the path was already used in the past otherwise setting the value was failing. So I was stuck and had to find another solution.

I fired spy++ and searched for a solution and after some debugging I came to the following one:

var openModalWindow =
    MainWindow.ModalWindow("Please choose a Zip file", InitializeOption.NoCache);

MainWindow.WaitWhileBusy();
Assert.IsNotNull(openModalWindow);

var filePath = Path.Combine(GetCurrentPath(), filename);

var filenameTextBox =
    openModalWindow.Get<TextBox>(SearchCriteria.ByAutomationId("1148"));
filenameTextBox.SetValue(filePath);

openModalWindow.Keyboard.PressSpecialKey(KeyboardInput.SpecialKeys.RETURN);

This is working on my local environment but also on TeamCity!

The key point was to find the TextBox with the AutomationId of 1148.

Bookmark and Share DotnetKicks dotnetshoutout

Tags: ,

acceptance test | white

Application Acceptance Testing

by Laurent Kempé 15. July 2010 01:01

Yesterday evening I found a set of Google blog posts talking about web application acceptance testing which reflect Google experience through “Several years of experience across multiple project teams”.

This reflect lot of points I brought into our discussions either at Innoveo or Jobping; best practices, screen/page object, dev. language, recording/coding, BDD..

Here are the blog posts:

And the key points I extracted from those three blog posts:

Best practices to have long-lived tests

“Acceptance tests must meet the needs of several groups, including the users and the developers. Long-lived tests must be written in the language of each group, using terms users will recognize and a programming language and style in which the developers are competent.”

Utilities such as recording tools can help reduce the effort required to discover how to interact with the web application. The open-source test automation tool Selenium (http://seleniumhq.org/) includes a simple IDE record and playback tool that runs in the Firefox browser. Recorded scripts can help bootstrap your automated tests. However, don’t be tempted to consider the recorded scripts as automated tests: they’re unlikely to be useful for long. Instead, plan to design and implement your test code properly, using good software design techniques.”

“Several years of experience across multiple project teams have taught us that the tests are more likely to survive when they’re familiar and close to the developers. Use their programming language, put them in their codebase, use their test automation framework (and even their operating system). We need to reduce the effort of maintaining the tests to a minimum. Get the developers to review the automated tests (whether they write them or you do) and actively involve them when designing and implementing the tests.”

Isolate things that change from those that don’t. For example, separate user account data from your test code. The separation makes changes easier, faster, and safer to implement, compared to making updates in the code for each test.”

“Robust tests can continue to operate correctly even when things change in the application being tested or in the environment. Web applications use HTML, so try to add IDs and CSS classes to relevant elements of the application

Try to avoid brittle identifiers, such as xpath expressions that rely on positional data. For example, /div[3]/div[1] becomes unreliable as soon as any of the positions change – and problems may be hard to identify unless the change is easy to identify.

Add guard conditions that assert your assumptions are still accurate. Design the tests to fail if any of the assumptions prove false.

Try to only make positive assertions. For example, if you expect an action to cause an item to be added to a list, assert that after the action the list contains the expected value, not that the list has changed size (because other functionality may affect the size). Also, if it's not something your test is concerned about, don't make assertions about it.

“Informative tests
Help your tests to help others by being informative. Use a combination of meaningful error messages and more detailed logs to help people to tell whether the tests are working as intended and, if problems occur, to figure out what’s going wrong.”

Taking screenshots of the UI when a problem occurs can help to debug the issue and disambiguate between mismatches in our assumptions vs. problems in the application.

Debug traces are useful for diagnosing acute problems, and range from simple debug statements like ‘I made it to this point’ to dumps of the entire state of values returned from the application by our automation tool. In comparison, logging is intended for longer-term tracking of behaviour which enables larger-scale thinking, such as enabling a test to be reproduced reliably over time.

Good error messages should say what’s expected and include the actual values being compared. Here are two examples of combinations of tests and assert messages, the second more helpful than the first:

1. Int actualResult = addTwoRandomOddNumbers();

assertTrue("Something wrong with calculation", actualResult % 2 == 0);

2. Int actualResult = addTwoRandomOddNumbers(number1, number2);

assertEquals(String.format("Adding two odd numbers [%d] and [%d] should return an even result. Calculated result = %d", number1, number2, actualResult) actualResult % 2 == 0);”

“My advice for developing acceptance tests for Web applications: start simple, keep them simple, and find ways to build and establish trust in your automation code.

The value of the tests, and their ability to act as safety rails, is directly related to how often failing tests are a "false positive." Too many false positives, and a team loses trust in their acceptance tests entirely.

Acceptance tests aren’t a ‘silver bullet.’ They don’t solve all our problems or provide complete confidence in the system being tested (real life usage generates plenty of humbling experiences). They should be backed up by comprehensive automated unit tests and tests for quality attributes such as performance and security. Typically, unit tests should comprise 70% of our functional tests, integration tests 20%, and acceptance tests the remaining 10%.

“Lots of bugs are discovered by means other than automated testing – they might be reported by users, for example. Once these bugs are fixed, the fixes must be tested. The tests must establish whether the problem has been fixed and, where practical, show that the root cause has been addressed. Since we want to make sure the bug doesn’t resurface unnoticed in future releases, having automated tests for the bug seems sensible. Create the acceptance tests first, and make sure they expose the problem; then fix the bug and run the tests again to ensure the fix works.”

About Screen/Page objects

Effective test designs

By using effective test designs, we can make tests easier to implement and maintain. The initial investment is minor compared to the benefits. One of my favourite designs is called Page Objects (see PageObjects on the Google Code site). A PageObject represents part or all of a page in a web application – something a user would interact with. A PageObject provides services to your test automation scripts and encapsulates the nitty-gritty details of how these services are performed. By encapsulating the nitty-gritty stuff, many changes to the web application, such as the reordering or renaming of elements, can be reflected in one place in your tests. A well-designed PageObject separates the ‘what’ from the ‘how’.

BDD – Behavior Driven Development

Another effective test design is based on three simple words: ‘given’, ‘when’, and ‘then’. As a trio they reflect the essential elements of many tests: given various preconditions and expectations, when such-and-such happens, then I expect a certain result.

// Given I have a valid user account and am at the login page,

// When I enter the account details and select the Enter button,

// Then I expect the inbox to be displayed with the most recent email selected.”

To me all those points are valid ! And the best is that most of them aren’t bound to a technology, a framework or whatsoever.

I could apply those principles on different applications built using ASP.NET MVC, WPF, Java JSF with different frameworks like MSpec, Watin, White, Selenium, JUnit/NUnit

You might read more about this on the following posts:

Bookmark and Share DotnetKicks dotnetshoutout

Tags: , , , ,

Agile | BDD | innoveo solutions | Jobping | acceptance test

Run old build using TeamCity

by Laurent Kempé 10. July 2010 00:59

At Jobping and Innoveo we are using TeamCity from Jetbrains to automate our different builds.

Today I was asked by my colleague Roy the following interesting question “Can I rerun an old build?”

My first thought and question was, “do you have a tag for that old build?” The response was no. With a yes I would have proposed to use what I described in a previous post: Build and Deployment automation, VCS Root and Labeling in TeamCity. In which we could change the VCS Checkout rulesto point to that particular tag and run the build.

Then I searched the TeamCity online documentation and found about History Build which lead me to Run Custom Build Dialogwhich starts with the following:

To open the dialog:

  • Click ellipsis on the Run button

I am using for a long time TeamCity, and I can’t believe that I never pressed that part of that button!

Then you get access to the popup in which you can select an older build!

And run the build.

Which is interesting for example when you have some of your builds which are deploying your web applications and you want to come back to a last stable version.
Bookmark and Share DotnetKicks dotnetshoutout

Tags:

Team City | continuous integration | innoveo solutions | Jobping

Jobping announcing StickyBeak

by Laurent Kempé 26. June 2010 20:25

As said when we launched Jobping Open Source Short Urls Service, we at Jobping are committed to open source.

So last week we announced  StickyBeak, you might read more on the blog of Mark - Introduction to StickyBeak

StickyBeak is a logging tool for asp.net websites which logs information such as date, http method, url, User.Identity.Name, IP Address, unique session Id, unique browser Id, header values, querystring values, posted form values and cookie values for every request.

Here is a screenshot of the administration page,which lets you see the logged activity on your site.

StickyBeak is a complementary tool to the excellent elmah from Atif Aziz

We are using elmah on Jobping to log exceptions that might happen on the site, but we also wanted a raw record of each request made to our site, to make our troubleshooting life easier.

You can download the source and binaries from StickyBeak on CodePlex.

Bookmark and Share DotnetKicks dotnetshoutout

Tags: , ,

Jobping | ASP.NET | ASP.NET MVC

Power of IntelliJ in video

by Laurent Kempé 16. June 2010 02:02

Today I was listening and some time watching (it helps to have two monitors :) the following video that I got from Jetbrains blog post, Vaclav Pech Talking at JAX 2010

I learned several tips and I think this video shows why I like more and more IntelliJ.

If you missed Vaclav Pech speech at JAX 2010, here’s your chance to hear it right now. In this presentation he’s discussing common coding pitfalls such as possible NPE, unreachable code, and explains how they can be easily avoided.

Vaclav Pech at JAX 2010 from Egor Malyshev on Vimeo.

Bookmark and Share DotnetKicks dotnetshoutout

Tags:

IntelliJ | Jetbrains | Productivity

Using Gmail as Blogengine smtp server

by Laurent Kempé 11. June 2010 05:54

Five days ago I posted about Using Gmail as TeamCity smtp server. At that time I also tried to configure my blog which uses BlogEngine with the same settings and it didn’t work.

Tonight I succeeded and the only difference is the port number which needs to be set to 587 for BlogEngine

4688262943_9fc9e8eaf9_o[1]

Bookmark and Share DotnetKicks dotnetshoutout

Tags: , ,

BlogEngine.NET

From WPF functional Unit Tests to Specifications using MSpec and White

by Laurent Kempé 11. June 2010 03:21

I am in the train back home and wanted to try out quickly to migrate our WPF functional tests written has Unit Tests to BDD Specifications.

Here is the code I started from, pure Unit Test using NUnit and White

[Test]
public void Opening_Valid_VersionZip()
{
    OpenAndWait("Product.zip");

    Assert.That(MainWindow.Title.Equals("Product.zip - Innoveo Skye® Editor"));
    Assert.That(Status.Text.Equals("product"));
    Assert.That(ProductTree.Nodes.Count >= 1);
    Assert.IsFalse(SplashScreen.Visible);
    Assert.IsTrue(SaveButton.Enabled);
    Assert.IsTrue(ActivateButton.Enabled);
}

Now the same functional test written as a BDD specification using MSpec

[Subject("OpenVersionZip")]
public class when_user_open_valid_versionzip : MainWindowViewSpecs
{
    Establish context = () => {};

    Because of = () => OpenAndWait("Product.zip");

    It should_display_mainwindow_title_correctly = () =>
        MainWindow.Title.ShouldEqual("Product.zip - Innoveo Skye® Editor");

    It should_display_status_correctly = () =>
        Status.Text.ShouldEqual("product");

    It should_display_the_product_tree = () =>
        ProductTree.Nodes.ShouldNotBeNull();

    It should_hide_the_splashscreen = () =>
        SplashScreen.Visible.ShouldBeFalse();

    It should_enable_save_button = () =>
        SaveButton.Enabled.ShouldBeTrue();

    It should_enable_activate_button = () =>
        ActivateButton.Enabled.ShouldBeTrue();
}

And the output in ReSharper MSpec plugin

4687909611_49a4e5a71a_o[1]

Which one do you prefer? I personally have made my choice.

Bookmark and Share DotnetKicks dotnetshoutout

Tags: , , ,

white | WPF | unit test | MSpec

About

Laurent Kempé

Laurent Kempé is the editor, founder, and primary contributor of Tech Head Brothers, a French portal about Microsoft .NET technologies.

He is currently employed by Innoveo Solutions since 10/2007 as a Senior Solution Architect and certified Scrum Master.

Founder, owner and Managing Partner of Jobping, which provides a unique and efficient platform for connecting Microsoft skilled job seekers with employers using Microsoft technologies.

Laurent is awarded by Microsoft since Avril 2002: Most Valuable Professional (MVP).

Badges

MVP
Certified ScrumMaster
JetBrains Academy Member

Contact

View Laurent Kempé's profile on LinkedIn

XING

My status

twitter

facebook

Page List