How can I run only one ui-test from fastlane? - xcode

how can I run only one ui-test by XCTest from fastlane?
I know about parameters for fastlane: only_testing but not understood how to use this.
Can you give an example
I run my all ui-tests as:
fastlane ios RunningUITests
but want fastlane ios RunningUITests only_testing:GTUITests/GT00FirstClass/testFunc
this not work for me
Can you give an exactly example for this?

You have to use the scan (also known as run_tests) "action". Read this documentation for information.
There, you can see the instructions for calling it directly on the command line. In your example it would be:
fastlane scan --workspace "<YourRunningUITests>.xcworkspace" --scheme "<YourRunningUITestsScheme>" --only-testing "GTUITests/GT00FirstClass/testFunc"
Replace the values inside of the angled brackets (< >) with the values appropriate to your code.
However, rather than running that multi-parameter call from the command line, I recommend using a Fastfile to consolidate your logic and allow you to perform more sophisticated logic (such as these Fastfiles).
If you were to follow the logic suggested here, you could then simply call fastlane tests from the command line. Much simpler.

The comment from above is very useful, the only thing I want to add is that if you want to run more tests, write something like the following:
--only-testing "GTUITests/GT00FirstClass/testFunc,GTUITests/GT00FirstClass/testFunc2"
You should always write the full path to the test function

Related

Write to Chef::Log from a template script?

I work on a team that decided long ago to use Chef's template resource to make dynamic scripts to be executed in an execute reource block.
I know this feature was only built to generate config files and the like, but I have to work with what I've got here.
Basically I need to know how to write to Chef::Log from a Ruby script generated from a template block. The script is not in the same context as the cookbook that generated it, so I can't just call require 'chef/log' in the script. I also do not want to just append the chef-run.log because that runs into timing problems.
Is there any way to accomplish this as cleanly as possible without appending to chef-run.log?
Thank you for your time.
Chef::Log is a global, so technically you can just call its methods directly from inside a template, but this is really weird and you probably shouldn't. Do whatever logging you need from the recipe code instead. If you need to log some values, compute them in the recipe and them pass them in using variables.

how do I run a single test from the command line using jasmine 2.0

As the title says, I would like to run a single test, not the whole spec. The naive way I tried was using a case like this:
describe("MyCase",function() {
it("has a test",function() {
expect(something).toBe(something);
}
it("has another test",function() {
expect(something_else).toBe(something_else);
}
}
This is saved in a file called MyCase.spec.js (if this matters). I would have thought that it would be possible to run just the first case using the following from the command line:
jasmine-node --match="MyCase has a test"
But this is apperantly not the way to do it. So how is it done?
Thanks!
it may be pretty old channel but it would help someone who is looking for running specific testcase with jasmine 2.0. Use "fdescribe" to run a specific suite and use "fit" to run a specific spec.This skips all other tests except marked.
keep an eye and not to commit fdescribe and fit to repo. Here f describe the "focus".
For lower versions we can use ddescribe, iit as described in upper answers.
Change it with iit and run your test as usual.
Thus only this test will be run and all others will be ignored.
E.g.
iit('should run only this test', function () {
//expect(x).toBe(y);
});
The same works for the describe block, just rename it to ddescribe
Also you can ignore a single it test by renaming it to xit
And xdescribe works too
Not sure if it is applicable for jasmine-node, but using ts-node and Jasmine's node modules path, I can use the filter flag to match the spec's string. For me it looks like:
ts-node node_modules/jasmine/bin/jasmine --filter="employees*"
This would match all the 'it' blocks within a 'describe' block that begin with 'employees'.
It might not be what you need exactly, but I would like to propose using karma / karma-jasmine.
Within Karma, Jasmine is "patched" and provides additional ddescribe and iit methods. If you rename one of your suites to ddescribe or one of your specs to iit (takes precedence over ddescribe), only this suite or spec will be executed. Concerning your question, you could rename your first spec to iit and then only this spec would be executed. Of course, this is only useful while developing the spec.
A downside on this is, that one can easily end up having only a fraction of one's test suites being tested for a long time. So don't forget to rename it back to the usual version (no double d's, no double i's).

Debug one function only in liteIDE (golang)

I was wondering if it is possible inside liteIDE to run only one function, using some parameters, and see what a variable contains after executing one specific code line.
Thanks.
Indeed, I could (and should !) write a test for it.
And for seeing what a variable contains at some step in the execution, either:
debug-print it inside the function, then run the test
Use a debugger (for go it's called delve) and step through either the test or the real program

Scons - How Can I Detect When a File is Pulled from Cache?

I have an issue in which I need some code to run as a result of a command builder:
node = env.Command (target, dependencies, function)
In this case, function will run if the target is out of date, which is what I want, but if the target is in the cache, function doesn't run. What I'd like is to run a different function if the target is pulled from cache.
I tried:
env.AddPostAction(node, function2)
but that function doesn't get called either.
Any ideas? Thanks.
Afaik, scons will not know how it will satisfy the demand while executing your code. It makes that decision after completing the 1st pass. So, even if you could tell, I don't believe you could act on it within your code.
An easy, obvious way is to parse the scons output for 'Retrieved ... File name'.
And of course, the problem suggests the dependencies are set up badly, and it looks like you fixed that.

Ruby debugging and console

can anyone suggest a nice (not Netbeans) platform where i would be able to write ruby code to test?
I find irb a bit hard to follow when you want to define a method more than 3 lines long, and then test it.
Also, maybe just as a wish list item, some way where I could do follow the code step by step to monitor values in variables and make sure things are being done properly?
I'm asking because so far I've been writing in rails, but what you see is the final result of the method, and if you already expected a certain answer, then is fine, but if I need a more complicated method, i would like to be able to follow all the steps to make sure is doing what I want it to do.
Thanks a lot!
a great ide is rubymines by intellij. it is not free though. you can step through code and have the usual ide debugging features.
otherwise if the only problem you have is that you are examining code that is more than 3 lines, you can install the ruby-debug gem and then put the keyword debugger in your code and it will cause a break. So you don't need to put code into irb, just run your ruby script and it will break.
I know you said you find irb a bit hard to follow when you want to define a method more than 3 lines long, but if you use irb -rn ./(your file name here), you will get an irb output of every class, method, module, etc.
irb will walk through line by line so you can see what is working and what is not (you'll get true, false, nil, etc) for each line of code. I've found that you can skip what you already know is working and move on to where you feel the issues are.

Resources