可以说我有一个Pod DevelopmentPod。
在此pod的podspec中,我添加了一个test_spec,如下所示-
s.test_spec 'UnitTests' do |test_spec|
test_spec.source_files = 'UnitTests/**/*.{h,m,swift}'
test_spec.ios.resources = ['UnitTests/**/*.{json}']
end
Run Code Online (Sandbox Code Playgroud)
在我的项目的Podfile中,我按如下方式添加了pod:
pod 'DevelopmentPod', :path => '<location>', :testspecs => ['UnitTests']
Run Code Online (Sandbox Code Playgroud)
运行pod install之后,我看到已经创建了一个新的目标DevelopmentPods-Unit-Tests,并使用Manage Schemes中的新方案,我可以轻松地执行测试用例。
为了将该方案集成到Jenkins中,我将需要单独的工作。我有多个开发吊舱,这意味着多个工作。然后还必须合并来自不同作业的测试用例执行数据。我们不能确定地说这些单独的工作测试的代码与实际构建的代码相同。
解决此问题的最佳方法是什么?
我可以轻松地将所有单元测试从不同的Pod移到我的主应用程序,并为它创建一个单元测试目标(这也解决了Jenkins的工作问题),但是我的主应用程序会被很多单元测试代码弄得一团糟要求。我想在Pod本身中保留Pod特定的单元测试。
我有一个在viewController中启用了分页的scrollView,我想拥有6个集合视图,这些collectionViews是滚动视图的子视图。collectionView中有不同数量的项目。
viewDidLoad看起来像这样-
override func viewDidLoad() {
super.viewDidLoad()
//Set the frame for scroll view
//Programatically created 6 collection views and added them to scrollView
//Set the content size for scroll view
}
Run Code Online (Sandbox Code Playgroud)
每个collectionView都与viewDidLoad中的标签关联。
collectionView1.tag = 0
collectionView2.tag = 1 and so on..
And the collectionViews were added to the scroll view serially starting from collectionView with tag 0
let noOfItemsArray = [2, 4, 6, 3 ,8, 7]
// 1st collection view has 2 items, 2nd has 4 and so on..
func …Run Code Online (Sandbox Code Playgroud)