LoadTest: MethodAccessException Microsoft.VisualStudio.TestTools.WebTesting.WebTest.set_Outcome

I had a load test that used a coded web test. At some point the coded web test changed, i.e. this line was added: Outcome = Outcome.Fail;.

After this change the test stopped working – it always ended with error message: ‘User aborted test run’. Apart from that each iteration of the web test produced MethodAccessException: Microsoft.VisualStudio.TestTools.WebTesting.WebTest.set_Outcome(Microsoft.VisualStudio.TestTools.WebTesting.Outcome).

Solution

The reason for the problem was I was using Visual Studio TS 2008 without SP1. Once I installed the SP1, which must have updated mstest, the test started running successfully again.

The key point here is before SP1 Outcome was read-only property, which I learned there.

How to invoke a common coded web test method from GetRequestEnumerator()?

It’s a fact that coded web test methods give more flexibility to the developer, i.e. common code reuse. So let’s create a coded web test in whose GetRequestEnumerator() method you want to call a common method which tests some other requests. Let’s make it look as GetCommonRequests() in the example below:

public class AWebTest : WebTest
{
    private IEnumerator<WebTestRequest> GetCommonRequests()
    {
        WebTestRequest req1 = new WebTestRequest("http://google.com");
        yield return req1;

        WebTestRequest req2 = new WebTestRequest("http://google.com");
        yield return req2;
    }

    public override IEnumerator<WebTestRequest> GetRequestEnumerator()
    {
        WebTestRequest req = new WebTestRequest("http://google.com");
        yield return req;

        GetCommonRequests();
    }
}

You would expect to see three requests in the test result. You will see only one though…

Continue reading ‘How to invoke a common coded web test method from GetRequestEnumerator()?’

Is it possible to fail a load test?

It’s not really possible to fail a load test because by default it always ends with status ‘Completed’. Because of that anytime a load test completes one musts analyze the results – if performance stayed at the acceptable level. So, despite being a powerful tool, load tests require human attention, which makes the whole testing process less automate.

Continue reading ‘Is it possible to fail a load test?’

How to quickly add logging to a coded web test?

A coded web test, as opposed to a basic web test, brings more flexibility to the developer: conditioning, looping, code re-usage, etc. If you haven’t created one yet, you can follow an instruction on MSDN.

Now, because a coded web test can have some logic inside, it makes sense to add logging so that there’s a trace on what’s going on while it executes.

Continue reading ‘How to quickly add logging to a coded web test?’

Load Test – Plug-In class not found

I wanted to change a load test so that it works similar to what Gabriel Szlechtman described in his blog. Additionally, I followed MSDN instruction on how to create a Load Test Plug-In.

So I created a new project with a plug-in class, added a reference to it from load test project and wanted to hook the plug-in with the test. However, when I was doing the last step I was getting the following error:

pluginclassnotfound Load Test   Plug In class not found

Solution

The fix is quite simple. When I added a new class for the plug-in, it was defined without the access modifier (and therefore it was internal), which made the class accessible from other classes only in the same assembly. Adding public access modifier for the plug-in class solved the problem.

Could not access the result repository: Invalid object name ‘LoadTestRun’

When I ran a load test on my environment (Visual Studio TS 2008) for the first time I got the following error:

Error occurred running test. XXX could not access the result repository: Invalid object name ‘LoadTestRun’

Solution

The reason for that was I hadn’t had created a database schema for load tests. In order to do it I executed <VS location>\Common7\IDE\loadtestresultsrepository.sql which did all the job.

Please refer to msdn for more information.

Initializer list and initializing derived class members

Initializer list in C++ looks like in the example below (see constructor od D class):

class B {
  public:
    B() { }
};

class D : public B {
  public:
    int x;
    int y;

    D(int _x , int _y) : x(_x) , y(_y +1) { }
};

Continue reading ‘Initializer list and initializing derived class members’

C++: The Complete Reference

After several years of working with Java, C#, SQL and web technologies in general, there’s some time to use the other languages. Among others I’ll be writing some C++ code from time to time now.

I used C (and alittle bit of C++) when I was a student but that were all small projects and it was years ago. Now, it’s obvious I need to catch up with C/C++. I happened to get C++: The Complete Reference by Herbert Schildt. The word reference implies there’s probably no point in reading this book from title-page to colophon; there’s a lot of reference data like the standard function library. However, what I really liked about this book is it gives a quick introduction to most important aspects of C/C++ (e.g. pointers, classes, references, overloading, templates), of course with obvious and numerous code examples.

Recommended. It’s worth keeping this book nearby while working with C++.

Reblog this post [with Zemanta]

New job

After a couple of years in Kainos I’ve decided to change my job. Starting from November 1st, I’ve been working for Intel Corporation in a team that develops Intel Upgrade Service (please refer to that link to get more information on that platform).

In short, a lot of new techniques, technologies, tools, information. It sounds appealing and challenging though :) Anyway, wish me luck!

P.S. I’ve updated my CV, if you like.

Beginning SQL Server 2005 Programming

After a while (busy days…) I’ve got a new book: Beginning SQL Server 2005 Programming by Robert Vieira.

I’m not considering myslef a SQL Server expert but to be honest I was afraid of this beginning word in the title. Yet I’ve been using SQL Server for a couple of years (apart from Java, C#, etc. – so not full time SQL developing). Also I attended a few SQL related courses when I was at the university. So I should have quite solid theoretical and pratctical background. However, as I was not working with SQL Server full time I decided to give that book a bash. You can always stop reading if you don’t like the book :)

Continue reading ‘Beginning SQL Server 2005 Programming’




Switch to our mobile site