I am trying to get hold of BDD using Specflow. One of the problems with Specflow is generating the steps. If I do not have step file then it will generate the steps in output window which I can add in the custom step file. But what happens if I edit the feature file? How can I re create the steps?
Even if you already have a step file, SpecFlow will detect lines in the feature file that do not have a matching step definition and will output generated code for those steps. And if you e.g. add a new scenario that uses only existing step definitions, you shouldn't need to touch the step file at all.
Related
I'm doing an iOS framework and now i need to implement something like this: At the stage of the project assembly, I want to make a request to the server, get the JSON in response and write it to the project file. Thus, the user who downloaded the application, and opened it without the Internet will already have these files. In Android, it is possible to implement this function using the Gradle plugin. What the right way to implement this in iOS? Thanks in advance for the answer.
You can use a Run Script phase in the Build Phases section of your project.
Step 1
Add the initial version of the file to your project. Make sure it's added to the target.
Step 2
Select your project and go the build phases tab. You should be able to see the file being copied to the bundle in the Copy Bundle Resources section.
Step 3
Add a new Run Script to your build. Click the plus button at the top-left of the editor.
Give the phase a sensible name by double clicking the label.
Reorder the phase as early as possible by dragging it up the list.
Step 4
Using your favourite scripting language/command line thing download the new file and replace the existing file.
e.g (untested demo bash sample, probably wont work)
MYFILE=${TEMP_DIR}/something.json
curl -o $MYFILE https://myserver.com/stuff/something-latest.json
cp -f $MYFILE ${SRCROOT}/Sploopy/Resources/something.json
You can examine the environment with the build inspector and see what values you can use to get the file in place.
Ones that will come in handy are:
TEMP_DIR is a good place to put files temporarily.
SRCROOT so you know where to copy the downloaded file to.
CONFIGURATION so you can choose when to do this action. Personally I would only do it on Release but YMMV. It will be a blocking action.
Step 5
Profit
We are creating a framework and want to offer an easy way for a user to add it in their project. Possibly a script which will add framework into the project without any xcode interaction.
mod-pbxproj appears to be an option but also looking for other options, preferably shell script based options.
I looked at .pbxproj file and I think it would be straightforward to copy and add framework files, however, some inputs of structure will be appreciated.
Please do not suggest Cocoapods/Carthage, we are looking for 100% command line option and both these options require some form of xcode interaction.
I was reading a blog to better understanding the purpose of making a project for sublime (or any editor):
When you save your code as a project you end up with two files. The
first is the project file which contains references to folders for
your project, project based settings and build commands for your
project. The second file is the workspace. This is simply a file that
tracks what layout you're currently using and what files you have open
in each pane. Using the workspace file means that you can switch to
another project, do some work and then switchback to your original
project knowing that the layout and files you had open will be
restored back to the state you left them in. Handy.
So seems like there's 2 reasons? 1. is to save settings and 2. is to save the current layout of the files and folders you have already opened? I see reason 2 to be nice, but not really super important. What are some of the settings in reason 1 that's important to keep in between projects? What is a build command?
You might simply have to follow different coding standards for different customers, e.g. indentation rules, so its handy that you can set these rules on a per project basis.
A build system let's you run or compile code directly from Sublime Text.
In this case my method testDidSelectLocation() should be in DBLocationsViewControllerTests. For some reason this is copied into another classes, marked with violet icon, and trying to pass a whole test. That additional tests, sometimes do not pass the tests. It is fixed only when I mark it as disabled. How to remove them?
I got this problem after removing some of the tests which I don't need.
Following steps solved my problem:
1.)Quit Xcode
2.)Open your scheme file in a text editor(Don't use Xcode UI to edit scheme, you have to manually open from your local storage, I found it under: xxxxx.xcodeproj/xcshareddata/xcschemes/xxxx-tests.xcscheme)
3.)Delete all the skipped tests under <SkippedTests>...</SkippedTests>
4.)Delete Derived data folder under Developer/Xcode
5.)Restart Xcode
I am trying to use Mogenerator with Xcode 5 but it is generating only one set of ManagedObject class (.h and .m) files instead of two set of (Machine and Human) files. I have tried many tutorials already but no use so far. If anyone could provide a step by step guide to use Mogenerator with Xcode 5 would be really helpful.
I followed the procedure mentioned in the below link.
http://adoptioncurve.net/archives/2012/12/setting-up-mogenerator-in-xcode-4-dot-5/
These are the steps I followed,
Installed 'Mogenerator'
Added new mogenerator target.
Selected 'New Mogenerator' target and then selected 'Build Phases'.
Then from the Editor tab --> Add Build Phase --> Add Run Script Build Phase
Opened Run Script section on 'Mogenerator' target and edit the script like this
mogenerator -m MyCoreDataApp/MyCoreDataApp.xcdatamodeld -O MyCoreData/Model --template-var arc=true
Selected 'Main' target and added Target dependency as Mogenerator.
Selected the 'Entity' on the Core Data file (xcdatamodeld) and then selected Editor --> Create NSManagedObject Subclass.
Checked 'Main' target in the popup window. (Even tried selecting 'Mogenerator' target).
Only two files, which are NSManagedObject subclasses (.h and .m) are being recreated.
Please let me know if I missed any steps in the process.
First, your steps 7 and 8 should be unnecessary. You're duplicating steps that mogenerator is supposed to be taking. You should not be taking those steps, and you should delete the files that you created using those steps. Creating those files is mogenerator's job, when you're using it.
The results you describe suggest one of the following scenarios:
mogenerator did not actually run for some reason. Take a close look at the build log to make sure that it did.
mogenerator ran but failed for some reason. Again, check out the build log for signs of trouble.
mogenerator ran normally but you're either looking in the wrong place for its results or just not quite understanding the process.
If mogenerator works normally, it generates two class files for each entity in the model. But it does not automatically add the files to your Xcode project. If the files are already part of the project then Xcode uses the new versions. But if they're new files, you need to add them to the project before Xcode will notice them. If this is the case, then your mogenerator command means that the files are located in MyCoreData/Model just waiting for you to find them.
I was having the same problem, build mogenerator, but no files would get generated. My problem was that I forgot to add a custom subclass to the .xcdatamodel
I checked my build log just like Tom mentioned above, which is how I saw the message "skipping entity SiteInfoGeneral (NSManagedObject) because it doesn't use a custom subclass"
Hope this is helpful to someone!