Using Theory and ClassData to Parametrize Xamarin UITests - xamarin

I'm currently trying to make UI-Tests in Xamarin, where i want the app to be tested against different server versions.
Originally i wanted to do this like i did in unit-tests with parametrized tests by using [Theory] and [ClassData].
Unfortunately i haven't found anything about this in the web so far regarding this nUnit construct.
Is this even possible? or is there another way to tell my xamarin UI-Test to run all my tests once for each server version?.
Many thanks in advance.
Mav

Soo, the mistake i made was to assume that i could use xunit blocks for nunit tests.
My bad.
The solution is pretty simple and can be looked up here in the gitHub projects documentation:
https://github.com/nunit/docs/wiki/TestFixtureData

Related

UI testing for react native apps

i am currently working on a UI automated testing project.
my job is to do UI automated testing on applications built via react-native.
the problem is that react-native doesn't provide resource-id.
i tried nativeID, and testID, and it didn't work out.
i tried accessibilityLabel but this is not the way to do it, because it assigns to the content-descp: which is used by the blind mode.
i tried cavy which is an integrated-ui testing tool, but it's very new, and there is not much support, plus it's not quit developped yet.
i tried selendroid, but i am facing some problems while loading the app in the local selendroid server, i think it has something to do with react native.
any help please!
On the project I’m working on right now, we are using Calabash for both Android and iOS. testID works with Calabash like this:
If you have a view with testID some-id, then you can query for it in calabash with query string ”* marked: some-id”
https://github.com/calabash/calabash-ios
I have also heard people having success with Appium, which is quite similar I think.
You can add AccessbiltiyLabel so that you will be able to automate via
driver.findElement(by.accessibility("id");

is user-extension must for selenium RC?

I have created a project in Eclipse for Selenium automation using testNG framework. I have never used any user extension file in the past, but I heard that we need to use an user extension file. As since I am unsure of the proper use of this file I have never used it and my project runs smoothly. The question now arises is that later on will I have any issues because of not using an user-extension file? Please give me some ideas on the user extension file and let me know whether its mandatory to use in selenium RC project.
thanks in advance
No, the user-extensions.js file is not required. But you may indeed need to use it, if your existing tests depend on an extension that is in it. Obviously, at that point you need to use the version of the file that the test author used.
I am not quite sure what your question is but I think the answer is No anyway, you do not need to have any "user extension files" in order to use selenium API in any JAVA testing environment. You just call API from your testNG or other testing frameworks. see http://release.seleniumhq.org/selenium-remote-control/1.0-beta-2/doc/java/

VS Team: A concrete example of the use of the TestContext property using Microsoft Unit Testing Framework?

While writing my tests this week for a new project, I encountered the TestContext property using the Microsoft Unit Testing Framework available with Visual Studio Team System.
I was wondering:
1. How this property could be used concretely?
2. In other words, what is its purpose?
3. Anyone has a concrete example to provide to ease my understanding?
I have written many tests so far in my career, and have never ever found a use for this particular property.
Any clue anyone?
Thanks in advance! =)
This property can be used to run parametrized tests, like if you have constants you don't want to hardcode in your test project that you want to load and share among all the tests. By default it will be populated with useful information, like the path where your test is running.
Then it is one of the key to run the same test several times with different values. The MSTest framework can be used to link your test project to a database or a csv file and run the tests once for all the rows in the said DB. This is called data driven testing and you'll find many sample on the net. Here is one how to.

Unit Testing a Firefox Addon

In working on a firefox addon, i've found the task of unit testing to be kinda janky and difficult to setup. Anyone have recommendations on how to setup unit tests for an addon? Any tools or additional addons found to be helpful?
I've found Mozmill [ https://addons.mozilla.org/en-US/firefox/addon/9018 ], which I think will be useful to an extent, but it's more of a high level tool and i'm looking for a tool or approach that works for more low level testing.
How about UxU ( https://addons.mozilla.org/en-US/firefox/addon/6357 ) ?
I used code-level unit testing with Mozmill. I "hooked" resource:// path of Mozmill by programmatically adding testing add-on (Urim) path to it in test initialization (setupModule function). As the result i can test any peace of code of my testing add-on like it is own code of Mozmill. Look here for an example. As i understand, this is you are looking for.
The new JetPack Add-On SDK they are working on for Firefox 4.0 has testing built in. It isn't documented yet though, but it's something to watch. It looks like you run "cfx test" which will run the tests.
Some links:
JetPack - https://jetpack.mozillalabs.com/
Add-On SDK Documentation - https://jetpack.mozillalabs.com/sdk/1.0b2/docs/
Add-On SDK Test Harness - https://builder.addons.mozilla.org/api/test-harness
Also see http://paulgu.com/wiki/Unit_Testing_Framework. I haven't used it, but it seems like a simpler and lighter-weight approach that might be easier to integrate. I think it could be better packaged to make it easier to add to an existing extension, but that is probably a straightforward refactoring.
WebDriver or Selenium?

Is there an API for running Visual Studio Unit Tests programmatically?

Is there an API for running Visual Studio Unit Tests programmatically?
Running MSTests.exe with Process.Start() does not work in the current scenario. What I'm looking for is something like the NUnit SimpleTestRunner.
Any ideas?
/Erik
You're correct in that there's no public API for the mstest framework. I wrote a manual replacement for mstest one day to see how hard it was, and it's not as simple as it looks (particularly if you want to take advantage of more than one CPU core), so beware of going down this path.
Personally I've always just run mstest.exe programatically and then parsed the resulting .trx XML file. Are there any particular reasons why you can't use Process.Start to run it?
P.S. Some of the strange behaviour of mstest.exe are solved if you pass the /noisolation command line parameter - give that a go if you feel so inclined :-)
Update: Erik mentions he wants to run the test API in the current thread so he can set the thread culture for globalization issues.
If you run a unit test under the debugger, you'll notice that mstest creates a bunch of threads, and runs all your tests in different threads, so this isn't likely to work even if you could access the API.
What I'd suggest doing is this:
From your test "runner" application, set an environment variable
Run mstest pointing it at the specific tests
Add a [ClassInitialize] (or [TestInitialize]) method which reads this environment variable and sets the culture
Profit!
After taking a deep dive with reflector into MSTest.exe and further down into the Visual Studio Unit Test stack, I found that the API used by MSTest is sealed up and made private so that i cannot be used from the outside.
Why not using Reflector and seeing how NUnit SimpleTestRunner is running the tests... And then use this technique...
You can make use of the Microsoft REST API's for TFS to run ms tests. Please refer to the documentation here.
I've linked to "Call a Rest API" so that you can see how you'd go about calling one of the REST API's for TFS.
Note that if your tests are linked to the build, they should run automatically every time a build is queued.
Here is the link to Run Functional Tests.
I've also discovered an article on using the TFS SDK API to run tests. Here is that link as well: Link to API Article

Resources