WatiN Multiple file upload - watin

I'm trying out WatiN for some specification tests. I hit a snag though when i was trying to figure out how to setup a file upload with multiple files (my test with just one file worked fine). Is it possible to setup multiple files in an upload-input using WatiN?

Related

error when trying to open a jmx file in jMeter (only whitespace content allowed before start tag and not { (position: START_DOCUMENT seen.. )

[Hi, I am trying to open a test plan which I copied the code from github, entered into text editor, changed file to .jmx - navigated to jmeter and tried to open the jmx file and I get the following error. Any ideas on how I can open this test script in jmeter?
I am on mac big sur and using jmeter 5.4.1
On a Windows 10 machine, I had the same problem and the XML in my .jmx file was well formed. Multiple validators confirmed this. The .jmx was originally created/saved from the same jMeter 5.5 app that was now not able to open it.
The issue turned out to be that my .jmx file had a BOM character at the start, which jMeter was not handling.
(Maybe after saving the file from jMeter I had re-opened it in VSCode and (maybe) saved it there and a BOM char got added to the beginning.)
Re-saving the file in VSCode with a different encoding to try to correct the issue was not successful, so I ended up creating a new blank file via VI in GitBash, and then just copying all of the XML into VI from the VSCode editor, and saving the new file from VI. The BOM char thankfully does not get copied to the clipboard.
jMeter had no problem opening the new file I created and saved in VI.
JMeter .jmx scripts are basically XML files and the error indicates that the XML is not well-formed so I can think of 2 possible options:
The file you're trying to open is not valid JMeter script/XML file
You're not good at copying and pasting
Actually trying to launch code from untrusted source without understanding what it does is not the best idea as I can post here a JMeter script which will delete all your files and start mining cryptocurrency so I would recommend building your test plan yourself, if it's HTTP protocol you can even record it using HTTP(S) Test Script Recorder or JMeter Chrome Extension

Appcelerator with expansion files

Has anyone successfully used expansion files with appcelerator? I have found the module that is supposed to let us work with them, however I am running into the problem of the .obb file being downloaded directly from the play store and then being downloaded again with the module. Aside from that I can't seem to get access to any of the files contained within the .obb using the module.
I have heard all of the woes of having a big app, so please don't just tell me to make a smaller app, my client has a large "library" that they want installed directly on the app. It consists of html files that call javascript files and images through relative paths.
Are expansion files even the way to go with this? Should I simply zip up my files and download them after, unpack them, and access them using the file system? I am just looking for a way to get these large files onto the device and access them as if they were in the resources directory of the app.
Any help would be appreciated. thanks!
I have an app that needs over 300 PNG images and text files (to populate a database with) and could not get the app small enough to put up on the Play Store. What I ended up doing was create a barebones app (enough to get the user started) then I download the files on start up. I didn't mess with zipping everything (the data is constantly being updated), but if the information you have is pretty static, you could zip it. Once the download successfully finishes and installs the data, it sets an app property (Ti.App.Properties.setInt) 0 is never ran, 1 is partial download and 2 is download is installed (you can do this however you want, but that's what I did).

Xamarin test cloud submit app and config file

When submitting an app and test assembly to Xamarin Test Cloud using test-cloud.exe (version Xamarin.UITest.1.3.9.1500-dev) we also need to submit an App.config file (as our test assembly relies on configurable appSettings).
Initially I had hoped that everything within the bin directory (either Debug / Release depending on --assembly-dir provided) would be uploaded to Test Cloud.
This does not appear to be the case, my App.config file (XamarinMobileTests.dll.config) present in the bin directory is not uploaded.
So, to address this issue, I have attempted 2 potential solutions, none of which I have had any success with, these are as follows:
Using the --data parameter with the submit command (--data XamarinMobileTests\bin\Release\XamarinMobileTests.dll.config). This always seems to return an error: "Data files must be located in the assembly directory or a sub folder."
I have attempted to put this file in various locations, with no luck.
Specify appSetting values within the --test-params parameter. This executes the submit command without error and instantiates a test run in test cloud. However, the Xamarin.UiTest Sdk does not seem to have any support for accessing the --test-params specified. My only option seems to be using the Xamarin Web Api, figuring out the test run (also not available via the Sdk) and then fetching the test-params from the test run meta-data.
The documentation on their site is extremely limited for these parameters.
Has anyone experienced similar issues in the past or found a potential solution?
Ideally, the config file is uploaded by default. However, if this is not an option, then solution 1 would be my preferred choice.
Turns out the issue was with a trailing "\" on the --assembly-dir that was causing the config file specified in --data to not be uploaded.
Changing:
".\XamarinMobileTests\bin\Release\"
to:
".\XamarinMobileTests\bin\Release"
Resolved the issue and the config file was successfully uploaded.
It looks as if the test-cloud.exe does some flakey comparisons on file paths.

Running JSCoverage with Jasmine

A little new to Javascript coding, so please bear with me.
I read through the following link
jasmine with jscoverage automated testing
However, since I don't have a Ruby project, it didn't seem to be what I wanted.
Here are the steps I executed:
Copy my js file to be tested to a directory 'input'
Run the following command 'jscoverage input output'
Copy my spec and src folders for Jasmine as well as SpecRunner.html into 'output'
Copy the instrumented source file into src
Open jscoverage.html in Chrome
Open SpecRunner.html in the 'Browser' tab
At this point, the browser page displays my Jasmine tests. However, the 'Summary' page shows 0 files tested and the 'Source' tab is grayed out.
I know I messed up somewhere but am not sure where. Please help me out. Thanks!
The correct steps to be followed are as follows:
Copy the jasmine files (spec and src folders for Jasmine as well as SpecRunner.html) to a directory 'input'
Run the following command 'jscoverage input output'
Open jscoverage.html in Firefox (Chrome will not show the individual files that were tested)
Open SpecRunner.html in the 'Browser' tab
This approach has the drawback that all the files including jasmine related js show up. But you can select your js file that's being tested and just look at the code coverage for it.
The standard jscoverage approach is to instrument the entire codebase you want to get coverage on, then run a suite a tests and generate a report. This approach is a bit heavy handed since a codebase only needs a coverage report on a set frequency. Unlike CI tests, how often does the dev really need to know the coverage percentage change, weekly?
The node.js jscoverage project uses the same 'instrumentation' approach as the larger jscoverage project, but it can be run from the node CLI on an individual file, or from code on one or more files, as they are called from the tests themselves. In place of separate step to 'instrument' a batch of files, the jscoverage (confusing name), 'instruments' at test runtime.
I have been working towards a pattern that allows jasmine tests and testing in either a browser or at the CLI using the same source code setup and test configuration. Still beta. The jasmine just-in-time 'instrumentation' is not done yet.
https://github.com/d1b1/jasmine-jscoverage

Creating a Visual Studio Web test to upload a file with a random file name

I have (after quite a bit of work) a web test that will upload a file to my SharePoint document library using a file that is included in the test and DeploymentItem that identifies that file so it can be used in the file upload post parameter.
That works great, now ignoring the SharePoint factor for a moment, image that I want to run the webtest as part of a loadtest. That means that the file upload test needs to be run a fair amount of times. That is not so great if I am upload the same file to the same filename all the time.
What I want to do is to create a random file at the target, using the same file data. e.g. I want the file that is uploaded to have the filename "image1" + Guid.NewGuid.ToString() + ".jpg".
Aside from creating a new file on the disc with that name and adding a Deployment item or something to locate the file each time, I am at a loss as how to do this. This is especially a problem as the web test will be run via a test agent on a machine that I will not really be able to create that much code on.
Worst case scenario I will go with deleteing the file after uploading it.
Any ideas on how I can do this?
given a scenarion where the file image1.jpg is being set as the deployment item and is being copied to the build target, the following code creates a file available for upload in the manner required
string image1Location = "image1" + Guid.NewGuid().ToString() + ".jpg"
System.IO.File.Copy("image1.jpg", image1Location);
after the file has been used
System.IO.File.Delete(image1Location)

Resources