All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.avito.reportviewer.model.TestNameExt.kt Maven / Gradle / Ivy

Go to download

Collection of infrastructure libraries and gradle plugins of Avito Android project

There is a newer version: 2023.22
Show newest version
package com.avito.reportviewer.model

import com.avito.report.model.Team
import com.avito.test.model.TestName
import com.avito.test.model.TestName.Companion.delimiter

/**
 * Название теста устроено так:
 * [        префикс      ][  юнит  ][фича][        название теста     ]
 * com.avito.android.test.messenger.chat.ReceiveMessageFromBlocked.test
 */

// todo дать возможность указать юнит в аннотации
public val TestName.team: Team
    get() = when {
        packageName.startsWith(domofondPrefix) -> Team("domofond")
        packageName.startsWith(avitoPrefix) ->
            try {
                val unitPrefix = packageName.substringAfter("$avitoPrefix.").substringBefore(delimiter)
                Team(unitPrefix.replace("_", "-"))
            } catch (e: Exception) {
                Team.UNDEFINED
            }
        else -> Team.UNDEFINED
    }

private const val avitoPrefix = "com.avito.android.test"
private const val domofondPrefix = "ru.domofond.test"




© 2015 - 2024 Weber Informatics LLC | Privacy Policy