Load a resource into a frame work from an app - xcode

I have a framework I wrote for an app and now I am writing some unit tests for it. To complete the test suite, I need to load a configuration file from the main app into my framework's unit tests. When I try to use Bundle(for: self.classForCoder) and load that config file, it returns nil all the time. Any thoughts?

Neither your framework, nor the tests for it, can access your main app bundle that way.
Since your app provides the config file to the framework, your tests can do the same. If you can use a test config file, just add it to your test bundle. If you need a copy of the actual config file, then make a copy.
(You may want a Run Script build phase to do the copying. Don't forget that just making a copy isn't enough — you still need to add it to the test target.)

Related

Is there a way to run cypress test to test web application deployed on AWS in different environments?

I can give the URL in cy.visit to point to deployed application, but I am not clear on the setup, as I don't have CI/CD yet. The goal is to be able to run this test on a button click, not having to checkout workspace and build the application.
I can give the URL in cy.visit to point to deployed application, but I am not clear on the setup, as I don't have CI/CD yet. The goal is to be able to run this test on a button click, not having to checkout workspace and build the application.
Yes, you could test your application directly on a staging/preproduction environment on AWS without A CI/CD.
However, I would not recommend using Cypress against a production environment because for E2E testing to be efficient, you will probably create/delete/edit many things, which may not be suited for a prod env.
Finally, it depends on what you try to achieve with your tests. In general, you will use Cypress to ensure your product works as expected after adding a new feature, for example. You always want to test against the latest version of your code.
On the setup, the E2E tests can be packaged in the project and run manually until you have a CI to execute them automatically.
https://docs.cypress.io/guides/guides/command-line#cypress-run

Building JAR files in a Heroku app

I have a web app running on Heroku from which I need to build and make available a JAR file when a user of the app requests it. I also need to run ProGuard on the generated JAR file. Is it possible to do this on Heroku?
We're working on exposing Heroku build infrastructure as services and what you describe is a use case that we want to support. You might be able to get something working by using or reverse-engineering heroku-push: https://github.com/ddollar/heroku-push
Here's the server-side bit that actually builds code: https://github.com/ddollar/anvil
Ryan Brainard has built a Java wrapper for Anvil: https://github.com/ryanbrainard/janvil

Per-test sample data generation for load testing?

I have a set of load tests, each testing a specific section of Sharepoint site. How can I automate the generation of sample data prior to each test?
I know that load tests allow me to specify tests that are run before/after a specific virtual user's test mix, but those are meant for user-specific setup like logging on. I want to create sample data for all users.
I can put my setup code into the Team Build template, but that doesn't take into account whether the test using the sample data is in the test list being run or not. If I modify the test list, I would also need to modify the build template as well. I cannot put the setup code into a test that is run before the load test either, because load tests must be run with the .Net 4.0 framework while accessing Sharepoint's API requires 3.5.
I could rewrite my sample data generation logic with Powershell and start it from a .Net 4.0 unit test. Is it my best option or is there a more elegant way?
I think you question is more TeamBuild related than SharePoint. For short, the best way how to setup (and teardown) testdata in SharePoint is using PoSh in conjunction with the Microsoft.PowerShell.SharePoint SnapIn.
You can start your PowerShell scripts from Everywhere in TeamBuild. That's actually how I extend the default TeamBuild template. I've create a single custom build template, this template contains numerous PoSh hooks. While setting up a new project you can easily hook your scripts everywhere you need.
To be really independent from any .NET FX version you could create your sampledata using REST DataServices (ListData.svc)

Hudson build ignores .properties path

I`m trying to build a maven project in Hudson and here I set the path for the .properties files. Yet it seems to get them from somewhere else (it definitely gets them because it connects to the db and runs some queries) because I set this to a invalid path on purpose.
There is no error and everything runs OK.
I need to add another variable to the .properties file and it seems to ignore it. Is there a temp/cache folder it uses?
Goals and options: clean process-resources "-Dproperties=/data/ic/test/aradd" -Denv=test site clean
If your application uses a business and a batch component verify the properties for the business component. Be careful for the declared folder for your business component properties.

How to deal with database initialization?

As also described here, I'm trying to determine the best way to initialize and update my application's database. I use EclipseLink-JPA2. I distribute a NetBeans platform application.
Considered options:
use create-tables ddl-generation:
The problem with this is that everytime the application runs it will throw exceptions, failing to create the tables. It will be useful only at setup time. This would be similar to placing checking code in the module restored() method.
include the database with the application distribution: the ddl-generation strategy becomes do nothing. I could still use the JPA (at development time) to generate the database files (embedded Java DB).
The best solution would be for the installer/setup (first-time) to call initializing code that creates the database. This precisely what I do with JWS in here. But I don't know how to do that without JWS. A script/jar executed by the installer?
Distribute your NetBeans Platform application via JWS.
It seems like you already have this problem sorted out with JWS, so just use that solution to deploy your NetBeans platform app.
EDIT
An alternative approach would be to use a Module Installer that checks for the existence of a config file. If the file exists then the application has been run before and the setup is not required. If the file doesn't exist then run your setup steps.
Have a look at this tutorial, they're using a module installer to create a login dialog.

Resources