Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have planned to implement automated testing for our web application .I want the tool to be open source, test cases should be written in C sharp.
So i choose to use selenium Web-driver and N-unit. I have a set of questions.
Can i only unit testing with this setup? Cannot do function testing?
I'll avoid answering your first question as it's not suited for StackOverflow :)
Can i only unit testing with this setup? Cannot do function testing?
You can use Selenium with a wide range of tasks.
I started off doing unit testing of individual components of our web application.
Then I moved on to functionally testing the end-to-end behavior.
Currently I'm doing massive stress testing with hundreds of concurrent browser sessions.
All using Selenium.
Should i have to write all test cases as methods?
As far as I know (and I don't know a lot), the most flexibility is attained when you conceptualize your testing architecture this way.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
As suggested I am rewording the question for clarification on requirements:
Suppose there are 4 environments (Development/Functional Test/Staging and Production). Each environment has its own database, Rest API (URI), username, password etc etc and there are two sets of tests
a) Continuous Integration tests that run as part of deployment (Run against Development and production)
b) Complete test suite (Run against Functional and Staging)
I want tests to pick up environment dynamically or It can be specified as command line argument to kick of the required tests.
Since you're talking about Urls I will assume you are running some sort of automated UI tests.
For a given feature1.feature Specflow generates a C# file called feature1.feature.cs, in this file there are tests written in the unit testing framework you have configured in your App.config. Here are the available unit test providers.
When you run your tests from the command line, you are actually running those (let's say) NUnit tests. So you won't be able to get those arguments from the command line.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
It’s true that using Contracts.Requires and Contracts.Ensure in C# methods will reduce the necessary unit tests for that methods? Can I just ignore the range of values that are not in conformity with the contracts or those values should also be included in the unit tests?
It should not, design by contract is not intended to replace unit testing, or any kind of testing. Pre-conditions and post-conditions are used to enforce a contract, but the end client of that contract needs to make sure that such contract is still in place. So you need to keep the unit tests in place with all range of values to make sure everything is the way it should be.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I want to test my asp.net web api REST service that hosted in a HP-580dl and I want to measure the performance and response time when 10,000 simultaneous requests hit the service.
is there any way to do that in C# ?
Siege is a good tool for measuring load under concurrent requests: http://www.joedog.org/siege-home/
It's not written in C#, but there's no reason why it should be.
The Visual Studio load testing tools provide this functionality, and can control multiple agents in cases where you want a distributed profile and/or a greater concurrency level than a single client machine can support.
Create and run a load test
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
In theory, it is difficult to perform tests on functional code bases that need interactions with database, but I think we can use mocks. In real life applications, do you have failed cases when applying mocks to perform TDD tests with databases ? Could you shared some thoughts to explain this to me?
In tdd i use mocks to replace the physical database access with a fake (mock).
For databaseaccess i am always using a The Repository Pattern as api which can be easily mocked.
To Answer your question:
> do you have failed cases when applying mocks
> to perform TDD tests with databases ?
No as long all database-operations are encapsulated in the repository.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have asked a unit testing practical question previously (Unit testing: how to test methods with a lot of underlying objects and business logic), and I need to open another subject on the same piece of code.
The question is what if I disregard what everybody tells me, and I proceed to "unit-test"-ing that MoveElementAtIndex method (which moves Products within a product collection) without any stress about the underlying calls and usages of other classes. I can just instantiate a new collection of products and test that they move around correctly, right?
This is not unit testing, I know. It's not integration testing either.
It's hybrid, and what would you say it is wrong with that? It would still help me to avoid problems. Or wouldn't it?
Nothing very wrong about it, but you could easily make it a real unittest, if your collection was not concrete products, but interfaces of products. By doing this, you make sure, that the outcome of your test does not depend on the implementation issues in your product objects. This makes the test cleaner, and your code more dependable.
And by the way: There are no hybrids between unit and integration tests. What You have is an integration test. Only if you replace all external dependecies with stubs or mocks, you can call it a unit test.