2015-11-04 35 views
1

打開反應原生UIExplorer示例之後,我可以快速運行帶XCode中cmd + u的測試套件。通過的指示由文檔代碼閱讀,我來到這一段代碼在IntegrationTestsApp.js在React Native中運行個別集成測試

return (
    <View style={styles.container}> 
    <Text style={styles.row}> 
     Click on a test to run it in this shell for easier debugging and 
     development. Run all tests in the testing environment with cmd+U in 
     Xcode. 
    </Text> 
    <View style={styles.separator} /> 
    <ScrollView> 
     {TESTS.map((test) => [ 
     <TouchableOpacity 
      onPress={() => this.setState({test})} 
      style={styles.row}> 
      <Text style={styles.testName}> 
      {test.displayName} 
      </Text> 
     </TouchableOpacity>, 
     <View style={styles.separator} /> 
     ])} 
    </ScrollView> 
    </View> 
); 

如何運行測試程序,這樣我可以手動運行每個測試(「點擊每個測試「)?

回答

1

我沒有找到解決,雖然在寫作的時候,好像相當黑客攻擊。從本質上講,我跑的IntegrationTestsApp經由主要的應用程序:

  1. 改變rootView在AppDelegate到:

    RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge 
    moduleName:@"IntegrationTestsApp" initialProperties:nil]; 
    
  2. 改變sourceURL到文件導出上述模塊:

    sourceURL = [NSURL URLWithString:@"http://localhost:8081/Examples/UIExplorer/UIExplorerIntegrationTests/js/IntegrationTestsApp.bundle?platform=ios&dev=true"]; 
    
  3. 將RCTTest.a鏈接到「Build Phase」中

    再一次,我希望有更好的答案,但這*出現*工作

相關問題