Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

203
Visualizações
Why this line is not covered? Xcode code coverage

I'm experiencing an issue with the report of code coverage in Xcode. As you can see from this screenshot:

enter image description here

On the left tab, line 58 is "touched" from the break-point, and on the right tab, the test passes. While on the right tab, I'm running only the test on line 37.

Why does Xcode sign the line 58 in red, as not covered?

Line 53 is not "touched" (if I set a break-point there). Using SQLite as a database.

The entire project is available here.

EDIT: Adding code:

Test.swift

func testAddFuelFail() {
  fuelsManager.dropTable()
  XCTAssertEqual(addFuel(), -1)
}

FuelsManager.swift

func addFuel(dateOfFuel: Date, mileageOnSave: Int, quantityOfFuel: Double, pricePerUnitOfFuel: Double) -> Int64 {
  let insertFuel = fuelsTable.insert(date <- dateOfFuel, mileage <- mileageOnSave, quantity <- quantityOfFuel, pricePerUnit <- pricePerUnitOfFuel)
  do {
    let id = try database!.run(insertFuel)
      return id
  } catch {
    print(error)
  }
  return -1
}
over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

Actually its a bug reported here.

  1. Coverage number varies between multiple runs on XC 10 on the same binary. Like in first run it shows x% vs in another run it will show y% keeping the same code.
  2. Coverage number/Number of tests varies while running on 11.4 simulator and 12.0 simulator, both ran on XC 10
  3. Number of tests also a little different like in some run it was 5507 tests vs in some runs it was 5506.

XC 10 certainly came with lots of bugs.

over 4 years ago · Santiago Trujillo Relatório

0

Take the breakpoint out and run the test. Once the test has finished running the coverage information should change.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda